A Portal (2007) modding tool that injects a custom DLL into the game process and renders an interactive overlay via DirectX 9 hooking. x86 Windows only.
A command-line DLL injector. Given a process name and a DLL path, it locates the target process using CreateToolhelp32Snapshot, allocates memory inside it with VirtualAllocEx, writes the DLL path, and executes LoadLibraryA via CreateRemoteThread.
A shared library that, once injected, hooks into Portal's DirectX 9 render pipeline using MinHook. It vtable-hooks IDirect3D9::CreateDevice and IDirect3DDevice9::EndScene to render a Dear ImGui overlay each frame. The hook chain is set up on DLL load — no external configuration needed.
Requirements: CMake, Ninja, MinGW (GCC), C++23.
git submodule update --init
cmake -G Ninja -S cc-inject -B cc-inject/build
cmake --build cc-inject/buildSame process for cc-trainer. Static linking is used throughout, so the resulting binaries are portable across Windows installations.
cc-injector.exe portal.exe cc-trainer.dllThe injector finds portal.exe, injects the DLL, and the trainer hooks into the render pipeline. An ImGui overlay appears in-game.
- Injection —
CreateRemoteThread+LoadLibraryAloadscc-trainer.dllinto the Portal process. - Hook setup — On
DLL_PROCESS_ATTACH, a thread initializes MinHook and hooksIDirect3D9::CreateDevice. - Device capture — When Portal creates its D3D9 device, the hook saves the device pointer and chains
IDirect3DDevice9::EndScene. - Overlay — Every frame, the
EndScenehook initialises Dear ImGui (once) and renders an overlay with a placeholder UI.
MIT. See LICENSE.