diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-30 03:32:59 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-30 03:32:59 +0200 |
| commit | aa096fe6886681d3338573cd3af779b57a5b56ab (patch) | |
| tree | 14aee66fa1c3c168c140f02006aec246f9bbc23c /CONTEXT.md | |
| download | hl2h-aa096fe6886681d3338573cd3af779b57a5b56ab.tar.gz hl2h-aa096fe6886681d3338573cd3af779b57a5b56ab.zip | |
init
Diffstat (limited to '')
| -rw-r--r-- | CONTEXT.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/CONTEXT.md b/CONTEXT.md new file mode 100644 index 0000000..21128f7 --- /dev/null +++ b/CONTEXT.md | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | # Context: HL2 Linux Internal Cheat (`hl2hake`) | ||
| 2 | |||
| 3 | ## What is this project? | ||
| 4 | |||
| 5 | A minimal, featureless cheat for Half-Life 2 (native Linux build, 32-bit `hl2_linux`). Originally ported from a Windows reference (`hake`) that implemented auto-bhop, auto-ABH, and auto-climb via a `CHLClient::CreateMove` vtable hook. | ||
| 6 | |||
| 7 | ## Resolved terms | ||
| 8 | |||
| 9 | - **Build**: LD_PRELOAD a 32-bit `.so` into `hl2_linux` via Steam's bundled 32-bit runtime (`steam-runtime/run.sh`). | ||
| 10 | - **Hook**: Copy-and-swap vtable on the `CHLClient` instance (slot 21 = `CreateMove`). 256-slot copy to cover all dispatched virtuals. | ||
| 11 | - **Netvars**: RecvTable walk from `IBaseClientDLL::GetAllClasses` (vtable slot 8). Prediction datamap scan for `CBaseEntity::m_MoveType` (networked `movetype` is a virtual proxy with offset 0). | ||
| 12 | - **CInput**: Discovered via byte-scan of `CHLClient::CreateMove` prologue (gcc PIC `call thunk; add $imm,%esi` idiom), resolving the module-level `IInput*` variable. | ||
| 13 | - **UserCMD CRC**: Standard CRC-32 (IEEE reflected, poly `0xEDB88320`, init `0xFFFFFFFF`). Field set and offsets verified against the binary's `CInput::ValidateUserCmd` disassembly. | ||
| 14 | - **Module discovery**: `/proc/self/maps` scan for `client.so` / `engine.so` basenames (exact match at `/` boundary). PROT_NONE (`---p`) entries excluded. Merged file-backed ranges absorb one directly-adjacent anonymous `.bss` tail; anon-to-anon chaining is prohibited. | ||
| 15 | - **Calling convention**: All game virtuals use **cdecl** with `this` as first stack arg (`0x8(%ebp)` in prologues, bare `ret`). No MSVC `__thiscall`. | ||
| 16 | |||
| 17 | ## Netvar offsets (this build, verified via both RecvTable walk and pred-TD scan) | ||
| 18 | |||
| 19 | | Field | Offset | Source | | ||
| 20 | |---|---|---| | ||
| 21 | | `m_fFlags` | `0x33C` | RecvTable + pred TD | | ||
| 22 | | `m_vecVelocity[0]` | `0xE0` | RecvTable (array, FIELD_VECTOR) | | ||
| 23 | | `m_MoveType` | `0x164` | pred-TD only (networked `movetype` has offset 0) | | ||
| 24 | |||
| 25 | ## Key engine index table (IVEngineClient014, this build) | ||
| 26 | |||
| 27 | | Index | Method | Verification | | ||
| 28 | |---|---|---| | ||
| 29 | | 8 | *(not ClientCmd)* | Disasm: per-player index bounds check on `(arg-1)` — likely `GetPlayerInfo` | | ||
| 30 | | 9 | *(not ClientCmd_Unrestricted)* | Disasm: loop over split-screen players — no-op'd in single-player | | ||
| 31 | | 12 | `GetLocalPlayer` | Disasm: `return *(CClientState + 0x1b0) + 1` — confirmed in-game | | ||
| 32 | | 65 | `HudUpdate`-family | Crash-site (256-slot bump): `call *(this, float)` | | ||
| 33 | |||
| 34 | Console output uses `ConMsg` from `libtier0.so` (resolved via `dlsym(RTLD_DEFAULT, "_Z6ConMsgPKcz")`), not `IVEngineClient::ClientCmd`. | ||
| 35 | |||
| 36 | ## Menu system | ||
| 37 | |||
| 38 | - **Toggle architecture**: each feature is runtime-toggleable, ON by default. A `MenuState` struct holds per-feature `active` bool and `bind` (key code or None). | ||
| 39 | - **Rendering**: hook `IEngineVGui::Paint` via `VEngineVGui001` — draws every frame including the main menu. Text-only overlay in top-left corner. | ||
| 40 | - **Persistence**: INI-style plain text config; one line per setting (`climb_active=1`, `climb_bind=MOUSE3`). Config written on every state change; loaded before hooks install. | ||
| 41 | - **Input model**: Insert toggles menu open/closed; arrow keys navigate the tree; Enter expands/collapses nodes and toggles boolean fields; Escape closes the menu. Modal while open (all game input blocked). Long-term: selective pass-through for unused inputs. | ||
| 42 | - **Bind assignment UX**: selecting a Bind node enters bind-select mode; any key press becomes the new bind; Escape sets bind to None (disabling the feature); Enter cancels bind change and reverts. | ||
| 43 | - **Tree layout**: HL2hake (root) → Climb (Active + Bind), Bunnyhop (Active), ABH (Active). Children indented. All nodes expanded by default when the menu opens. | ||
| 44 | |||
| 45 | ## Open questions | ||
| 46 | |||
| 47 | None currently. | ||
