This chapter is the map: which game build mods target, how Azimuth runs it, where the files live, the three ways to make a mod, the tools to build and reverse-engineer with, and a test routine that keeps players' saves safe. Read it first, then jump to the chapter for your route.
1.1 One game build
Every address in this guide, and in every FH2 mod, is for one file only:
| File | forza_durango_release_final.exe (the Xbox One build of Forza Horizon 2) |
| Build date | 24 Nov 2015 |
| PE TimeDateStamp | 0x565501ED |
| SizeOfImage | 0x3A18000 |
| Preferred image base | 0x140000000 |
| Built with | Visual C++ 2012 family, compiler and linker build 65501 (15.6) |
Addresses are written as an RVA, game+0x12CC730, or as the absolute address at the preferred base, 0x1412CC730.
They are the same place. Always work from the base the loader hands you, never from the constant 0x140000000:
under Wine and Proton the exe has been seen mapped at 0x14690000, 0x18940000 and 0x19D40000, with its absolute
pointers relocated.
Azimuth 1.0.1 and later can also run Forza Motorsport 5 and 6 from the same launcher. Their exes share the file name and preferred base, so check the header before you touch anything:
| Game | Title ID | TimeDateStamp | SizeOfImage |
|---|---|---|---|
| Forza Horizon 2 | 1A96545B | 0x565501ED | 0x3A18000 |
| Forza Motorsport 5 | 7B35D917 | 0x53D8D1F2 | 0x279D000 |
| Forza Motorsport 6 | 64F9397E | 0x58AFB1CD | 0x1FC8000 |
The FH2 Mod Platform does this check for you and refuses hooks into any other game. An Extra Options plugin gets
game_image_size in its context and should compare it with 0x3A18000.
1.2 How the game runs on PC
- Azimuth is the loader. It is not an emulator in the usual sense: it maps the Xbox One exe into its own process
(
azimuth.exe) when the player presses Play and translates the Xbox APIs to Windows ones. So Azimuth, the game and every mod share one process.GetModuleHandle(NULL)returnsazimuth.exe, not the game, and the game is not in the module list. - The game's own drives:
game:\is theMountfolder;T:\(temporary storage) is<Azimuth folder>\data\titles\1A96545B\tmp. Agame:\path containing..stops the game with "Invalid runtime path component". Host paths such asC:\...are not found by the game's file system. - Azimuth ends the game with
TerminateProcess. NoDLL_PROCESS_DETACH, no atexit handlers, no destructors run. Write anything you need to keep as you go. - Mods get into the process by being loaded by a DLL that Azimuth already loads:
DLL next to azimuth.exe | Who | Loaded by |
|---|---|---|
d3dcompiler_47.dll | FH2 Mod Platform | Azimuth up to 1.0.1 |
DWrite.dll | FH2 Mod Platform (same file) | Azimuth 1.0.1 and later; the only one 1.0.3+ loads |
winmm.dll | Extra Options | Azimuth (the supported versions are in chapter 3) |
Don't add another proxy DLL of your own: these names are taken, and two proxies of one name cannot both load.
1.3 Where things live
Paths below are relative. <Azimuth> is the folder holding azimuth.exe; <Mount> is the game folder Azimuth points
at ([title-1a96545b] folder= in <Azimuth>\data\azimuth.ini, a UTF-16 file).
| Path | What |
|---|---|
<Mount>\forza_durango_release_final.exe | the game |
<Mount>\media\ | the game's data: zips, the database Stripped\gamedbRC.slt, string tables, UI, cars, tracks, audio (chapter 4) |
<Mount>\mediaoverride\ | files here replace files in media (see 1.5) |
<Mount>\mediapc\ | a second override folder, read after mediaoverride |
<Mount>\DLC\StormIsland_...\ | the Storm Island expansion, a separate package that Azimuth's content= setting points at |
<Azimuth>\data\azimuth.ini | Azimuth's settings (UTF-16) |
<Azimuth>\data\titles\1A96545B\saves\ | saves, as numbered revisions. Mods never write here. |
<Azimuth>\data\titles\1A96545B\tmp\ | the game's T:\. Platform 2.9.0+ keeps its own layer in tmp\fh2-platform\media\ |
<Azimuth>\fh2-mods\ | platform mods (*.dll), platform.log, crash reports, the platform's records |
<Azimuth>\FH2_ExtraOptions.ini / .log | Extra Options' settings and log |
<Azimuth>\mods\Forza Horizon 2\<mod>\ | Extra Options mod packages and their plugins (EO 0.4.5+) |
Several Azimuth folders can point at the same Mount. They then share mediaoverride, so a file one install writes
there shows up in the other. Prefer the platform's per-folder layer or Extra Options' own mod folders when you can.
1.4 Three ways to make a mod
| Route | You write | Good for | Read |
|---|---|---|---|
| FH2 Mod Platform mod | a DLL in fh2-mods\ exporting fh2mod_init | anything: hooks, settings on the in-game MODS page, pages, title-screen entries, hotkeys, HUD text, database and string changes, car packs | chapter 2 |
| Extra Options plugin | a DLL in an EO mod's plugins\ folder exporting FH2PluginInitialize | mods for players who run EO; a per-frame player-car callback and a database callback come with it, hooks are your own (MinHook) | chapter 3 |
| Data-only mod | files: replacement media, an EO package (database.json, strings.json, carbin.json), or a platform car pack | new liveries, cars, text, tuning of database rows, UI tweaks | chapter 4 |
They mix: the platform and Extra Options run together, and the platform waits for EO to finish patching before it lets mods hook. Many players run both. A platform mod reaches the most players and gets the MODS page, update checks and crash reports for free; an EO plugin suits a mod that is part of an EO package anyway.
A rule of thumb: change data before code. If a database row, a string table or a replaced XAML page does the job, it is safer than a hook, survives other mods better and is easy to switch off.
1.5 How the game finds files
The game asks its file system for game:\media\.... Override folders are mounted above media:
mediaoverride(and, on Azimuth 1.0+ without EO, the platform's layer inT:\fh2-platform\mediaabove it)mediapcmedia
A file inside a zip is replaced by a loose file at the same path with the zip's name as a folder:
media\UI.zip\Scenes\Anthem\A_Hud.xaml is replaced by mediaoverride\UI\Scenes\Anthem\A_Hud.xaml. The list of files
in each zip comes from media\zipmanifest.xml, which the game trusts; never edit the game's zips.
Who mounts the override folders:
- With Extra Options: EO, when its
EnableMediaOverrides=1. - Without it: platform 2.7.3 and later mount them itself.
Most files are read once at start-up (the database, string tables, most UI). Changes made after the game has read them show from the next launch.
1.6 Toolchain
- Compiler: clang targeting MinGW (llvm-mingw) with CMake and Ninja.
The released mods and the platform's CI use it.
- You need clang's MSVC-style SEH (
__try/__except,-fms-extensions) to read game memory safely. GCC MinGW doesn't support it. Some mods refuse MSVC in their CMakeLists because they also use GNU extensions. - Link with
-staticso you ship no libc++ or libunwind DLLs. - Release builds from llvm-mingw are stripped. For readable crash reports, also build with
-gcodeview -Wl,--pdb=and keep the PDB.
- You need clang's MSVC-style SEH (
- Hooking library: the platform has MinHook built in and chains hooks between mods. Without the platform, use
MinHook yourself (BSD-2 licence: ship
LICENSE-MinHook.txt). - SQLite: compile it in if you read the database yourself.
winsqlite3.dlldoesn't exist under Wine.
A platform mod's build, in PowerShell (keep it in one command, so PATH only changes for it):
$env:PATH = '<llvm-mingw>\bin;' + $env:PATH
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64-x86_64.cmake
cmake --build build
1.7 Reverse-engineering the game
This is the overview; chapter 15 walks through it with commands and a worked example.
The exe is a gift to modders: it isn't packed, and much of the C++ type information survives.
- RTTI is intact. For any object,
vtable[-1]points to an MSVCCompleteObjectLocator, which leads to a type descriptor with the class name (.?AVForzaCar@@). That's how most of the names in this guide were found. .pdatagives every function's bounds, so you can tell where a function starts and whether an address is the start of an instruction.- Strings and log formats in the exe name many systems; search them first.
- Disassemblers: any will do (Ghidra, IDA, Binary Ninja). For quick checks, llvm-mingw ships
llvm-objdump:llvm-objdump -d --no-show-raw-insn --start-address=0x1412CC730 --stop-address=0x1412CC800 forza_durango_release_final.exe - The STL is MSVC 2012's. Layouts and sizes for
std::string,vector,shared_ptr,list,map,deque,unordered_mapand more are in chapter 11. - Know how it was built. The compiler build, the flags the code shows and what follows from them are in 15.6.
- Probe in game before you build a feature. A small mod that logs what a hook sees (with a hotkey to dump state) answers in one run what hours of static reading may not. Log plain sentences you can search later.
- Test offline where you can. A harness that maps the real exe from disk and calls your code against a fake platform API catches wrong offsets and byte checks without starting the game.
1.8 Test routine
- Back up the saves before every in-game test (copy
data\titles\1A96545B\savessomewhere else). Mods must never edit saves, but a crash mid-save can still hurt one. - Install the mod alone first, then alongside the popular mods (Extra Options, Achievements, WreckingBall, FH2MP's client if you claim online support).
- Read the logs right after each run. They're rewritten on every launch, and Azimuth can start the game twice in
one launch:
fh2-mods\platform.log: line 1 names the platform version that ran; your mod's lines carry[YourMod].fh2-mods\crashes\crash-*.txt: call stack asgame+0x...andYourMod.dll+0x..., the mod a crash came from, and every hook in place.FH2_ExtraOptions.log: whether EO applied its patches (OK:), refused them (REFUSED:) or is off.
- Tell builds apart by hash, not version string. Test builds often keep the old version.
- Ship as players install: see the packaging notes at the end of chapter 2 and the EO package format in chapter 3.
1.9 Where to go next
- Writing code against the platform: chapter 2, then chapter 5.
- Using Extra Options: chapter 3.
- Changing data: chapter 4; adding a car: chapter 14.
- Looking for a hook for a feature: chapter 6 and chapter 7.
- Something broke: chapter 10.
