Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CompanionCube32

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.

Components

cc-inject

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.

cc-trainer

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.

Building

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/build

Same process for cc-trainer. Static linking is used throughout, so the resulting binaries are portable across Windows installations.

Usage

cc-injector.exe portal.exe cc-trainer.dll

The injector finds portal.exe, injects the DLL, and the trainer hooks into the render pipeline. An ImGui overlay appears in-game.

How It Works

  1. InjectionCreateRemoteThread + LoadLibraryA loads cc-trainer.dll into the Portal process.
  2. Hook setup — On DLL_PROCESS_ATTACH, a thread initializes MinHook and hooks IDirect3D9::CreateDevice.
  3. Device capture — When Portal creates its D3D9 device, the hook saves the device pointer and chains IDirect3DDevice9::EndScene.
  4. Overlay — Every frame, the EndScene hook initialises Dear ImGui (once) and renders an overlay with a placeholder UI.

License

MIT. See LICENSE.

About

Portal (2007) modding tool

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages