Skip to content

External C++ game trainer demonstrated at DEFCON 33 Game Hacking Village. Hooks into a running GZDoom process via Win32 APIs to read and modify memory at runtime. Features pointer chasing, executable memory scanning, and inline x86 patching for cheats such as infinite ammo. Includes an ImGui-based GUI for toggling features.

Notifications You must be signed in to change notification settings

Game-Hacking-Village/cpp_external

Repository files navigation

Doom External Trainer

Our goal is to teach you what is happening underneath the hood of programs such as Cheat Engine. We hope to give you insight as to how to perform similar modifications by reverse engineering game code through the development of an external trainer for GZDoom. Enjoy!

Building Code

  • Make sure the imgui submodule is pulled.
    git clone --recurse-submodules [email protected]:Game-Hacking-Village/cpp_external.git
    

Necessary Dependencies that need to be installed:

scoop
msys2
cheat engine
pyton3
clion-ide (optional)
  1. Navigate back to the parent directory, cpp_external

  2. Run PowerShell as Administrator (right click) and change execution policy to allow installation of Scoop

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  1. Run installation Scoop Package Manager in a new non-Administrative PowerShell terminal:
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
  1. Install MSYS2 Build Platform
scoop install msys2
  1. Set up msys2 environment using PowerShell.
msys2 -c "pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake"
  1. In PowerShell and add MSYS to path and replace user with current Windows Username:

    setx PATH "%PATH%;C:\Users\<user>\scoop\apps\msys2\current\mingw64\bin"
  2. Close and Restart PowerShell and verify that the MSYS path is added to PATH VARIABLE:

    $Env:Path

C:\Users<user>\scoop\apps\msys2\current\mingw64\bin should be the last path of the Path Environmental Variable

If so the MSYS tooling can now be accessed using PowerShell and is ready to use!!!

  1. Install CLion IDE in PowerShell (Optional), Python (if necessary) and Cheat Engine
scoop update *
scoop bucket add extras
scoop install extras/clion
scoop install python
scoop install extras/cheat-engine

-or-

Visit website, Download and Install CLion IDE directly from JetBrains using traditional GUI installation:

https://www.jetbrains.com/clion/
  1. Open clion-ide/PowerShell and clone external trainer repo:
git clone --recurse-submodules git@github.com:Game-Hacking-Village/cpp_external.git
  1. Navigate to imgui directory into cpp_external dir:
git clone https://github.com/ocornut/imgui.git
  1. Download GZDoom
cd doom
python download_doom.py doom_game

Now GZDoom will be ready to run in doom_game dir with Freedoom.

  1. Build External Trainer Executables (if using PowerShell instead of CLion)
cmake .
cmake --build .

Clean CMake-generated Build

cmake --build . --target clean

Overview

Key Directories

./doom - dir with script to download and setup gzdoom + freedoom
./doom/doom-game - dir that contains the binary code for gzdoom including gzdoom.exe
./simple_game - a simple game to practice simple memory reading+writing
./external - the main source dir with the external trainer code

Build targets

game - build the simple game
external_simple - build the simple external (write to an arbitrary address in a process)
external_gui_doom - a gui based external trainer for gzdoom

Key Files for Developing the Doom External Trainer

(*** -> means user needs to edit the file):

Files in cpp_external/external:

*** external_doom_gui.cpp >>> key file for building the interface for the GUI of the External Trainer

memory.cpp and memory.h >>> Contains resolve_PointerMap() function for traversing the chains of pointers to find destination address and ScanExecMemory() + CompareSignatureToBytes()
to scan to see if particular group of assembly instructions exist in within a process's executable memory pages

CMakeLists.txt >>> cmake file for building and compiling the code

process.ccp and process.h >>> Contains functions to get the process handle, process id and base address of the process

Key files in cpp_external/external/doom:

*** doom.ccp and doom.h >>> Creates the DoomProc class and setters and getters need to be built for each target (Pistol Ammo, Health, etc.)
*** offsets.h contains PointerMap structures for each of the targets to hard code the base offset and vector of additional offsets (Pistol, Ammo, Health, etc.)

About

External C++ game trainer demonstrated at DEFCON 33 Game Hacking Village. Hooks into a running GZDoom process via Win32 APIs to read and modify memory at runtime. Features pointer chasing, executable memory scanning, and inline x86 patching for cheats such as infinite ammo. Includes an ImGui-based GUI for toggling features.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •