Navigation
Browse the developer docs

FH2 Modding Guide · Chapter 13

Troubleshooting, fixes and lessons

Something broke, or you are about to release.

By Trinculo54 · from the FH2 Modding Guide · CC BY 4.0 · copied 4 Dec 2026 · read the original, which may be newer

On this page

This chapter is where to come when something breaks. It starts with the logs and crash reports, then gives a symptom-to-fix table for the problems players and mod authors hit most, the crashes seen in the game with their guards, known conflicts between mods, performance work, and the techniques that did and didn't work. It ends with the lessons each public mod learnt the hard way, written as cause and fix so you can avoid the same mistakes.

All addresses are for forza_durango_release_final.exe of 24 Nov 2015 (TimeDateStamp 0x565501ED, SizeOfImage 0x3A18000), image base 0x140000000. game+0xRVA is an offset from that base, so game+0x12CC730 is 0x1412CC730. See chapter 1 for the build and chapter 5 for safe hooking.

13.1 First steps: which log says what

Most problems are explained in a log before anyone has to open a debugger. Read them in this order.

The files to look at

FileWritten byWhat it tells you
<Azimuth folder>\fh2-mods\platform.logFH2 Mod PlatformWhich DLLs loaded, what each mod changed, hooks refused, database and media override lines, crash summaries. Rewritten every launch.
<Azimuth folder>\fh2-mods\platform-logs\platform-<session>.logPlatformA copy per session, the newest 20 kept. Use it when the game was started twice.
<Azimuth folder>\fh2-mods\crashes\crash-<date>-<time>.txt and .dmpPlatform's crash filterThe crash report and minidump. The ten newest are kept.
<Azimuth folder>\fh2-mods\platform-session.jsonPlatformSession id, mods and versions, and state: running or crashed (with the report's name).
<Azimuth folder>\FH2_ExtraOptions.logExtra OptionsLine 1 is the version, line 2 the status (OK:, REFUSED:, DISABLED:, INACTIVE:), then the settings and FILES:, MODS:, PLUGINS: lines. No timestamps.
The mod's own logEach modFor example fh2-mods\WreckingBall.log, fh2-mods\Achievements\Achievements.log, fh2-radio\bridge.log.
fh2-mods\platform-cars-missing.txt, platform-eo-packs.txtPlatform (car packs)Cars a save needs that are gone, and whether packs got in with Extra Options (in or lost).

Three habits save a lot of time:

  • Copy the logs straight after a run. They are rewritten every launch, and Azimuth can start the game twice in one launch.
  • Check the file date of FH2_ExtraOptions.log. An old date means Extra Options didn't start at all (wrong folder, an Azimuth version it doesn't support, or Wine using its own winmm.dll).
  • Tell builds apart by hash, not by version string. Test builds often keep the old version.

Azimuth itself ends the game with TerminateProcess, so nothing runs at exit: there is no "game closed" line in any log, and platform-session.json never says "ended".

platform.log lines worth knowing

Line 1 is the platform version and line 3 the session. Every later line has a timestamp and the mod's name in brackets. The lines that answer most questions:

Line (or start of it)Meaning
loaded MyMod.dll <version>The DLL loaded; the version comes from its VERSIONINFO.
FAILED to load MyMod.dll (error N)Windows couldn't load it. Error 126 is usually a missing dependency DLL.
MyMod: fh2mod_init returned NThe mod returned non-zero, so it shows the red "Not working" row (13.2).
MyMod: fh2mod_init crashed (exception 0x...)The crash was caught; the mod is marked "Not working".
N mod(s) loadedEvery fh2mod_init has returned; text and the database are written now.
... game code doesn't match ...A hook, patch or direct call was refused because the bytes differ from the exe on disk. That feature is off.
a mod called wait_for_mods from fh2mod_init; call it from your own threadwait_for_mods returned 0 at once.
media overrides: ...Who mounts mediaoverride/mediapc, e.g. "Extra Options is here, so mediaoverride is left to it".
Extra Options isn't running: its winmm.dll is next to azimuth.exe, but Wine is using its own winmm.dll insteadWine needs a DLL override (13.2).
[Database guards] ...A car with a broken PowertrainID was listed without a drivetrain instead of crashing (13.3).
car packs with Extra Options: ...Each start-up check for car packs behind Extra Options; any failure turns packs off for that session.
Azimuth was started for X, not Forza Horizon 2: no mods are loaded / title gate: ...Azimuth ran another game; mods stayed out on purpose.
SQLite errors after a mod's nameOne of that mod's add_sql statements failed, and only that mod's changes were rolled back.

wait_for_code also logs when it gave up waiting for Extra Options (20 s after the game was mapped). If you see that line, Extra Options' log for this launch never reached a status line.

Extra Options' status line

Line 2 of FH2_ExtraOptions.log decides everything. Extra Options checks every one of its sites (352 in 0.6.0) before writing anything, and applies all of them or none.

Line 2CauseFix
OK: requested tweaks applied in memory.Working.
REFUSED: unexpected loaded bytes at <site>. No patches applied.Something changed one of its sites before it checked: a mod that hooked before wait_for_code, or (under Proton) a platform older than 2.9.0.Hook only after wait_for_code; update the platform.
REFUSED: invalid INI section, option, or value.An unknown key, section or value in FH2_ExtraOptions.ini.Remove it. Mods must never add keys to EO's ini.
REFUSED: INI must use UTF-8 or ASCII, not UTF-16.The ini was saved as UTF-16.Save it as UTF-8 or ASCII, under 8 KB.
REFUSED: executable differs from the supported FH2 build outside the known patch ranges. / unsupported executable size.The exe on disk was patched by something EO doesn't know.Restore the original exe.
REFUSED: unsupported Azimuth buildEach Azimuth version needs a matching Extra Options.Update Extra Options.
DISABLED: no memory changes made.[Global] Enabled=0.

The MODS: lines then say whether each EO mod is "ready" or why it was skipped (an id conflict, a dependency, a JSON error), and FILES: says which folders were mounted. See chapter 3.

