- C++ 91%
- Python 3%
- CMake 2.8%
- C 2.6%
- PowerShell 0.4%
- Other 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
The loader (hosts/darner, core, platform, game/gta6), the mod ABI and the C++ game layer (include/modsdk), the mod template, the tools that generate the bindings and the catalog, and the tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
| cmake | ||
| core | ||
| docs | ||
| game/gta6 | ||
| hosts/darner | ||
| include/modsdk | ||
| platform | ||
| templates/mod | ||
| tests | ||
| third_party | ||
| tools | ||
| .gitignore | ||
| build.ps1 | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
modsdk (working name)
A mod loader and SDK for GTA VI story mode, out of tree, starting with the Darner compatibility layer. MIT licence.
State: Phase 3 (natives on the script thread), checked in the game
hosts/darnerbuildsmodsdk.dll. Darner loads it from%LOCALAPPDATA%\darner\mods.- When Darner maps the game exe, the loader loads the mods in
mods\modsdk\mods\, one folder per mod. - It logs to
mods\modsdk\modsdk.logand prints a summary in Darner's window.
- When Darner maps the game exe, the loader loads the mods in
- The mod ABI is
include/modsdk/modsdk.h, API 1.6. A mod is a DLL plus amod.tomlmanifest. It gets:- its own log (
mod.log) and config (config.toml); - the game's name, build and address;
- hooks with chaining: several mods may hook one function, and each one's
originalkeeps working when others are added or removed; - keys: a mod claims a key and the game does not see it. Darner's own keys (F1-F3, F6-F9,
[,]) are reserved, and so is the quick menu's key (F5 unless changed); - the overlay: draw functions called in one Dear ImGui frame drawn into the game's own frames. While a mod captures input (its panel is open), the game gets no keyboard, mouse or controller (the controller through Darner's controller for mods, below);
- settings (API 1.2): toggles, choices, numbers and actions players change in the game's pause
menu. The loader keeps their values in the mod's
settings.tomlbetween starts; - the script thread and natives (API 1.3): tick functions called once per game frame after the
game's script update, scripts that
wait(ms)and carry on (fibers), andnative_callby hash (native_hash("GET_ENTITY_COORDS")). Ticks start once a game script is running (not while the game loads). Natives run as one of the game's own running scripts; a native or script that crashes is caught and logged, and natives that would end or change that script are refused. They need the native table,modsdk\natives.tsv(see below). - the quick menu (API 1.4): a trainer-style menu drawn over the game, like a GTA V trainer's, that
the game keeps running under. It opens with a key or a controller combination, picked on the Mods
menu's "Quick menu" page: the key (Off, F5 to F8, Insert, Home; F6 to F8 are Darner's keys too and
are taken from it), the combination (Off, LB + RB, RB + d-pad left, Hold View) and how long it is held
(0 to 1 s; Hold View at least 0.3 s). F5 and LB + RB by default. The arrows, the numpad (8 2 4 6, 5 or
Enter selects, 0 or Backspace goes back) or the d-pad (A selects, B goes back) move. While it is open
the game gets no keys but Darner's own and nothing from the controller; keys and buttons still down
when it closes stay away from the game until they are let go. The mouse still reaches the game. The
controller needs a Darner with the controller for mods (
darner_controller): it watches for the combination every 8 ms and keeps it from the game, and a press of one of its buttons alone reaches the game a moment late. Without it the quick menu opens from the keyboard only. Each mod with a menu has a line on its first page; a mod's pages hold actions, toggles, numbers, choices, lines of text and links to its other pages, and can be filled again each time they open. The items' functions run on the game's script thread, so they may call natives. C++ mods haveinclude/modsdk/menu.hpp(pages with lambdas). Settings stay in the pause menu's Mods menu; menu values are not kept between starts. It draws in the game's own fonts (the pause menu's GTA Art Deco) when they are inmodsdk\fonts, else in Windows' fonts. They come from your copy of the game and are never in this repository: extract the Latin font library fromdata.rpfwith OpenRage (openrage-cli rpf listshows it asfontlib_gfxfontlib_efigs;openrage-cli rpf scan-body <rpf> <offset> efigs.gfxwrites it), thenpython tools/game_fonts.py convert efigs.gfx %LOCALAPPDATA%\darner\mods\modsdk\fonts(standard library only); - game functions (API 1.5): some of the game's own functions, found in the game's image and
checked before use, called by name on the script thread with a fault caught. So far
VehicleSpawn(the spawn cheats' function), the pause menu's mission commands (ActiveMission,MissionEvent) and the player's wanted level (WantedLevel,LowerWantedLevel,ReportWantedLevel,ClearBounty). C++ mods haveinclude/modsdk/function.hpp; - async natives (API 1.6): natives that create a ped, load text and the like, which the game only
accepts from inside one of its own scripts. The loader makes the call there (right after a native
the game's scripts call all the time), adds the cancellation token and the type id, and keeps the
result until the mod polls it. Only the ones the loader knows in this game build:
_CREATE_PED_OUTFIT_VARIANTand_TEXT_BLOCK_REQUEST_ASYNC. C++ mods haveinclude/modsdk/async.hpp. How it was found: docs/api-1.5.md; - typed bindings for C++ mods:
modsdk/natives.hpp, one function per native (ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), false)returns aVector3), overinclude/modsdk/native.hpp(the types, cells andinvoke<R>). Generated at build time; mods linkmodsdk_bindings.MODSDK_EXPORTgives C++ mods unmangled exports.
- its own log (
- The game layer (
include/modsdk/game), over the typed bindings, for C++ mods (game build 1794606036): the peds and vehicles near the player, world-to-screen, and the weather (its 168 types read from the game, 38 of them named; set one, give it back), and spawning (spawn.hpp): a vehicle through the game's spawn, set down on its wheels in front of the player, and a ped of any ped model through the async natives (both checked in the game; a ped was still there after 90 s, the longest checked; a model that is not loaded is loaded first), and lists of the game's 327 vehicles, 1071 peds and 73 weapons (catalog.hpp): name, hash and group, to iterate or look up, for spawn menus without typing hashes, and the vehicles by the class the game gives them (catalog_types.hpp: Sports, SUVs, Boats, ...) (names from rage.tools, MIT;tools/gen_catalog.py), the pause menu's mission commands from anywhere (mission.hpp: skip or restart the stage, restart or quit the mission), and the player's wanted level (law.hpp): report a crime (the police are called and the stars climb, as the game's own cheats do), lower or clear it at once, keep it at most n stars. The police act on reports, a heat zone and a description, not on the stars, so there is no "set 4 stars". All checked in the game. Layouts read from the game's code are noted in each header. - The Mods menu (game build 1794606036, Xbox 1.0.2.1): the pause menu gets a "Mods" entry after
Settings, built from the game's own elements. It lists each loaded mod, with:
- Enabled: turns the mod off or on while the game runs. A mod is unloaded only if it exports
modsdk_mod_unload; the loader then removes its hooks, keys, draw functions and settings and frees it. A mod without it says "Off at next start". The mods that need a mod go off with it, and what a mod needs comes on first. Mods turned off are listed inmodsdk\menu.tomland stay off at the next start. - the mod's settings.
- Enabled: turns the mod off or on while the game runs. A mod is unloaded only if it exports
- Mods:
templates/modis the starting point for a new mod (built against the installed SDK);tests/mods/hello.cis the smallest mod, in C, with a toggle and an action. - Third-party code, in
third_party: Dear ImGui (MIT), shipped asmodsdk\imgui.dllfor the loader and every mod, and MinHook (BSD-2), insidemodsdk.dll.
Layout in Darner's mods folder:
%LOCALAPPDATA%\darner\mods\
modsdk.dll
modsdk\
modsdk.log
menu.toml (written by the Mods menu: the mods turned off)
natives.tsv (the native table, made at build time from natives.json)
mods\
hello\
mod.toml
hello.dll
config.toml (optional: greeting = "hi")
settings.toml (written by the Mods menu: the values picked)
mod.log
Build, test, install
Needs Visual Studio or Build Tools 2026 with the C++ x64 tools. The script uses the CMake and Ninja that come with Visual Studio.
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Test # build, then run the tests
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Install <folder> # also lay out a mods folder
The test host (tests/test_host) runs the core with a pretend game and a folder of test mods. It covers
every refusal: missing or broken manifest, wrong API, missing, disabled or too-old dependency, cycle,
wrong game build, a load function that fails or crashes, a missing DLL, and a duplicate id.
It also checks the hook chains, the key registry, the overlay registry, the API's owner checks, the
settings API, the script tick (ticks, scripts that wait, crashes) and native calls with pretend
handlers (results, a caught fault, refused natives, calls outside the tick), a C++ mod's exports, and
turning mods off and on (dependents, a mod that cannot or will not unload, menu.toml,
kept settings after loading again).
tests/test_native checks typed native calls (how each type goes into cells and comes back) with
pretend natives, and with the bindings built, that they call by the right hash with the right cells;
without them it prints SKIPPED for that part.
tests/test_menus checks the quick menu through the mod API: refused items, moving through pages,
toggles, numbers and choices, the calls players' changes make (one per value changed before the script
tick), opening pages, the keys and the controller, scrolling a long page, filling a page again, a mod
going away, and the C++ helper.
tests/test_rbf and tests/test_pause_menu check the reader and writer of the game's interface layouts
(RBF0) and the Mods menu builder. On the game's own files they need files you extracted from your copy:
MODSDK_SAMPLE_RBF (any layout) and MODSDK_SAMPLE_PAUSE_MENU (the pause menu's); without them they
print SKIPPED for that part.
tests/test_overlay runs the overlay on a real D3D12 device, in a hidden window of its own: it checks that
the overlay starts at the first present, keeps a claimed key from the window, dispatches its press, and
draws into the back buffer, and that F5 opens the quick menu, which keeps the arrows from the window and
is drawn. It prints SKIPPED and passes when there is no D3D12 device.
Try it without starting the game
darner run without --execute loads the mods, maps and binds the game, then stops. Point
DARNER_HOME at a scratch folder, so your own mods folder is left alone:
$env:DARNER_HOME = "$env:TEMP\darner-home-test"
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Install "$env:DARNER_HOME\mods"
Push-Location <your Darner folder> # darner.toml is read from here
.\target\release\darner.exe run "<your game folder>\game_scarlett_master.exe"
Pop-Location
Get-Content "$env:DARNER_HOME\mods\modsdk\modsdk.log"
Remove-Item Env:DARNER_HOME