WALLHACKS & ESP / Wallhack and ESPEnemies drawn through walls and smoke, or marked with boxes, names, health, weapons and distance.
- Where
- Client process memory. Reads the world-state positions the server streams to the client (opcode 0x3C4C on .47/.53:10009 TCP, up to ~1.4 MB per session) and paints them through a D3D9 overlay (EndScene vtable slot 42) or DrawPrimitiveUP (slot 83). Target: the in-memory position array the LithTech renderer already holds for each nearby player.
- When
- Active after world connect (T+117 s from runtime.hpp). D3D9 overlay hooks must be installed before T+33 s (device creation). World-state positions arrive once a match begins. Runs every frame (~86 draws/frame, ~240 FPS). CFCompat’s PEB cleanup runs before the T+1.3 s and T+33 s scan windows.
- How it works
- A separate program reads the client’s memory, where the positions the server already streamed in (opcode 0x3C4C, up to 1.4 MB per session on the world TCP socket) are kept, and paints boxes, names and lines over the game — through a transparent overlay window, or by hooking the D3D9 device’s EndScene (vtable slot 42) or DrawPrimitiveUP (slot 83) calls.
- Why it is possible
- To play a footstep and draw a player the instant they turn a corner, the server streams nearby player positions to your client before you can see them (world-state opcode 0x3C4C, up to ~1.4 MB received per session on the .47:10009 TCP socket). The client already knows where they are; the wall only decides what DrawPrimitiveUP (D3D9 vtable slot 83) renders.
- What stands in its way
- GameGuard’s ring-0 kernel driver (npggNT.des) watches for programs reading the game’s memory. XIGNCODE3’s user-mode monitor (xcorona.xem + 7 .xem modules) and Aegis (AegisDll.dll) add further layers. The less the server sends about players you cannot see, the less there is to show.
- CFCompat
- Directly relevant. Any code injected into CrossFire’s process to read memory and hook D3D9 draw calls faces the five anti-cheat layers CFCompat was designed to handle. CfAcCompat.cpp’s Validate() runs three checks before any AC scan window opens: (1) PEB Sanitizer — validate_ldr_entry() confirms the proxy DLL’s LDR entry name matches the expected name (XIGNCODE3 flags a name mismatch); (2) Memory Validator — validate_mem_image() verifies all committed pages are MEM_IMAGE, not MEM_PRIVATE (kernel-mode drivers flag MEM_PRIVATE as injected shellcode); (3) Export Validator — PeView checks the key export is present and the ordinal base matches the real DLL. Additionally, vh::peb_mask::apply(All) cleans BeingDebugged (PEB+0x2), NtGlobalFlag (PEB+0x68) and HeapFlags (PEB+0x18) atomically before each scan window (T+1.3 s and T+33 s).
runtime.hpp · cfdiag_net.log · world-state stream| S→C 0x3C4C | Bulk world-state the server pushes to the client (chunked, length-delimited) |
| ~1.4 MB recv | sock=8492 to .47:10009 TCP — ~118 KB sent, ~1.4 MB received (11.8:1 ratio) |
| 17,408-byte burst | Single recv at lobby connect (.36:10008), encrypted payload |
| positions | Nearby players arrive before they are on your screen |
| ~86 draws/frame | D3D9 DrawPrimitiveUP at ~240 FPS (login) — each draw is a potential read point |
The client receives and holds every nearby player's position, health and state before you can see them — the game needs this to draw a player the instant they turn a corner and to play their footsteps through positional audio. A cheat that reads those positions works entirely in memory; there is no file for CFireSDK to read. GameGuard's kernel driver, XIGNCODE3 and Aegis watch the running process for exactly this.
wallhack_esp.cpp123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#include <cfsdk/runtime.hpp>
#include <d3d9.h>
using namespace cfsdk;
struct EspTarget { float x,y,z; int team, hp; char name[32]; };
static std::vector<EspTarget> g_targets;
static decltype(&recv) o_recv;
static EndScene_t o_EndScene;
// 1. Intercept world-state positions (opcode 0x3C4C on .47/.53:10009 TCP)
int WINAPI hk_recv(SOCKET s, char* buf, int len, int flags) {
int n = o_recv(s, buf, len, flags);
if (n > 4 && (uint8_t)buf[0] == runtime::net::FRAME_START) { // 0xF1
uint16_t op = *(uint16_t*)(buf + 1); // LE u16 at bytes[1..2]
if (op == runtime::net::OPCODE_WORLD_STATE) { // 0x3C4C
g_targets.clear();
parse_positions(buf + 3, n - 4, g_targets); // chunked payload
}
}
return n;
}
// 2. Draw ESP overlay through D3D9 EndScene (vtable slot 42)
HRESULT WINAPI hk_EndScene(IDirect3DDevice9* dev) {
D3DVIEWPORT9 vp; dev->GetViewport(&vp);
D3DXMATRIX proj, view, world;
dev->GetTransform(D3DTS_PROJECTION, &proj);
dev->GetTransform(D3DTS_VIEW, &view);
D3DXMatrixIdentity(&world);
for (auto& t : g_targets) {
if (t.team == g_local_team) continue;
D3DXVECTOR3 scr;
D3DXVec3Project(&scr, (D3DXVECTOR3*)&t, &vp, &proj, &view, &world);
if (scr.z > 0 && scr.z < 1) {
draw_box(dev, scr.x, scr.y, t.hp > 50 ? 0xFF00FF00 : 0xFFFF0000);
draw_text(dev, scr.x, scr.y - 15, t.name);
draw_text(dev, scr.x, scr.y + 30,
std::to_string((int)dist(g_local_pos, *(Vec3*)&t)).c_str());
}
}
return o_EndScene(dev);
}
// 3. Install: CFCompat → Winsock hooks (before T+1.3s) → D3D9 hooks (before T+33s)
BOOL WINAPI DllMain(HINSTANCE h, DWORD r, LPVOID) {
if (r != DLL_PROCESS_ATTACH) return TRUE;
cfon12::compat::Validate(h, GetModuleHandleW(L"dinput8.dll"));
o_recv = hook_iat("WS2_32.dll", "recv", hk_recv);
auto* dev = wait_d3d9(); auto vt = *(void***)dev;
o_EndScene = (EndScene_t)vt[runtime::d3d::SLOT_END_SCENE]; // slot 42
patch_vt(vt, runtime::d3d::SLOT_END_SCENE, hk_EndScene);
return TRUE;
}