Reading a crash report

The platform writes fh2-mods\crashes\crash-<date>-<time>.txt and a .dmp from its unhandled-exception filter, and puts a summary in platform.log. The report holds:

  • the exception (code and address);
  • the call stack as module plus offset: game+0x1710EC4 for the game, MyMod.dll+0x1A2B for a mod, and Azimuth or system DLLs by name;
  • the mod the crash came from, when the faulting address is in a mod;
  • every hook in place, marking the ones that were on, so you can see whose detour sat on the stack;
  • a crash inside a MinHook trampoline, named with the hook it belongs to;
  • whether another game ran in the session;
  • the PDB name, GUID and age of every DLL that has CodeView data.

Turning the offsets into something useful:

  1. Game offsets. Add 0x140000000 and disassemble around it with llvm-objdump:
    llvm-objdump -d --no-show-raw-insn --start-address=0x141710E80 --stop-address=0x141710F20 forza_durango_release_final.exe
    
    The exe's .pdata gives function bounds, and MSVC RTTI is intact (vtable[-1] leads to the type name), so you can usually name the class. Then look for the address in 13.3 and in the hook chapters.
  2. Mod offsets. Release builds from llvm-mingw are stripped. Build with -gcodeview -Wl,--pdb= so the report can name your PDB, keep the PDB of every build you hand out, and resolve the offset with llvm-symbolizer against that DLL (add the DLL's image base from llvm-objdump -p).
  3. More memory in the dump. From platform 2.8.0 the minidump includes the writable data of every DLL the platform loaded. Add your own heap ranges with api->add_dump_memory(mod, p, n) (1 byte to 64 MB each, 64 ranges across all mods), or put the word full in fh2-mods\platform-dump.txt for a full-memory dump (only the newest kept).

If another program installs a crash handler after the platform's, older platforms could end up with the two filters calling each other until the stack overflowed. Platform 2.9.0 fixed that: the other handler now runs once, after the platform's report.

Extra Options plugins don't get any of this: a plugin crash takes the game down with no report unless the platform is also installed. Under Proton or Wine the exe may be mapped at another base; the report's game+0x offsets still match this chapter, but full addresses don't.

13.2 Symptom, cause, fix

SymptomLikely causeFix
A mod shows the red "Not working" row on YOUR MODS, the MODS tab has a red !fh2mod_init returned non-zero. The platform docs' own example does if (!g_mod) return 1;, which is wrong.fh2mod_init must always return 0, even when the mod turns itself off on purpose. Log why and return 0.
Same, with "It crashed while starting (exception 0x...)"A crash inside fh2mod_init (caught by the platform).Check the exception in platform.log. Keep fh2mod_init short and move slow or risky work to your own thread.
Red row "Windows couldn't load it (error N)"A missing dependency DLL (for example winsqlite3.dll under Wine), or a 32-bit or debug-runtime build.Link statically (-static), compile SQLite in, and check imports with llvm-objdump -p.
Title screen says "Old FH2 Mod Platform: reinstall "The installed platform is older than the mod's platform_version.Reinstall from the mod's zip, or update the platform. Mods should register first and check the API version afterwards, so this line appears instead of silence.
Extra Options refused (line 2 REFUSED:)See the table in 13.1. Most often a mod hooked game code before EO had checked it.Hook only after api->wait_for_code(...). Plugins and other loaders must also wait for EO's status.
A mod works but one feature is off, log says "game code doesn't match"Another mod or Extra Options already changed those bytes, or the exe isn't the 24 Nov 2015 build.Expected behaviour: the feature stays off rather than crashing. To share a site, see 13.4.
No MODS tab in the pause menuExtra Options too old for this Azimuth, or EnableMediaOverrides=0; the platform isn't loaded at all (no platform.log); before platform 2.9.0, another mod had set_filed a page the platform owns; or the pause-menu code didn't match.Update Extra Options and keep EnableMediaOverrides=1. On Azimuth 1.0.3 or later the platform must be loaded as DWrite.dll (platform 2.7.4+). If only the pause-menu code differs, Settings > MODS still opens a stand-in list.
No platform.log at allAzimuth 1.0.3+ loads only DWrite.dll, and an old zip shipped only d3dcompiler_47.dll; or Wine ignored the DLL.Install a platform that ships both names (2.7.4+). Under Wine add dwrite=n,b (or d3dcompiler_47=n,b).
Text, database or file changes don't showNothing reads mediaoverride: Extra Options with EnableMediaOverrides=0, or Azimuth 1.0.1+ without EO and a platform older than 2.7.3.Turn the EO setting on, or update the platform.
The change was made after fh2mod_init returned. The game reads string tables, the database and most files once at start.Make string, SQL and set_file calls inside fh2mod_init. Later ones show from the next launch.
The mod reads its file back from a hard-coded mediaoverride. On Azimuth 1.0+ without EO, platform 2.9.0 writes to the Azimuth folder's own layer (data\titles\1A96545B\tmp\fh2-platform\media).Use set_file and override_root(); never hard-code mediaoverride.
One of the mod's SQL statements failed; that mod's whole transaction was rolled back.Read the SQLite error in platform.log. Use UPDATE and INSERT ... WHERE NOT EXISTS.
A loose file the game's start-up listing didn't see. The file system answers "exists" from that listing, not the disk.Ship files that exist at start; restart after any change.
A plain copy of gamedbRC.slt from an old platform (2.7.1 or older) overwrote another mod's database.Update every mod's bundled platform; change the database only with add_sql.
A car is missing from the garage or AutoshowA mod zip shipping platform 2.8.0 or older was extracted over a newer one: it drops car packs' cars with no warning.Reinstall the current platform. The platform lists what a save misses in platform-cars-missing.txt and takes a save snapshot first.
A car pack file also exists in mediaoverride, mediapc or an EO mod, or an EO mod ships its own zipmanifest.xml.Remove the clash; the log line "car packs with Extra Options:" says which.
Crash when the car list opensA car's Data_Car.PowertrainID isn't in Powertrains (stock Ids 0-7). Crash at game+0xB99CD3.Platform 2.9.0+ guards it and shows a red "Game database" row. Fix the row.
Crash loading a save after changing a car modUpgrade rows the save had fitted were renamed or removed. Crash at game+0x105BEEC, unguarded.Never change Ids of rows a save may hold. Add new rows instead.
A car never finishes loadingIts engine has no stock aspiration row, or its model names a library AO map that isn't there.See chapter 10 and chapter 4.
Crash at the title screen after adding a carA bad or grown zipmanifest.xml (crash at game+0xFD1927). The reader doesn't validate it.Don't edit zipmanifest.xml; use car packs or an EO mod package.
Stutter in free roamCar packs with Extra Options before platform 2.9.2 (about 4,000 disk queries a frame with four packs); EO car mods before EO 0.6.1; a mod calling VirtualQuery per frame; heavy background work on the PC.Update the platform and Extra Options; see 13.5.
Fullscreen flashes black on every Azimuth install, windowed is fineNot the mods.Restart the PC before suspecting anything else.
Extra Options does nothing under Wine/Proton, its log is oldWine uses its builtin winmm.dll.WINEDLLOVERRIDES="winmm=n,b". Platform 2.7.1+ logs this case.
Extra Options refused under Proton with media_override_native_resolverPlatforms before 2.9.0 mounted the media folders without seeing EO.Platform 2.9.0+.
A mod's checks fail only under ProtonThe exe is mapped away from 0x140000000 (seen at 0x14690000, 0x18940000, 0x19D40000) and pointers in data are relocated.Always use the base from wait_for_code/game_base. When comparing pointers with the exe on disk, take the load delta off. Code bytes need no change.
Database changes silently off under WinePlatforms before 2.7.1 used Windows' winsqlite3.dll, which Wine lacks.Platform 2.7.1+ (SQLite built in). Mods that read SQLite should compile it in too.
A proxy DLL of your own does nothing under WineWine ignores app-folder DLLs named after its own (winmm, dxgi, version, winhttp) without an override, and GetModuleFileName still reports the app folder.Detect a proxy by an export, not by name. Don't ship proxies; load through the platform or EO.
Several mods broke after installing one moreIts zip shipped an older platform DLL, which overwrote the newer one. Before 2.7.2 that loses other mods' databases; before 2.7.3 nothing reads mediaoverride without EO; before 2.7.4 Azimuth 1.0.3 doesn't load it; 2.8.0 and older drop car-pack cars; older ones also lose title-screen entries and hotkeys.Reinstall the newest platform last. Mod authors: bump the platform submodule to the latest release before every release.
Extra Options missing after tidying folderswinmm.dll moved into mods\ isn't loaded by Azimuth 1.0.4.Keep it next to azimuth.exe.
A mod page's layout comes out wrong (centred, 550 wide, stock menu style)Extra Options rewrites pages whose x:Class="..." text matches a stock page exactly.Write x:Class = with a space on your own pages.
Non-ASCII letters show as spaces in a mod's pageThe game's XAML reader decodes only named entities and lowercase-x hex references; decimal &#243; becomes a space. Files with no BOM are read as Latin-1.Use &#xf3; or UTF-8 with a BOM.
The game crashes when a mod's page opensThe page uses a resource key that doesn't exist in UI.zip.Check every StaticResource against the page, the platform's converters and App.xaml/AnthemApp.xaml before shipping.
A test build was replaced a minute after installingA launcher that auto-updates (FH2MP's) saw an old version string.Give test builds the current release's version.
New log lines don't appear (FH2MP)Its release log filter drops unknown prefixes.Add the prefix to the filter.

13.3 Crashes seen in the game

These are crashes that were seen, traced and guarded. "Guard" means the fix now in the named project; where the crash is still possible it says so. FH2MP issue numbers refer to github.com/Charelene/FH2MP.

Crashes with a known address

Crash atWhat was happeningCauseGuard or fix
game+0x369029 (0x140369029)WreckingBall, driving as areas streamedNotes about a procedural data object outlived it; the game reused the address for a new object.Forget every note for an address in the ProceduralModelsData::Serialize hook (game+0x1871B90) before inspecting the new object.
game+0xB99CD3, +0xB99D35, +0xB99D9E (0x140B99CD3...)The car list showing a modded carDriveTrainConverter (game+0xB99BE0) found no Powertrains row for Data_Car.PowertrainID. FH2MP issue #412.Platform 2.9.0 instruction hooks at game+0xB99CA0 and +0xB99D74 list the car without a drivetrain and log it. FH2MP guards the function too.
game+0x105BEEC (0x14105BEEC)Loading a saveUpgrade part rows the save had fitted were gone (Ids changed).Unguarded. Never change row Ids a save can hold.
game+0x1056BAE (0x141056BAE), +0x105BEEC, +0x12E0DE0, +0x12E26DDA modded car with bad physics dataBad values in its physics definitions.FH2MP guards at game+0x1056210, torque data load game+0xFCFE70, torque scale game+0x105E530 and the garage rating game+0x2CFA50.
game+0x1064408 (0x141064408)Reading a car's torque curveA null curve. Callers game+0x105D690, +0x105E700.FH2MP hooks the reader game+0x10643B0 and returns a safe value.
game+0xFD1927 (0x140FD1927)Start-upA bad zipmanifest.xml from a car mod. FH2MP issue #99.Refuse the bad file before the game reads it. The reader (game+0xFD1600) never validates it.
game+0x4FAB4F (0x1404FAB4F)Loading a world a second timeOne folder loaded as both an open world and a "homespace" in one session; a freed fixup handler, since materials are cached by path.Give a custom world its own name; never reuse a stock homespace name.
game+0x1710EC4 (0x141710EC4)Online, another player's car reloadingDestroying the car's Granny animation state machine (destructor game+0x1710E80) with a null list. FH2MP issue #502.Instruction hook at game+0x1710EBB skips the walk when the list is null.
game+0xF6D928 (0x140F6D928)Unloading a car modelThe model loader at +0x4D20 was already null. FH2MP issue #449.Instruction hook at game+0xF6D8FF skips.
game+0x66A492 (0x14066A492)Travel XPDivide by zero. FH2MP issue #428, 36 reports.Instruction hook at game+0x66A48D skips a zero divisor.
game+0xF60526 (0x140F60526)More cars than usual in a sessionThe car list outgrew its reserve (reserve game+0x305A20, push_back game+0x308E20). FH2MP issue #486.Reserve more room in the Simulation constructor (game+0xF8B770).
game+0x144661D (0x14144661D)A 13th party member joiningThe party list holds 12. FH2MP issue #47.A bigger list. Grow car slots, labels, party rows and ids together.
game+0xF2B32D (0x140F2B32D), +0xF445EC (0x140F445EC)AI ids past 11Fixed-size id tables.Shared stand-in ids.
game+0x9C898F (0x1409C898F)A write inside game+0x9C88E0Bad target. FH2MP issue #318.Guard the write.
In game+0x922350 (0x140922350)SetRemotePrediction virtual with a player who had leftThe player object was gone. FH2MP issue #345.Instruction hook at game+0x9224DD skips.
game+0x2D8EA4 (0x1402D8EA4)A component lookupBad component. FH2MP issue #146.Guard at game+0x454F20.
game+0x21F44D (0x14021F44D)A cinematic's call [rip+slot]Null target. FH2MP issue #43.Null check.
In game+0x1031E40 (0x141031E40)CCamAnimPlayer (vtable 0x142E779D8)FH2MP issue #479.Guard.
Freed memory, called from game+0x783E7E (0x140783E7E)The speedometer (UpdateGauges, game+0xAD6070)Another mod's hook left a relay that was later freed; 26 reports.Check the target is still mapped before the call, and check rarely (13.5).
game+0x1385BFB (0x141385BFB)Secondary-view visibility on a custom trackExecuteCommandList object/device mismatch.Not solved; avoided.
game+0x37DB (0x1400037DB, inside the game's built-in zlib inflate, game+0x3268-0x487A)Streaming a track's GeoChunksChunk entries inserted mid-chunk or appended without their own group: an inflate crash.Rebuild chunks whole (chapter 10).
game+0x3B94F0 (0x1403B94F0) areaSlow startsPatching before that code section was mapped.Wait for every executable section (wait_for_code).

Crashes and stops without one address

  • Azimuth stops the whole game when its CreatePlacementTexture2D refuses a texture description (for example 1024x1024 sRGB as remote cars load). FH2MP patches the wrapper's call (game+0x10C8974, wrapper game+0x10C88E0) to fall back to an ordinary CreateTexture2D (vtable slot 5).
  • XLS_E_DATA_SIZE: the storage blob limit of 0x80000 was too small. FH2MP raises it to 4 MiB with a patch at game+0xEE6619 (writer game+0xEE6550).
  • bad_function_call: an injected row in the race set-up screen had an empty std::function. Every row needs a function.
  • Forcing the "connected to Live" byte (CLobby+0xF0) to 1 crashed the game. Patch the individual gates instead.
  • Exception 0xE06D7363 (a C++ exception), "string too long": a prompt entity with TitleStringID set to empty.
  • Track archives patched in too late: the zip-scan patch at game+0xFD1666 must land before loading starts, or the game crashes about 3 s into loading.
  • Cinematics: calling CutsceneComponent::Play before IsCinematicReady, or loading an unreadable file.
  • Input: popping the input context stack with owner 0 pops the base entry and can crash. Always push and pop with your own owner hash.
  • Engine sound: polling an engine group's channel group from outside its update; the upgrade screen frees it.
  • Particles: a ParticleInstances.particlebin with the wrong record size (FH2's 2.1 records are 100 bytes). The parser hashes a wild pointer.
  • XAML: a page that uses a resource missing from UI.zip crashes when it opens.
  • clang SEH: a __try that only wraps a plain load doesn't protect it. clang covers only calls inside __try, and treats memcpy as an intrinsic that can't fault, so at -O3 the __except was optimised away and a read of a freed object crashed. Copy through a volatile function pointer to memcpy, or use ReadProcessMemory.

13.4 Mod conflicts and their fixes

How the platform keeps mods apart

  • Hooks chain. Two platform mods hooking the same function both run, as long as each calls the original pointer it was given.
  • Hooks are checked against the exe on disk, not memory, so a site another platform mod hooked is still accepted. A site Extra Options (or a self-patching mod) changed is refused rather than layered: "game code doesn't match".
  • Instruction hooks at the same address chain, so the Achievements notification sites are shared, not refused.
  • Each file has one owner. The platform's own pages (A_Hud, A_Splash, A_PauseMenu, A_PauseOptions, A_ModOptions, A_ModPage_NN, stateflow\pause.xml, stateflow\ui_screens.xml) are refused to set_file from 2.9.0. Before that, the first mod to set one took the MODS tab away from everyone.
  • The database is built from every mod's statements in load order, each in its own transaction, on top of another mod's shipped database where there is one (2.7.2+).

Extra Options plugins have none of this: no chain and no checks. A platform mod that hooks a function a plugin hooked first is refused, and a plugin hooking after a platform mod sees the platform's jump and must check bytes and back off itself.

Shared sites that caused trouble

SiteWhoWhat went wrongFix
CollisionWorld::GetPolys game+0x12CC730 (0x1412CC730)WreckingBall, a track-import mod; rain splashes also query itWreckingBall 1.3.0 compared the prologue in memory, saw the other mod's jump and turned solid pylons off.Check the exe on disk; accept another mod's jump (below). Chain, never replace.
TrackPresentation11 destructor game+0x1377B50 (0x141377B50)Same pairSame in-memory check problem.Same.
CWorldCollObjMan::Update game+0x384C00 (0x140384C00)WreckingBall, NitroSystem (FH2-Nitro)NitroSystem's inline hook made WreckingBall 1.3.0 switch off poles and pylons.WreckingBall 1.3.3 falls back to the exe on disk.
game+0xF62280 (0x140F62280)CCBR, Director ModeDirector Mode's gate failed and the mod stayed off.Director Mode 0.1.5 reads the exe on disk first and accepts a hooked jump (site_hooked_jump).
Call game+0x783E7E (0x140783E7E) to UpdateGauges game+0xAD6070 (0x140AD6070)FH2MP and another modThe other mod's freed relay crashed FH2MP's calls.Check the target is mapped, cheaply.
HUD notification sites game+0x73E0B1 (0x14073E0B1), +0x73F046 (0x14073F046), module tick game+0x3FCD84 (0x1403FCD84)Achievements, the platform (2.9.0), another modPossible double handling.Instruction hooks chain; the platform shares them.
Show game+0x755330 (0x140755330), MakeDisplayString game+0x323310 (0x140323310)Called by Achievements, FH2MP and othersReleased mods compare their first 15-16 bytes in memory, with no disk fallback.Call them, never hook them. A call hook 0xFD bytes past Show's entry is fine.
Set-up rows call game+0xD8200D (0x140D8200D); photo mode game+0x963703 (0x140963703), game+0x964C00 (0x140964C00)Extra Options and FH2MPEO replaced the call sites first, so FH2MP's call hooks were refused.Hook the function itself, not the call, and check the call's bytes yourself.
Time of day update game+0x197B170 (0x14197B170)Extra Options (Weather Control) and clock modsEO's Weather Control froze the clock online; holding the clock with the SetTime/StopTimeOfDay locks blocks EO's hour lock and a race's start time.FH2MP's eo_timelock fix; prefer an instruction hook in Evaluate (game+0x197B9B7) and restore locks only if the game hasn't written them since.
A shared call site's rel32Radio Manager and othersA chained hook changes the call's rel32, so a strict byte check fails.Skip the call's 4-byte operand in the check.
UI pages by x:ClassExtra Options 0.4.4+ and any mod copying a stock pageEO rewrote a mod's A_MessageBox-classed page.x:Class = with a space.
gamedbRC.sltAchievements, FH2MP, other database modsAchievements' totals changed with other mods installed.Fixed totals in code; read the database through the platform's override_root().
A page two mods want to changeFH2MP and a chat modBoth edited the name-tag page.One owner per page; the owner merges what others add.
dxgi.dll / PresentEncore Launcher's in-game Guide, FPS overlays"DXGI's own was not found": a second dxgi.dll loaded first, or an overlay hooked Present in place.Find the real system DXGI and chain rather than assume the prologue.

Code that released mods check in memory

Keep new hooks and patches clear of these; the platform itself keeps at least 0xEE bytes away. A mod that changes them makes the checking mod turn a feature off.

ModChecks in memory
Achievements 1.0.xShow game+0x755330 and MakeDisplayString game+0x323310, 15 bytes each, at the first pop-up
FH2MP 1.2.0MakeDisplayString (16 bytes) and about 85 other places
WreckingBall 1.0.0-1.3.0its hooked code (game+0x12CC730 (0x1412CC730), +0x1377B50, +0x384C00 among others) and six vtable slots; 1.3.3 falls back to the exe on disk
CCBR 1.0.0game+0x289320 (0x140289320), +0x28C590, +0x28D930, the range +0xF5B420 to +0xF73080, +0x190BF90, +0x190BFD0, six lea rdx sites +0x6A2AF7 to +0x6B992A
FH2 Universal Radio 1.0.0-1.7.1operator new prologue game+0x3229C0 (0x1403229C0), PE headers, FMOD exports; its call sites game+0x1018A13 and +0x10221F2 only without the platform
Another released modthe ChampionshipDrivatarsState vtable slot 0x142D44F30

A byte check that tolerates other mods' hooks

Several mods (WreckingBall 1.3.3, Director Mode, a track-import mod) converged on the same rule. Compare each range in memory. Where memory differs, still pass if:

  1. the exe on disk (game folder first, then Azimuth's; SizeOfImage must be 0x3A18000) has the expected bytes, and
  2. every differing byte lies under another mod's jump: E9 jmp rel32 or E8 call rel32, jmp [rip+x] (6 or 14 bytes), or MinHook's hot-patch short jump onto a jmp rel32, into executable memory outside the game image;
  3. the jump starts on an instruction boundary, its operand differs from the build's bytes, and only int3/nop padding follows it up to the end of the overwritten instruction.

Use a window of 32 bytes before the site (a platform instruction hook replaces at most 19) and 16 after. Byte patches by others (Extra Options') still fail, and data constants are checked in memory only. Group checks by feature, so a mismatch turns off one feature, not the mod. See chapter 5.

13.5 Performance

Measure before guessing

No game log records a frame time, so add one before you blame anything.

  • A frame-stall log. Stamp each drawn frame from the frame step (game+0xFA78A0, on the render side: see 16.2): one QueryPerformanceCounter and two interlocked writes. A watcher thread keeps a running average; when a frame runs longer than three usual frames and at least 50 ms, it suspends that thread, reads RIP and the code addresses on the stack with only GetThreadContext and ReadProcessMemory (the stopped thread may hold heap, loader or log locks), resumes it, and only then resolves names and writes a line such as frame stall N ms (usual frame M ms); at +X ms the frame thread was in A <- B ....
  • A whole-process sampler. Once a second, suspend every thread and record RIP plus stack code addresses; name modules with toolhelp. This found the free-roam lag below. It is not free: suspending about 150 threads per sample lengthened the frames it measured (median 79 ms against 64 ms), so keep it off in normal play.
  • GPU time from D3D12. Azimuth runs the game's D3D11.X calls on D3D12. Queue timestamps give GPU time; counting triangles and draws per render-target group explains it. The game presents once a frame at game+0x10F484D, and the render thread waits on Azimuth's GPU fence through call [ctx+0x748] at game+0xF999D0.

Method lessons that cost real time when ignored:

  • Compare old and new code in alternating 15-second turns in one session, not across two sessions.
  • Count calls as well as time.
  • A sampler only sees the thread it samples.
  • Quit launchers fully (from the tray) between A/B runs. An environment kill switch set in a shell window lived on in a launcher process, and three runs tested the wrong thing.
  • Keep the PC quiet. Builds and scans in the background were measured causing halts in 41-63% of seconds, against 16% at idle.
  • Don't blame the last thing you added: a 5 ms cost blamed on a big crowd stand was the camera view, and the stand cost 1-1.5 ms. Compare at the same view.

The VirtualQuery lesson

FH2MP's free roam slowed badly as the fifth to tenth player joined (one PC from about 93 to 25 fps). The sampler found the main thread in NtQueryVirtualMemory in 26 of 28 samples during the lag. The cause: a "safe read" helper did two VirtualQuery calls and a ReadProcessMemory per read, and lighting hooks called it per car per frame.

VirtualQuery's cost grows with the size of the committed block that holds the address, and the game's heap is one huge block:

Block sizeOne VirtualQuery
16 MB36 µs
256 MB680 µs
1 GB11.3 ms
3 GB13.7 ms
ReadProcessMemory (any)0.46 µs

The fix was to read with ReadProcessMemory alone, which fails cleanly on unmapped memory. Samples in VirtualQuery fell to 1 in 274, and free roam was smooth. The old path stays only under Wine (detected by ntdll exporting wine_get_version).

VirtualQuery then a copy is also not safe: the memory can be freed between the two. Guard the copy itself with SEH (through a volatile function pointer, as in 13.3), or use ReadProcessMemory.

Per-frame costs found so far

CostBeforeAfter
A speedometer guard that did a VirtualQuery of game+0xAD6070 every frame527 µs a call, worst 15-41 ms0 (check rarely, cache the answer)
Light sync reading every car twice a frame through the safe-read path1.0 µs a call, 21 calls a frame0
FH2MP's own code per frame, total574 µs31 µs
Raising PropertyChanged on a page every frame0.12-0.23 ms a framespread big changes; animate in XAML
54-69 property notifications in one frame2-3 ms
Car packs with Extra Options, file lookups (platform before 2.9.2)50-200 ms stutters, about 1 long second in 10a per-pack file list: 1 in 250
A custom world's file-existence misses against overlay foldersstutter in 4-14% of secondsper-folder file lists: 0.4%

Other findings:

  • The gamma routine is a symptom. game+0x10EF300 (1,025 pow calls, then into Azimuth) showed up in about half of mid-race stall samples, but one call costs about 28 µs. It is where the frame was waiting, not the cause. The cause of the remaining long frames is still unknown; candidates (a web request waited on by a game thread, video memory spilling to shared memory, another car loading mid-race) are unproven.
  • The game is GPU-bound on a typical modern PC: CPU time is only about 0.1-0.2 ms over GPU time. On an RTX 3070 at 1440p with 4x MSAA, GPU time fitted roughly 5-7 ms plus about 6 ms per million main-view triangles plus about 1 ms per million shadow-cascade triangles. Draw calls cost almost nothing, so more, smaller tiles with LOD bands beat fewer big meshes.

13.6 Techniques that worked, and ones that failed

Condensed from many in-game tests. "Proven in game" means it was seen working in a logged run or on screen.

Hooking and memory

Worked:

  • The tolerant byte check in 13.4, checked against the exe on disk (proven in game with three shared hook sites).
  • Optional parts fail alone: group byte checks by feature and turn off only the feature whose bytes or vtable slots don't match.
  • All-or-none enabling for linked hooks: enable in order and disable the ones already done on the first failure.
  • A function hook first, a call-site hook as fallback, never both. A made-but-disabled function hook would be switched on by a later "enable all", doubling the effect.
  • "Answer 549 for one compare": an instruction hook on a cmp eax,225h that substitutes Storm Island's id only for your case. No memory writes, nothing to undo.
  • Scoping by thread_local: detour an update, set a flag around the original call, and let hooks inside read it.
  • One write per thread boundary: UI callbacks only store an atomic value; a game-thread hook reads it once.
  • A log line with the raw value of every newly read game field in the same build, so a wrong offset shows on the first run.
  • A byte-check manifest: one list of every checked site. Under Proton or Wine the exe's relocations are all in data, none in code, so compare pointer rows with the load delta removed.
  • Never give up waiting for the game's code. Other mods held one start for 65 s; a 60 s timeout left the hooks out and the world crashed.

Failed:

  • In-memory prologue checks once another mod hooks the same function: the second mod disables itself.
  • hook_instruction on the instruction that loads the value you want: the hook runs before the instruction, so the register is overwritten. Hook the next instruction.
  • Plain loads inside __try with clang (13.3).
  • A per-frame "is it still mapped?" check with VirtualQuery (13.5).

UI, XAML and input

Worked:

  • Mod UI inside the game's own pages: a copy of a stock page with insertions, new bindings answered through FindProperty (the platform's site game+0x157FF60), and PropertyChanged raised from the module tick (game+0x3FCD84) inside the UI lock. Elements look native and go away with the page.
  • A pre-flight XAML check every launch: resource keys, balanced tags, image paths, anchors found exactly once, binding names known; any failure leaves the insertion out.
  • A crash marker for written pages: write a marker file when a risky page is written, delete it once the page has been on screen for 10 s; next launch, a stale marker leaves the page out.
  • Text as lowercase-hex references (&#x..;) and x:Class = with a space.
  • Toasts with no hooks through the HUD status route.
  • Blocking driving without blocking pause: push mask C0 with your own owner hash on the input context stack.

Failed:

  • Decimal character references in XAML: spaces.
  • Bindings inside a Transform3DGroup: never applied. Use nested single transforms. ZOffset is wrong; use OffsetZ.
  • A Viewbox around list-row shapes: drew nothing.
  • A countdown built from three DataTriggers each starting a storyboard: only the first number popped.
  • A fixed 520 px element in the middle of an Auto | * | Auto grid: ran under the prompts at every 16:9 resolution tested.
  • Notifications while the HUD is held: big banners waited minutes, prompts were lost. Hold the HUD only briefly.
  • Device detection that read only XInput: DirectInput pads never counted.

Files, data and worlds

Worked:

  • Data before code: add_sql rows (INSERT ... WHERE NOT EXISTS, then UPDATE), set_file, borrowing existing strings in database rows.
  • Route-specific cinematics: a copy under Cinematics\Global\RouteSpecific\<route>\ is found before Global\, the cleanest way to change one route's cutscene.
  • Raising the game's file cache (the 210 MiB I/O cache at [0x1436614A8]) with one write fixed "Failed to load FileChunk" on big tracks.
  • A custom world as new Tracks/Environments rows reached by travel, keeping saves on the mainland id.
  • Reading GPU cost per tile and cutting big meshes into tiles with LOD bands.

Failed:

  • Editing or growing zipmanifest.xml: crash in the reader, or the game stopped reading it part-way.
  • Model texture lists past 255 positions: every lit surface red (the re-bind position is one byte).
  • Collision vertex w = 1.0: every contact normal straight up; the car bounced on downhills. Collision without the camera bit 0x04: cameras pass through.
  • Meshes with bone influences but no Skin: drawn as huge slanted planes.
  • Writing a track id with no database row into a save: the resolver (game+0xFDAA20) returns 0x7FFFFFFF with no fallback.
  • Per-track TrackSettings.xml, CollObjs.xml: the game never reads them.
  • Switching tracks after start-up: archives are opened at boot, so two builds mixed. Restart instead.
  • A count-0 .oww, two-way lanes on a race loop, road_type other than none: no AI world, cars against the race direction, and roads that become discoverable.
  • File overrides of entity or stateflow files apply to every world; they can't be scoped to one track.
  • Calling SetOdds with all-zero odds would make the totals NaN and force storms (by the code; refuse first).
  • A rewards scene on a world without its cinematic zone: waits for ever.

Camera, audio and cars

Worked:

  • Owning the rendered camera with a post-hook on CMultiCam::PostUpdate (game+0xFE61C0), rewriting the 0xA8-byte cache. Proven in game; the audio listener follows.
  • Depth of field with no hook through the render thread's override block at rt+0x590.
  • An own FMOD DSP at the input of an event's channel group, fed from the group-update detour with SEH reads.
  • Car packs (platform 2.9.0+), and cloning a stock car with same-length renamed paths and INSERT ... SELECT rows under a new Id.

Failed:

  • Writing CCamFree+0x1A0: overwritten every update. Free cameras don't move while paused.
  • Linear cinematic keys: visible wobble; use user tangents.
  • Cinematic files created after the mount: never seen. Serve them from fh2mod_init.
  • Engine sound under SetGameSpeed: not slowed with the picture.
  • Two sound names pointing at copies of one bank: FMOD sees duplicate events and the second car is silent.
  • A turbo row copied from another engine: the record is null. An engine with no aspiration row: never loads.
  • Reusing a base car's lights, collision hull or AO on a different body: lamps and shadows in the wrong place.

Diagnoses that turned out wrong

Worth knowing so you don't repeat them: "large blocks" were skinned meshes without their skin, small shadow maps came from Azimuth's Graphics Default preset, many halts came from background work on the same PC, a once-per-path log line fired on the first existence check rather than the open, and a 20,000-entry log filled up during the mainland load so every later failure went unlogged.

13.7 Lessons from the public mods

Each item is a cause and its fix, so the same mistake needn't be made twice.

WreckingBall

github.com/Trinculo54/WreckingBall

  • Another mod hooked the same function first. NitroSystem's inline hook on CWorldCollObjMan::Update (game+0x384C00), and another mod's hook on GetPolys, made 1.3.0's in-memory check fail, so poles and solid pylons switched off. Fix: check the exe on disk, and as a last resort accept a jump out of the image followed by the expected bytes or int3 padding. The platform chains the hooks, so both mods work.
  • One refused hook turned the whole mod off, because every hook was and-ed into one flag. Fix: only the core hooks are required; every feature hook switches off only its own feature and greys its rows.
  • With poles off, pylons and the track presentation weren't found either. Fix: find them regardless.
  • Crash at game+0x369029: notes outlived a procedural data object that the game reused. Fix: forget all notes for an address in the Serialize hook.
  • A pole hit read a car that had gone, and slowed AI cars. Fix: guarded reads, and act only on contacts of kind 0.
  • Storm Island numbers definitions and models differently; portable toilets turned up as trees. Fix: map numbers by name hash per world.
  • Map swaps crashed and island poles didn't fall. Fix: per-world tables, and the island's pole models.
  • The track presentation wasn't found reliably by vtable. Fix: recognise it by its vectors at CPresentation+0x38.
  • A fallen pole's base sat in the wrong place. The game subtracts the centre of mass at SpawnCell (game+0x3690A2) and draws around the body piece's centre each frame. Fix: move the base in the render node every frame; changing the bind matrix once doesn't stick.
  • Render-node indices drift: the index is a count of two vectors plus the slot, so it moves when they change size.
  • Models only load near where the game uses them (the apple tree only near orchards). Fix: a loaded-model fallback, and swap to a tree whose models are resident.
  • Logs from AI tree hits appeared at the player (fix in progress): spawn from the car-in-view position the world update stores, using the right car's dynamics.
  • CI failed on __try beside RAII objects. clang refuses __try in a function holding objects with destructors. Fix: move locks into helper functions.
  • Old platforms said nothing useful. Fix: register the mod first, then check the API version, so the title screen says to reinstall.
  • Azimuth 1.0.3 doesn't load d3dcompiler_47.dll. Fix: the zip ships the platform as DWrite.dll too.

Achievements

github.com/Trinculo54/fh2-achievements

  • winsqlite3.dll is missing under Wine. Fix: SQLite compiled in.
  • Totals changed with other mods installed, because other mods rewrite gamedbRC.slt. Fix: fixed totals in code.
  • The wrong profile was read with several profiles. Fix: follow the profile the game is saving to (the newest revision written).
  • Pop-ups sometimes never showed. Fix: all three notification hooks (constructor, destructor, module tick) are needed, and pop-ups are shown from the game thread, never a worker.
  • Old platforms. Fix: register first. offline_only is set for FH2MP.
  • Platform 2.9.0 moved the database to the Azimuth layer on Azimuth 1.0+ without Extra Options. Fix (in progress): read through override_root(), not a hard-coded mediaoverride.
  • Unlocks are never revoked, so never rename achievement ids: a stricter rule relocks nothing.

FH2 Universal Radio

github.com/Trinculo54/FH2-Universal-Radio

  • The track reloaded every frame. Zeroing RadioStreamFmod+0x28 (the start seek) caused it. Fix: never write it.
  • The source ran ahead or stalled while the game wasn't reading. Fix: keep the source in real time by draining the ring while the game isn't reading.
  • Hand-patched call sites clashed with other mods. Fix: with platform 2.2+, use hook_call, which the platform chains; the hand patch stays only as a fallback.
  • A race in the safe read: a VirtualQuery check followed by a copy can race a free. Fix (in progress): guard the copy itself with SEH.
  • Allocate game memory only on a game thread. The control thread only writes in place, after checking the object is still live.

Director Mode

github.com/Trinculo54/DirectorMode

  • CCBR hooks game+0xF62280, so Director Mode's gate failed and the mod stayed off. Fix: read the exe on disk first, then accept another mod's hooked jump (the WreckingBall rule).
  • Proton and Wine load the image away from 0x140000000. Fix: compare pointer rows with the load delta taken off; code rows need no change.
  • In a cabin, the driver's head and the roof lining were cut away. The near clip plane came from the chase camera. Fix: 5 cm within 1.6 m of the car, 10 cm within 4 m.
  • The car showed a lower-detail model in close shots. The driving render settings keep the player's car off its top LOD. Fix: switch to photo mode's render settings while open, as photo mode does.
  • The chord's RB changed the car camera. Fix: keep a ring of the camera index over the last second and put the old index back with SetActiveCamera.
  • The game speed couldn't always be given back. Fix: after three failed calls, do the plain store to gm+0x48 that the call itself makes.
  • Plain loads in __try were lifted out by clang. Fix: every read is a copy through a volatile function pointer.

Do A Barrel Roll

github.com/Trinculo54/DoABarrelRoll

  • Rolling right switched the camera, because RB is the game's camera button. Fix: rolls use LB plus the stick; RB is never read.
  • A barrel roll threw the hood or bumper view out to the chase camera. The camera's rolled-over check (slot 80, game+0x3986A0) did it. Fix: skip the check while flight is on, unless it has already taken the view.
  • Menus toggled flight. Fix: the hotkey acts only while the free-roam HUD is showing (ui_status, API 10).
  • LB plus d-pad up was swallowed in menus. Fix: a driving-view-only pad layer (FH2_PAD_LAYER_WORLD, pad interface 2) where the platform offers it.

CCBR

github.com/Trinculo54/CCBR

  • Traffic cars blinked out for a frame. The AI pool's recycling puts the AI's own request last, with alpha 0 until its next fade update, and the request hides the car. Fix: hold HideCar (game+0xF649F0) for up to 0.15 s for visible cars.
  • The ghost needs a preset that collides with nothing. Fix: add a "ccbr" preset to collidablepresets.xml with set_file, and fall back to the game's "intersection" preset if the override isn't read.
  • Old platforms. Fix: register first, so the title screen says to reinstall; pin the platform to a current release.

Radio Manager

github.com/Trinculo54/RadioManager

  • Station icons came out with red and blue swapped. WIC hands back BGRA. Fix: reorder to RGBA before BC7 encoding.
  • Events moved the player off the mod's station, and the save kept that. The function at game+0x66DFD0 picks only from station slots 1-8. Fix: clear settings+0xC0 for that call while on a mod station, unless +0xC1 asks for a random station anyway.
  • Another mod's hook on a shared call site broke the byte check. Fix: skip the call's rel32 in the check, since a chained hook changes it.

Across every mod

  • Hook only after wait_for_code. Hooking Extra Options' bytes before it has checked them makes it refuse everything.
  • Byte-check every site; on a mismatch, log a plain sentence and switch that feature off. A wrong guess should be a missing feature, never a crash.
  • Pass through the original pointers so other mods' chained hooks still run.
  • Don't hook the platform's own sites: game+0x157FF60, +0xD9FC10, +0xDC8A60, +0xDC6C40, +0xDC6E30, +0xD9F9F0, +0xB3A3E0, +0xB0B990, the Marketplace handlers +0xDBD720, +0xDBDD00, +0xDBDD60, +0xDBFE40, and the Achievements tile calls +0xDBD635, +0xDBF185. The full list is in chapter 2.
  • Game memory is freed and reused as areas stream. Drop per-pointer notes when the object goes (destructor or Serialize hooks).
  • Allocate game memory only on a game thread. UI callbacks run on the UI thread; keep them short and never call into the game from them.
  • fh2mod_init always returns 0, and it registers first.
  • Nothing runs at exit. Azimuth ends the game with TerminateProcess, so save state as you go.
  • Ship the newest platform in every release zip, and never ship the platform's built gamedbRC.slt.

“The FH2 Modding Guide” by Trinculo54 is licensed under CC BY 4.0; its code samples are under the MIT licence. This page is an unchanged copy (links point to this site) of 13-troubleshooting.md at commit bb10508; corrections belong in the original repository.