A Universal, Modular, and Extensible C++20 Game Modding & Reverse Engineering Framework
Bridges the gap between low-level x64 C++ runtime manipulation and high-level Lua scripting through a plug-and-play, engine-agnostic adapter architecture.
π Overview β’ β¨ Key Features β’ ποΈ Architecture β’ π― Use Cases β’ π Getting Started β’ π» How to Use β’ π§ͺ Testing β’ πΊοΈ Roadmap
UniMod Framework is a modern, lightweight, and universal modding framework written in C++20 for Windows x64. Traditional game modding tools are typically tightly coupled to a single target game or engine, requiring reverse engineers and developers to repeatedly reinvent proxy injection, memory scanning, DirectX hooks, and scripting bridges for every new title.
UniMod solves this fragmentation by decoupling the Core Runtime from target-specific engine logic using an Engine Adapter Pattern (IEngineAdapter).
Whether you are targeting proprietary in-house engines or commercial engines, UniMod provides immediate out-of-the-box infrastructure for:
- Transparent DLL Proxy Hijacking (
dinput8.dll) without external injectors. - SIMD-accelerated AOB (Array of Bytes) pattern scanning and 64-bit RIP-relative address resolution.
- DirectX 11 SwapChain VTable hooking with Dear ImGui overlay integration.
- An embedded, sandboxed Lua scripting runtime with live file Hot-Reloading.
- π Engine-Agnostic Adapter Architecture: Adapt to any game engine by implementing the
IEngineAdapterinterface and lettingAdapterManagerautomatically probe and activate it at runtime. - π Native DLL Proxy Hijacking: Built-in
dinput8.dllexport forwarding chains original calls to WindowsSystem32\dinput8.dllwhile safely escaping the OS Loader Lock via asynchronous initialization. - π§ Robust Memory Manipulation & AOB Scanner: Scan memory with IDA-style wildcards (
48 8B 05 ? ? ? ? 48 85 C0), resolve RIP-relative offsets, and patch code using RAIIScopedVirtualProtect. - π¨ DirectX 11 SwapChain Hooking: Dummy device VTable discovery intercepts
Present(Index 8) andResizeBuffers(Index 13). IncludesWndProcmessage filtering and Dear ImGui input capture. - π Sol2 & Lua Scripting Runtime: Full C++ API bindings (
unimod.*,memory.*,gui.*) with PCall exception boundaries to prevent game crashes from script errors. - β‘ Live Script Hot-Reloading: Edit Lua scripts on disk with any text editor and see gameplay modifications update instantly without restarting the game.
- π‘οΈ Comprehensive Crash Protection: Loader Lock deadlock prevention, x64 16-byte stack alignment safety, and page-validation memory wrappers.
- π§ͺ 5-Phase Validation Test Suite: Every subsystem is backed by standalone unit and integration tests.
UniMod Framework is strictly decoupled into modular subsystems:
UniMod-Framework/
βββ include/unimod/ # Public Header API
β βββ adapters/ # IEngineAdapter interface & AdapterManager orchestrator
β βββ core/ # CoreRuntime lifecycle & thread-safe Logger
β βββ hooks/ # DirectX 11 SwapChain hooks & WndProc input capture
β βββ memory/ # AOB Pattern Scanner & ScopedVirtualProtect utilities
β βββ scripting/ # LuaEngine (Sol2) & C++ to Lua API bindings
βββ src/ # Subsystem Implementations (.cpp)
β βββ adapters/ # Adapter registration & dispatch logic
β βββ core/ # CoreRuntime state machine & spdlog sink config
β βββ hooks/ # Dummy device creation, MinHook detours & ImGui rendering
β βββ memory/ # Fast byte searching & PE section scanning
β βββ scripting/ # Sol2 runtime setup, bindings & hot-reload tracker
βββ proxy/
β βββ dinput8/ # dinput8.dll proxy stub, export forwarder & DllMain
βββ adapters/
β βββ mock_adapter/ # Reference implementation simulating a proprietary game engine
βββ assets/
β βββ scripts/
β βββ init.lua # Default entry script executed upon runtime boot
βββ cmake/
β βββ CompilerWarnings.cmake # Strict compiler warning configurations (/W4, /WX, -Wall)
βββ tests/ # Phase 1 to Phase 5 validation executables
βββ CMakeLists.txt # Target-based CMake build configuration
βββ vcpkg.json # Declarative dependency manifest
[ Target Game Process (x64) ]
β
βΌ (Loads local dinput8.dll proxy)
[ proxy/dinput8 (DllMain) ] βββ(Spawns Async Thread)ββββΊ [ CoreRuntime::Initialize ]
β β
βΌ (Forwards original API calls) βΌ
[ C:\Windows\System32\dinput8.dll ] [ AdapterManager::DetectAndActivate ]
β
βββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ
βΌ βΌ
[ DX11Hook & ImGui Overlay ] [ Sol2 LuaEngine & Hot-Reload ]
- Intercepts SwapChain Present - Executes assets/scripts/init.lua
- Blocks game input when menu open - Live watches *.lua file modifications
- Universal Mod Loaders: Create standardized mod frameworks for games lacking official modding SDKs.
- Lua Gameplay Scripting: Expose internal C++ engine functions, player stats, and inventory tables to high-level Lua scripts.
- Diagnostic In-Game Overlays: Render real-time memory inspectors, telemetry dashboards, free-cam tools, and debug consoles using DirectX 11 and ImGui.
- Signature-Based Game Patching: Use the pattern scanner and RIP resolver to build resilient game cheats/patches that survive game updates.
- Automated Reverse Engineering Research: Rapidly prototype hooks and object traversal routines using the plug-and-play adapter interface.
Ensure you have the following installed on your system:
- Operating System: Windows 10 / 11 (x64)
- Compiler: Visual Studio 2022 (MSVC v143 with C++20) OR MinGW-w64 / GCC 15+ (UCRT64)
- Build System: CMake 3.25 or higher
- Package Manager (Optional): vcpkg (Framework automatically fetches missing dependencies via
FetchContentif vcpkg is not present)
-
Clone the repository:
git clone https://github.com/EnderkingTR/UniMod-Framework.git cd UniMod-Framework -
Configure with CMake:
- Using standard CMake (FetchContent fallback mode):
cmake -B build -G "MinGW Makefiles"
- Using Visual Studio & vcpkg manifest mode:
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release
- Using standard CMake (FetchContent fallback mode):
-
Compile the project:
cmake --build build --config Release
Deploying UniMod into a target DirectX 11 game requires no external injector:
- Copy the compiled
dinput8.dllfrom your build output directory into the game's root directory (alongside the main.exe). - Copy the
assets/folder (containingscripts/init.lua) into the same directory. - Launch the game normally. UniMod will automatically load, chain DirectInput calls, attach to DirectX 11, and execute your Lua scripts.
- Press
[INSERT]in-game to toggle the Dear ImGui overlay dashboard.
Modders can create custom features in Lua without touching C++:
-- assets/scripts/init.lua
unimod.log_info("UniMod Lua Runtime initialized!")
-- Check if active engine adapter is available
if mock_engine then
unimod.log_info("Target Character: " .. mock_engine.get_name())
unimod.log_info("Current HP: " .. tostring(mock_engine.get_health()))
-- Modifying game attributes in real time
mock_engine.set_speed(15.0)
mock_engine.set_god_mode(true)
unimod.log_info("God Mode activated & movement speed boosted to 15.0 m/s!")
end
-- Native memory manipulation example
local target_ptr = 0x140001000
local current_val = memory.read_i32(target_ptr)
if current_val then
memory.write_i32(target_ptr, 9999)
endTip: Edit
init.luawhile the game is runningβUniMod will detect the file change and Hot-Reload your changes automatically!
To build support for a specific engine (e.g. Unreal, Unity, or a custom engine), implement IEngineAdapter:
#include <unimod/adapters/i_engine_adapter.hpp>
#include <unimod/core/logger.hpp>
#include <unimod/memory/pattern_scanner.hpp>
#include <imgui.h>
#include <sol/sol.hpp>
namespace unimod::adapters {
class MyGameAdapter : public IEngineAdapter {
public:
const char* GetName() const noexcept override { return "My Custom Game Engine"; }
const char* GetVersion() const noexcept override { return "1.0.0"; }
bool OnDetectEngine() override {
// Detect engine via signature, module, or window class
return memory::PatternScanner::ScanModule("", memory::Pattern::FromString("48 89 5C 24 ? 57 48 83 EC 20")) != 0;
}
bool OnAttach() override {
UNIMOD_LOG_INFO("MyGameAdapter attached! Hooking engine loops...");
return true;
}
void OnInitRenderer() override {
// Initialize textures or UI states
}
void OnUpdate(float deltaTime) override {
// Synchronous per-frame logic
}
void OnRenderOverlay() override {
// Render custom ImGui menu widgets
ImGui::Begin("My Game Cheats & Tools");
ImGui::Text("Engine Status: Online");
ImGui::End();
}
void OnBindScripting(sol::state& lua) override {
// Expose engine-specific functions to Lua scripts
auto myEngine = lua.create_named_table("my_engine");
myEngine["spawn_item"] = [](int itemId) { /* ... */ };
}
void OnDetach() override {
UNIMOD_LOG_INFO("MyGameAdapter detached cleanly.");
}
};
} // namespace unimod::adaptersUniMod Framework includes a dedicated 5-phase test suite ensuring stability across every subsystem:
# Run individual phase verifications:
./build/phase1_test.exe # Phase 1: Core Logger, MinHook integration & C++20 features
./build/phase2_test.exe # Phase 2: dinput8.dll Proxy export forwarding & Loader Lock safety
./build/phase3_test.exe # Phase 3: DirectX 11 SwapChain Hook, Dear ImGui & AOB Scanner
./build/phase4_test.exe # Phase 4: IEngineAdapter lifecycle & Mock Adapter live memory manipulation
./build/phase5_test.exe # Phase 5: Sol2 Lua runtime, C++ API bindings & live Hot-Reloading- Phase 1: Core Runtime, Logger architecture & MinHook integration
- Phase 2:
dinput8.dllProxy Hijacking, export forwarding & Loader Lock deadlock safety - Phase 3: DirectX 11 SwapChain VTable Hooking (
Present/ResizeBuffers) & AOB Pattern Scanner - Phase 4: Engine-agnostic adapter lifecycle (
IEngineAdapter) & Mock Adapter live verification - Phase 5: Sol2 & Lua (v5.4) scripting engine, C++ API bindings & live script Hot-Reloading
- Built-in Dear ImGui Overlay & In-Game Dashboard
- DirectX 12 & Vulkan swapchain hooking support
- Unreal Engine 4/5 Adapter (
GObjects,GNames,ProcessEventhooking) - Unity IL2CPP / Mono Adapter (domain traversal & internal calls)
Contributions, issues, and feature requests are welcome!
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'feat: Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.