A modular C++ framework that provides the common functionality required to build a game hack.
Building an external or internal hack for a new game usually involves rewriting the same core logic: hooking a graphics API, installing a WndProc, projecting world coordinates to screen space, and orchestrating per-frame tick/draw passes against a thread-safe data model.
Game-Hacking-Framework factors that core logic out as a C++ library. To port the framework to a new game, an integrator only implements the functions declared in bridge.hpp. Everything else - feature modules, menu, synchronization, and rendering backends, is reused as is.
- Modular feature system - each feature (
Aimbot,ESP,HUD) is a self-contained singleton that implements a uniformTick/Draw/DrawMenulifecycle. - ImGui-based overlay - feature menus are composed automatically into a single tabbed window toggleable at runtime
- Rendering backends - graphics-API hooking via Microsoft Detours
- Thread-safe data model - each feature owns a
std::recursive_mutex; tick and draw data are explicitly invalidated between phases to prevent the use of stale frame data. - Bring-your-own engine adapter - a small
bridge.hppsurface keeps engine-specific code isolated from the framework core. - Extensible - register custom
ITickableAndDrawablemodules to add game-specific features without modifying the framework.
The integrator drives the framework from the game's render or main thread:
game_hacking_framework::Tick()acquires the global lock, callsTickImpl()on every feature and on every registered custom tickable, then callsGlobals::Invalidate()to clear shared per-frame state.game_hacking_framework::Draw()acquires the global lock, callsDrawImpl()on every feature, and renders the menu when it is open.
Each feature derives from TickableAndDrawableBase<T> (a CRTP wrapper around Singleton<T>) which:
- Resets the feature's
Datastruct beforeTickImpl. - Clears the feature's
TickDataafterTickImpl, so draw code cannot accidentally read tick-only state. - Clears the feature's
DataafterDrawImpl, so the next tick starts from a known state. - Holds a
std::recursive_mutexguarding the feature's state for the full duration of each phase.
bridge.hpp declares the seam between the framework and the host game. The framework calls into the bridge for game-specific operations (projection, line of sight check, aim actuation); the integrator implements them in a bridge.cpp against the game's reverse-engineered types.
Provide a bridge.cpp in your DLL implementing every function declared in bridge.hpp, and implement the Player, MyPlayer, and Weapon constructors against your game's types.
// bridge.cpp (integrator-owned)
#include <Game-Hacking-Framework/bridge.hpp>
#include <Game-Hacking-Framework/globals.hpp>
#include <Game-Hacking-Framework/aimbot.hpp>
namespace game_hacking_framework
{
void SetupConfigurations(void)
{
// Tune per-game defaults, e.g. compensate for client-side prediction.
auto& aimbot = Aimbot::GetInstance().config_;
aimbot.use_custom_ping_ = true;
aimbot.custom_ping_ = 0.0f;
}
void SetupCustomTickableAndDrawables(void) { /* register custom features */ }
void CustomWndProcHandler(HWND, UINT, WPARAM, LPARAM) {}
void InternalTick(void)
{
// Populate Globals::my_player_ and Globals::players_ from engine state,
// then call game_hacking_framework::Tick().
}
std::optional<Vector2D> Project(const Vector3D& world) { /* ... */ }
bool LineOfSight(const Player& target) { /* ... */ }
void AimAtDirection(const Vector3D& dir) { /* ... */ }
}Call the appropriate backend's hook function once during DLL load. The backend installs and initializes ImGui, and invokes the supplied callbacks each frame.
// dllmain.cpp (integrator-owned)
#include <Game-Hacking-Framework/game_hacking_framework.hpp>
#include <Game-Hacking-Framework/backends/dx11.hpp>
DWORD WINAPI MainThread(LPVOID)
{
static const auto window_name{"Midair2 "};
if (!game_hacking_framework::Setup(window_name))
return 1;
HookDirectX(
window_name,
/* pre_render_callback = */ game_hacking_framework::InternalTick; },
/* post_render_callback = */ nullptr);
return 0;
}
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID)
{
if (reason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(module);
CreateThread(nullptr, 0, MainThread, module, 0, nullptr);
}
return TRUE;
}Tick() is typically run on the thread that owns the game/world state (though it may be able to run on the render thread depending on the game); Draw() must run on the render thread after Tick and before the backend submits the frame. The example above wires InternalTick into the DX11 backend's pre-render callback which then calls Tick(); this is useful for engines that expose a single tick site.
Inject the resulting DLL into the target process using any standard loader (manual map, LoadLibrary via remote thread, etc.).
All public symbols live in namespace game_hacking_framework.
| Function | Description |
|---|---|
bool Setup(std::string window_name) |
Locates the game window by title, installs the WndProc hook, and invokes SetupConfigurations / SetupCustomTickableAndDrawables. Returns false if the window cannot be found. Call once during DLL initialization. |
void Tick(void) |
Runs TickImpl on every feature and registered custom tickable, then invalidates shared per-frame state. Must be called once per frame before Draw. |
void Draw(void) |
Runs DrawImpl on every feature and renders the menu. Must be called on the render thread, after Tick and within the active ImGui frame established by the rendering backend. |
template <typename T> class Singleton; // T& Singleton<T>::GetInstance()
class ITickableAndDrawable; // Tick() / Draw() / DrawMenu()
template <typename T> class TickableAndDrawableBase; // CRTP + mutex + data lifecycleTickableAndDrawableBase<T> requires T to define three nested types - Data, TickData, Config - and to implement TickImpl(), DrawImpl(), and DrawMenuImpl(). It guarantees that:
mutex_is held for the duration of each phase.data_is zero-initialized beforeTickImpland cleared afterDrawImpl.tick_data_is cleared afterTickImplso it cannot leak into draw code.
The integrator implements every function below.
| Function | Responsibility |
|---|---|
void SetupConfigurations(void) |
Override default feature configs for the target game. |
void SetupCustomTickableAndDrawables(void) |
Register custom ITickableAndDrawable* instances into Globals::custom_tickable_and_drawables. |
void CustomWndProcHandler(HWND, UINT, WPARAM, LPARAM) |
Receive raw window messages for game-specific keybinds. |
void InternalTick(void) |
Optional helper for engines whose tick can be driven from a single hooked function. |
std::optional<Vector2D> Project(const Vector3D&) |
World to screen projection; return std::nullopt when behind the camera. |
bool LineOfSight(const Player&) |
Trace from MyPlayer to the target. |
void AimAtDirection(const Vector3D&) |
Apply a yaw/pitch change so the camera faces the supplied unit vector. |
A minimal integrator DLL is shown in the Usage section. A typical custom feature looks like:
#include <Game-Hacking-Framework/game_hacking_framework_core.hpp>
class Radar : public game_hacking_framework::TickableAndDrawableBase<Radar>
{
friend class game_hacking_framework::Singleton<Radar>;
protected:
Radar() = default;
public:
struct Config { bool enabled_{true}; float range_{5000.f}; } config_;
struct Data { /* per-frame draw data */ } data_;
struct TickData { /* per-frame intermediate state */ } tick_data_;
void TickImpl();
void DrawImpl();
void DrawMenuImpl();
};
// In SetupCustomTickableAndDrawables():
game_hacking_framework::Globals::GetInstance()
.custom_tickable_and_drawables.push_back(&Radar::GetInstance());