Navigation
Browse the developer docs

FH2 Modding Guide · Chapter 9

Hook reference: audio, weather and liveries

The radio, sounds, weather and time of day, liveries and game events.

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 lists the game code behind what you hear and what the sky does: the radio and its stations, the DJ, UI and engine sounds, ambience and reverb, the weather, the clock and the cloud sets. It also covers the livery editor's layers in memory, and the telemetry events and stats that Achievements reads. Read it when you want to play your own audio, add a station, change the weather or the hour, edit vinyl layers, or react to what the player does.

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 the image base; the full address is 0x140000000 + RVA. Every table gives both forms the first time; 9.10 lists them all.

How to read the entries:

  • Status is one of: proven in game (seen working in a logged run or on screen), offline only (static reverse engineering, file decoding or an offline harness that maps the real exe), design only (a plan, nothing run) or unconfirmed. Most addresses in this chapter are offline only unless a released mod uses them.
  • Byte check gives the bytes to compare before you hook or call. Read them from the exe on disk yourself as well; 05-hooking.md explains the disk fallback and how to accept another mod's jump.
  • Kind is the hook kind from 5.2: pointer, call site, function, instruction, byte patch, or a direct call (you call it, you don't hook it).

Contents


9.1 Play your own audio on a station

FH2's radio is FMOD. Each station track is played by a RadioStreamFmod object (vtable 0x142E76220, game+0x2E76220). When a track starts, RadioStreamFmod::load asks FMOD Studio for the track's sound info, then creates the sound; when it plays, RadioStreamFmod::start takes the sub-sound to play. Two released mods replace the audio at these two calls:

Both create an FMOD user stream (FMOD_OPENUSER) whose PCM read callback you fill, so the game's own radio mixing, volume, ducking and car-interior filtering still apply.

If you only want to know what is playing, don't hook anything: FH2 Universal Radio publishes the interface FH2UniversalRadio.NowPlaying, which you read with get_interface (02-platform.md).

RadioStreamFmod::load's createSound call — game+0x1018A13

  • Does: inside RadioStreamFmod::load (game+0x1018840, 0x141018840), calls FMOD::System::createSound for the track. The last argument is &this->sound, so the stream object is out - 0x08.
  • Lets you: create your own sound instead, for the station you own. FH2 Universal Radio creates an OPENUSER stream (48 kHz, signed 16-bit stereo) with its own read callback and passes every other station to the original.
  • Kind: call site (hook_call). Platform name: FH2_GAME_RADIOSTREAMFMOD_LOAD_CREATESOUND_CALL.
  • Arguments: as FMOD::System::createSound(system, name_or_data, mode, exinfo, Sound** out).
  • Byte check: the E8 opcode and that the rel32 reaches FMOD::System::createSound (game+0x1997740, check it by its export name). Skip the rel32 if another mod may have retargeted it.
  • Conflicts: none known.
  • Status: proven in game (shipped in FH2 Universal Radio).

RadioStreamFmod::start's getSubSound call — game+0x10221F2

  • Does: in RadioStreamFmod::start (also called tryStart), calls FMOD::Sound::getSubSound to pick the sub-sound to play from the track's sound.
  • Lets you: answer for your own streams. A user stream has no sub-sounds, so return the stream itself.
  • Kind: call site (hook_call). Platform name: FH2_GAME_RADIOSTREAMFMOD_START_GETSUBSOUND_CALL.
  • Arguments: (Sound* sound, int index, Sound** out).
  • Byte check: at game+0x10221E8: 57 18 48 8B 4F 08 4C 8D 47 10 E8 ?? ?? ?? ?? 8B, with the rel32 skipped.
  • Conflicts: shared by FH2 Universal Radio and Radio Manager. Both hook it with hook_call, and the platform chains them. Each mod must answer only for its own streams, which it recognises through FMOD::Sound::getUserData (game+0x199FBE0), and pass everything else to the original. A third mod here must do the same. See 5.10.
  • Status: proven in game (both mods, installed together).
// Chain on the shared getSubSound call: answer only for streams you made.
using GetSubSound = int (*)(void* sound, int index, void** out);
using GetUserData = int (*)(void* sound, void** data);
static GetSubSound o_get_sub_sound;
static GetUserData fmod_get_user_data;           // game + 0x199FBE0, checked by its export name
static char g_my_tag;                            // set as each stream's userdata when you create it

static int d_get_sub_sound(void* sound, int index, void** out) {
    void* data = nullptr;
    if (sound && fmod_get_user_data(sound, &data) == 0 && data == &g_my_tag) {
        *out = sound;                            // a user stream is its own sub-sound
        return 0;                                // FMOD_OK
    }
    return o_get_sub_sound(sound, index, out);   // another mod's stream, or the game's
}

// on your worker, after wait_for_code and the byte check:
api->hook_call(mod, "radio getSubSound", game + FH2_GAME_RADIOSTREAMFMOD_START_GETSUBSOUND_CALL,
               reinterpret_cast<void*>(&d_get_sub_sound), reinterpret_cast<void**>(&o_get_sub_sound));

Without the platform (an Extra Options plugin), FH2 Universal Radio rewrites the call's rel32 to point at a jmp [rip] stub allocated within 2 GB of the image, and puts the old target back if anything fails. That does not chain with a platform mod on the same call, so check for a foreign target first and back off (5.6).

FMOD exports the radio mods use

FMOD's low-level API is exported by name from the game exe, so check these by export name rather than by bytes:

ExportRVAAddress
FMOD::System::createSoundgame+0x19977400x141997740
FMOD::Sound::getSubSoundgame+0x199F5100x14199F510
FMOD::Sound::getUserDatagame+0x199FBE00x14199FBE0

FMOD_CREATESOUNDEXINFO is 0xD8 bytes: +0x38 pcmreadcallback, +0x40 pcmsetposcallback, +0x68 userdata. Mode bits used: LOOP_OFF 0x1, 2D 0x8, CREATESTREAM 0x80, OPENUSER 0x400, OPENMEMORY 0x800, NONBLOCKING 0x10000.

Track length and markers (data, no hook)

A station track's sample (RadioStreamFmod+0x30) points to its props at +0x08. The station ends a track at the props' length (+0x8C, ms), not when your stream runs dry, and uses the markers at +0x90 for the stinger and DJ (layout in 9.11). FH2 Universal Radio raises the length to 16 minutes and moves the markers to match (stinger 2 s before the end, DJ 1 s before). Don't go past 977,656 ms, the longest stock track (a DJ mix).

Rules for radio mods

  • Never write RadioStreamFmod+0x28 (start seek, int32 ms). Zeroing it makes the game reload the track every frame.
  • Allocate game memory only on a game thread, inside the load hook. The game's operator new is game+0x3229C0 (0x1403229C0), byte check 48 89 5C 24 08 57 48 83 EC 20. Your own threads may only write in place, after checking the props are still live (5.7).
  • The game stops reading when it pauses. In the pause menu, a rewind or a race intro, the read callback stops being called. A source that is pulled at its own pace (a web stream, say) keeps going unless you pause it yourself. FH2 Universal Radio drains its buffer in real time one second after the game stops reading; pausing the source properly is still in progress there.
  • The game cuts a stinger short at StartNextTrack, so a DJ clip may not play to its end.

9.2 Add a station

Radio Manager shows that a new station is mostly data plus three small hooks.

Data (no hooks):

  • Station list: append your stations to media\audio\RadioInfo_<lang>.xml for all ten languages (BR, DE, EN, ES, FR, IT, JP, MX, PL, RU) with set_file (02-platform.md). An Extra Options mod ships the same files in its media folder (03-extra-options.md).
  • Sound names: give each station's sounds a key you can recognise. Radio Manager uses RM plus six characters.
  • Icon: a swatchbin at ui/textures/Anthem/HUD/HUD_RadioIcon_<name>.swatchbin, added to UI/Controls/HUDRadioControl.xaml. Format: 196x96, BC7, premultiplied alpha, one mip, in the Xbox One tiled layout. A station without an icon can borrow the unused HUD_RadioIcon_Xbox_Music.png. Windows' WIC decoder returns BGRA: swap red and blue before you encode.
  • Banks: the radio bank loader (game+0x5AE880) counts stations up from 1 and stops at the first with no banks, so new stations without banks do no harm.

getSoundInfo call in RadioStreamFmod::load — game+0x10189A0

  • Does: asks FMOD Studio for the sound info of a key (studio->getSoundInfo(key, &info)), before the createSound call above.
  • Lets you: fill the info yourself for your keys, so the game creates your stream through its normal path.
  • Kind: call site (hook_call).
  • Arguments: uint32 (studio, const char* key, FMOD_STUDIO_SOUND_INFO* info). The info lives at rbp-0x80 in load: name or data +0x00, mode +0x08, exinfo +0x10 (0xD8 bytes, inline), sub-sound index +0xE8. Radio Manager sets mode OPENUSER | LOOP_OFF | 2D (the game adds CREATESTREAM and NONBLOCKING), and in the exinfo length +0x04, channels +0x0C, rate +0x10, format PCM16 +0x14, pcmread +0x38, setpos +0x40, userdata +0x68; sub-sound index 0.
  • Byte check: at game+0x1018998: 4C 8D 45 80 48 8B 4F 18 E8 ?? ?? ?? ?? 85 C0 0F, rel32 skipped.
  • Conflicts: none known. Pass every key that isn't yours to the original.
  • Status: proven in game (Radio Manager).

Station lock check — game+0xA65DF0

  • Does: answers "is this station still locked?" against the player's unlock list (progress+0x78).
  • Lets you: return false for your stations, so they are playable at once without writing anything to the save. Don't add them to the unlock list (game+0xA6A650 adds to it), or they end up in the save.
  • Kind: function (hook_function).
  • Arguments: bool (progress, std::string name), the name by value: the callee frees it, so read it before you call the original or return.
  • Byte check: 48 89 54 24 10 57 48 83 EC 30 48 C7 44 24 20 FE.
  • Status: proven in game (Radio Manager).

Event station pick — game+0x66DFD0

  • Does: before a race, road trip or bucket list challenge, RadioSetMusicTrack and RadioSetMusicFromGameOptions call it. It builds the "valid" stations from slots 1-8 only, and moves the player to a random valid one when settings+0xC0 (change_to_random_valid_station) is set. A ninth station is never valid, so the player is moved off it before every event.
  • Lets you: keep the player on your station. Radio Manager clears +0xC0 for the call when the current station (module+0x78) is one of its own and +0xC1 (random_station_even_on_valid) is 0, then restores it.
  • Kind: function (hook_function).
  • Arguments: void (module, u8* settings). Settings: eight track lists, then +0xC0 and +0xC1.
  • Byte check: 40 55 56 57 41 54 41 55 41 56 41 57 48 81 EC 80.
  • Status: proven in game (Radio Manager 0.2.1). Optional: without it the station only loses the player at events.

Other radio sites (reference)

SiteRVAWhat
Station table gettergame+0x1008CC00x70-byte station records at self+0x40; lookup game+0x1008BB0
Station list readergame+0x101DD60reads RadioInfo_<lang>.xml (path built at game+0x100FD94)
Radio bank loadergame+0x5AE880loads station banks, stops at the first station without
Load fallbackgame+0x66BA60what loads when a saved station is missing
Random unlockgame+0x66E115a random station unlock
Unlock actiongame+0x8FD160the stateflow action that unlocks a station

The save keeps the active station name at RadioState+0x38. If your mod is removed, the game falls back through game+0x66BA60; status of that path with a missing modded station: unconfirmed.

9.3 The DJ, idents and per-race music

DJ and ident audio come from DJSample (vtable 0x142E76570) and IdentSample (0x142E76590), next to MusicSample (0x142E74EF8) and their base RadioSample (0x142E74ED8). A station can serve its own DJ lines and idents the same way as its music (Radio Manager plays a station folder's DJ clips this way).

DJ event builders — game+0x5AC880 and game+0x5B1230

  • Does: build the DJ's event from two bytes: "on the island" (tests game+0x296150 / game+0x296390) and "on the mainland" (game+0x296340 / game+0x2963E0, called at game+0x5AC8CE and game+0x5B12C2). game+0x5B10C0 sends the island byte alone.
  • Lets you: know why the DJ is quiet on a custom world: under any track id other than 542 or 549 both bytes are 0, so mainland-keyed DJ lines may not play. Answering "mainland" at the two calls (call-site hooks) is the obvious fix.
  • Kind: call site, on the world tests.
  • Status: offline only. Nothing gates the station list itself by world. The weather and time lines (DJWeatherSunny, DJSunnyMorning, DJWeatherRain, DJRainyNight) are picked in game+0x514AC0; its branch at game+0x515050 never takes DJSunnyMorning on the island (offline only).

Per-race music (data): AnthemEventRaces has columns Radio1Track to Radio8Track, so a race can carry its own playlist (stock race 1004 has seven). Change them with add_sql (02-platform.md).

9.4 Other audio: UI sounds, engine sound, ambience and reverb

Play a UI sound — game+0xF71C50

  • Does: AudioManagerDeferred::play (vtable slot +0x08 of the object at *game+0x365A298, vtable 0x142E6AE88; the real AudioManager, vtable 0x142E6A948, is at its +0x18). UserInterface vtable +0x08 (game+0x1419FC0) forwards to the same player.
  • Lets you: play any UI sound by its FMOD event path, with no hook.
  • Kind: direct call. void play(this, std::string* name): it takes and empties the string. Build it as a zeroed MSVC std::string (16-byte small buffer, size at +0x10, capacity at +0x18 = 15) and fill it with the game's assign at game+0x22C300 (str, text, len).
  • Threads: the command ring at this+0x10 has no lock. Call it from the UI thread only, one sound a frame (for example from the AchievementsModule tick, 9.9).
  • Status: proven in game.

Stock names are const char* globals in .data; read the text before you play it:

GlobalEvent
0x142C5EFB0/Master/UI/PauseMenu/HZ2_SFX_UI_PauseMenu_Select_01
0x142C5EFF8/Master/UI/PopUpMenu/HZ2_SFX_HUD_PopUpMenu_Back_01
0x142C5EFD0, 0x142C5EFD8pause menu sub-menu open, close
0x142C5EFB8/Master/UI/PauseMenu/HZ2_SFX_UI_PauseMenu_Fail_01
0x142C5F008/Master/UI/Notification/HZ2_SFX_HUD_Notification_GenericOn_01
0x142C5F068/Master/UI/PopUpInfo/HZ2_SFX_HUD_PopUpInfo_Open_01
0x142C5F208, 0x142C5F210, 0x142C5F218countdown high, low, end
0x142C5F0C0/Master/UI/Promo/HZ2_SFX_HUD_Promo_TakePhoto_01

Select, back, open and close are proven. In free roam the others play too, but the pop-up info and fail sounds are quiet, and under menus the notification and countdown sounds are silent although the call returns. Triggers map to FMOD events in media\audio\ui\UI4Audio.xml; the bank HZ2_SFX_UI.bank is always loaded.

Engine sound

Each car has three engine sound groups, AudioObjectEngineGroup{Engine,Exhaust,Intake}Fmod (vtables 0x142E75328, 0x142E753D0, 0x142E75280), each playing an FMOD Studio event from the car's PG_<sound name>.bank.

Data first: a car's sound name is Data_Engine.MediaName of its stock engine (List_UpgradeEngine with IsStock = 1, Ordinal = Data_Car.Id; electric cars use Data_Motor through List_UpgradeMotor), stored without the PG_ prefix. Giving a car another stock car's sound is one UPDATE Data_Engine SET MediaName = ... through add_sql; proven in game. A name that isn't a stock bank gives silence, and so does a stock bank copied under a new name (the name is inside the bank). More in 04-game-data.md.

Engine group event path builder — game+0x10103D0

  • Does: game+0x10103A0 builds the FMOD event path for one engine group. The hook site is just after the prologue.
  • Lets you: replace the sound name for one group, so a car uses another bank's events without a database change.
  • Kind: instruction (hook_instruction).
  • Registers: r15 = the group, rbx = std::string* the car's sound name (PG_...), dl = traffic flag (1 for traffic; the player and Drivatars 0), rdi = a per-car key, r9b always 1. Swap rbx for your own string.
  • Byte check: 45 33 E4 41 8B FC 44 89.
  • Status: proven in game.

Engine group update — game+0x1016A50

  • Does: copies the group's fields into the event's FMOD parameters, every update.
  • Lets you: read live engine state for your own sound (or meters), and find the event to attach a DSP to.
  • Kind: function (hook_function).
  • Arguments: rcx = group + 0x1A8 (subtract 0x1A8 to get the group). One set of notes says +0x1C8, reached through a thunk; the code that worked in game uses 0x1A8.
  • Byte check: 48 89 5C 24 08 48 89 6C.
  • Status: proven in game. Fields in 9.11.

Two more engine-sound instruction sites

SiteInRegistersByte checkStatus
game+0x101B258 (0x14101B258)game+0x101B1C0, after lea rdx,[rsi+0x30]: builds Game:\Media\Audio\Cars\<name without PG_>.xml (camshaft rpm scale, boost clamp)rdx = the sound name49 83 C9 FF 45 33 C0 48proven in game
game+0x100BF06 (0x14100BF06)game+0x100BCE0: sets a group's upgrade levelsrsi = level record (+0x5C + 4*channel level, +0x68 supercharger, +0x6C turbo, +0x80 selector), rdi = group8B 46 6C 89 47 38 8B 46offline only

Banks and the bank manager

  • Engine bank loader game+0x292840 (direct call): runs SELECT MediaName FROM Data_Engine UNION SELECT MediaName FROM Data_Motor and loads each bank from the sound zip (format string at game+0x1E03C70).
  • Bank manager game+0x10121E0: one bank per lower-cased path, and files are found case-insensitively. Two names served by two files of one bank give duplicate FMOD events, and the second such car driven in a session had no engine sound (proven in game). A name in a different letter case loads the same bank once and still gives each car a distinct name to key on.
  • FMOD Studio's lookupID is at game+0x1A99830.

Your own DSP on an engine event

The game never calls EventInstance::getChannelGroup, so the linker dropped it. It can be rebuilt from FMOD Studio's surviving command machinery; proven in game on every engine group tried (84 of 84). Run it from the group update hook, on that thread:

  1. game+0x1AE90D0 (handle, &sys): the Studio system from the table at 0x143728520, indexed by (handle >> 5) & 7. If sys+0xFD is 0, stop (0x65).
  2. scope = 0; game+0x1AE9240 (&scope, sys): take the API lock.
  3. async = *(sys+0x78); the command buffer is async+0x200 if game+0x1AEAF90 (async) returns true, else game+0x1AE9A70 (*(async+0x1E8), &cmd, 0x20).
  4. Fill the command: *(u64*)(cmd+8) = 0; *(void**)cmd = 0x142346990; *(u32*)(cmd+8) = 0x20; *(u32*)(cmd+0x10) = handle; *(void**)(cmd+0x18) = 0.
  5. r = game+0x1AEA6E0 (async, cmd); if r == 0 the ChannelGroup* is at cmd+0x18. 0x66 means the event isn't playing yet: retry each update (it works about half a second after a car loads).
  6. game+0x1AE9290 (&scope): release the lock.

Byte checks (8 bytes each): 0x1AE90D0 85 C9 74 2D C1 E9 05 83, 0x1AE9240 48 89 5C 24 08 57 48 83, 0x1AE9290 40 53 48 83 EC 20 48 8B, 0x1AEAF90 40 57 48 83 EC 20 83 B9, 0x1AE9A70 48 89 5C 24 10 55 56 41, 0x1AEA6E0 48 8B 02 4C 8B C2 48 8B; the vtable slot at 0x142346990 holds 70 77 A9 41 01 00 00 00.

Each engine group's channel group is the event's own master bus with eight DSPs, index 0 at the output end: Pan, Pan, Fader, Send, Pan, Send, Send, Lowpass Simple. An engine-sound mod adds its own DSP (an FMOD_DSP_DESCRIPTION for plugin SDK 105, laid out like the exe's own at 0x142E711E0) with System::createDSP, then ChannelControl::addDSP at index getNumDSPs (the input end), DSP::setActive(true) and DSP::setWetDryMix(1, 0). Its output replaces the stock loops while the event's distance low-pass, reverb sends, fader and 3D panning still apply. Proven in game.

  • Tunnel signal: engine events carry an FMOD Send DSP to return 19 (/ANTHEM/19_REVERB_TUNNEL); its parameter 1 goes from 0 to 1 in a tunnel or under a bridge. Readable with getDSP, getInfo, getParameterFloat; in game unconfirmed.
  • Crash seen: polling a channel group that the upgrade screen had freed crashed the game. Only touch a group's channel group from its own update, and drop it when the path builder rebuilds the event.

FMOD low-level exports in the exe (check by export name): System::createDSP game+0x19970D0, System::getMasterChannelGroup game+0x1998C90, ChannelControl::getSystemObject game+0x19A3720, addDSP game+0x19A16E0, getNumDSPs game+0x19A3230, getDSP game+0x19A2860, getVolume game+0x19A3920, getPitch game+0x19A3490, getAudibility game+0x19A2740, getLowPassGain game+0x19A2E70, DSP::setActive game+0x19A9BE0, DSP::setWetDryMix game+0x19AA6C0, DSP::getNumParameters game+0x19A8C90, DSP::getParameterFloat game+0x19A9290, DSP::getInfo game+0x19A84C0, ChannelGroup::getName game+0x19A6DE0. removeDSP, setParameterFloat/Int/Data, release and setBypass are exported too.

The dormant engine synth

The exe carries a granular engine synth no stock car uses (FMOD_PGEngineSynth_GetDSPDescription at game+0x102D000; parameters channel type, rpm, throttle, info file, .eng text; raw float32 mono 48 kHz input). It does play in game as a DSP first in the chain, but its loop crossfades are rough; your own DSP sounds better.

Ambience and reverb

Ambient sound is driven by world data, so most changes are files (04-game-data.md):

  • per world: <World>_ambience.xml (templates), <World>_reverb.xml, <World>_soundbank_lookup.xml;
  • in the GeoChunks: type 0x08 trigger zones (reverb REV_TZ, rain rainzone, AMB_TZ_*), 0x09 AudioTile XML (emitters), 0x0A FMOD Studio banks (version 46; older Forza banks don't load);
  • global: AudioBanks.xml (always-loaded banks), AudioGlobals.xml, AudioPassbyInfo.xml, AudioCollisionInfo.xml, AudioSurfacesInfo.xml, Reverb_Types.xml, AmbientEmitterInfo.xml, AudioSnapshotInfo.xml.

Rain, thunder, wipers and wet-tyre sound come from global banks and need nothing from a world (only switch: the start-up option noweatheraudio). The audio thread already runs at 10-20 % in a busy world: keep added emitters in the hundreds.

SiteRVAWhatStatus
Ambience / reverb / soundbank-lookup loadersgame+0x196EF90 / 0x196EB40 / 0x196B700per-world XMLs; vtables 0x142F64318, 0x142F64398 (slot 1), 0x142F64100 (slot 7)ambience and lookup loads seen in game
Zone enter / exitgame+0x196C360 / 0x196C460AudioTriggerLoadedHandler (0x142E6B740); then 0x1965C10 / 0x1965DE0 route rev_type to reverb, amb_event to ambienceoffline only
Audio tile workergame+0x196CEA0parses AudioTile XML; template lookup 0x19672A0offline only
Crowd-point searchgame+0x1961670nearest four; a point with a route id plays only on that routeoffline only

COpenWorldAmbience update — game+0x1971290

  • Does: picks the ambience bed. The wanted template starts at 0 and is replaced only by an active ambience zone's index, so with no zone the bed is template 0_Default. The bed starts below the template's StartBelowSpeed (35) and stops above StopAboveSpeed (40).
  • Lets you: change the bed with files alone: serve a <world>_ambience.xml whose 0_Default names another bed already in the global Quads bank. Crowd and tree points (game+0x19720A0, game+0x1972820) also fall back to template 0, so they need audio tiles but no zone. The tree pass (birds, insects, rain on leaves) is skipped at or above StartBelowSpeed: you hear it only when slow or stopped.
  • Mute byte: audio state +0x8F, copied from a game-state byte +0x282 at game+0xF7AC89; what sets it is unknown.
  • Status: offline only (design only for the file swap).

AudioManager world load — game+0xF5D430

  • Does: AudioManager vtable 0x142E6A948 slot 12. At game+0xF5D4BA it re-reads <world>_reverb.xml only if the reverb object (global game+0x36EA9D0) exists.
  • The bug: the reverb object is created once at start-up (by game+0x1966080, gated at game+0xF690EA on the start-up options disablereverb and anthemaudiodata, not on a world) and deleted at the first world unload (game+0xF5C1CD). Every world loaded after that has no reverb; by the code, that includes the mainland after a trip to Storm Island. Logs agree: across 44 runs _reverb.xml was asked for exactly once per session.
  • Fix (design only): function hook here; if [game+0x36EA9D0] is null, call game+0x1966080 (no arguments; it stores the new object in the global itself, and its constructor only zeroes fields), then the original.
  • Byte checks: world load 48 8B C4 48 89 50 10 57 48 81 EC 80 00 00 00; creator 48 83 EC 38 48 C7 44 24 20 FE FF FF FF B9 D0 00 00 00.
  • Status: offline only. That the stock mainland loses its tunnel reverb after a Storm Island trip has not been checked by ear.

Rain coverage for the rain sounds

Chunk 0x08 zones named *rainzone* (handler game+0x128C220) feed only the FMOD parameters CarRainCoverage and WorldRainCoverage (filled at game+0x2A8630). A rain zone is sound only: nothing visual reads it. Offline only.

9.5 Change the weather

The weather manager (Weather::WeatherManager, 0x228 bytes, vtable 0x142F64920) is at ForzaSimulation+0x488. Each frame WeatherManager::Update (game+0x19848B0) picks the active preset list and calls UpdateSimulation. The sky value runs from 0 (clear) to 1 (storm); rain and road wetness follow it.

Try data first:

  • Races bring their own weather: AnthemEventRaces.CustomWeather (0 keeps the player's weather; 768 of 790 stock races set 1), WeatherPreset, WeatherEnvironmentWetness, WeatherPrecipitationLevel, UnpauseWeather. Preset ids are in the WeatherPreset table (0 Clear ... 13 StormTropicalFog).
  • Odds come from the zone file media\tracks\<world>\triggerzones\tz_weatherchance\tz_weatherchance.tz: tags clear, cloudy, threatening, storm on a box. The mainland's is 40/35/15/10; Storm Island's is empty, so it keeps the built-in 25/25/25/25 (rain about a third of the time; proven in game).
  • Presets are plain XML: media\weather\Presets.xml (mainland, 9) and Presets_Island.xml (14). Each names a cloudScape and a lighting, and AllowedTransition lists with a chance. Every preset needs a transition to each neighbouring severity, or the chooser reads before an empty list and crashes (game+0x19854B4). Check an edited file with a script. Whether set_file reaches the read of Presets_Island.xml is unconfirmed.

Extra Options' Weather Control plugin holds the weather through SetWeatherControl too, and offers a time and weather page in the pause menu. If you hold the weather from a mod, expect to compete with it.

WeatherManager::UpdateSimulation — game+0x1985950

  • Does: once a frame. With nothing held it runs the sky timer, preset update, rain and road; with a control held it applies the control every frame instead of rolling (sky = +0xF4 with blend 0, rain +0x5C = +0x104, road +0x18 = +0xFC).
  • Lets you: hold a preset, sky, rain or road wetness, or set the odds, from the start of the call, on the game's thread.
  • Kind: function (hook_function). Fallback: a call-site hook on its only call, at game+0x19848FA in Update. Use the fallback only if the function hook could not be made at all: a hook that was made but left disabled is switched on later by an "enable all".
  • Arguments: rcx = WM, xmm1 = dt (Update passes abs(dt)).
  • Byte check: 40 53 48 83 EC 50 80 B9 F0 00 00 00 00 (no RIP-relative bytes).
  • Conflicts: Extra Options' Weather Control. There can also be two weather managers updating by turns: only touch the WM the game passed this frame (check its vtable), and step back if you see two.
  • Status: proven in game (a held CloudyFog through two driven runs).

SetWeatherControl — game+0x1981860

  • Does: copies a 0x3C-byte control (layout in 9.11) to WM+0xE0. A preset sets its severity and the sky value from the table at +0x1C0; sky, rain and road snap at once (blend 0). This is what stateflow's SetWeatherControl and PauseWeather use.
  • Kind: direct call, (WM, const Control*).
  • Byte check: 40 53 48 81 EC A0 00 00 00 C5 F8 10 81 E0 00 00 00.
  • Notes: game callers leave padding and unused fields uninitialised, so compare fields, not bytes, when you test whether someone else changed the control. Re-apply about 5 s after free roam starts: its start releases a held weather once.
  • Status: proven in game.

Release the weather — game+0x1981C80

  • Does: PauseWeather with pause = false: calls SetWeatherControl with nothing held (clamp 1). The stateflow event global.unpause_weather also releases a hold. game+0x1981BC0 freezes the current weather.
  • Kind: direct call, (WM). Release when your world goes, or when the player turns your feature off.
  • Status: proven in game (release); freeze proven as one of a cinematic camera mod's levers.

SetOdds — game+0x1983B00

  • Does: SetOdds(WM, float odds[4], bool roll_now): stores running totals over the sum at +0x1AC, and on[i] = odds[i] > 0 at +0x1BC. With roll_now and no sky held, the next frame rolls. Its game callers are the tz_weatherchance enter and exit (game+0x19826DD, game+0x1982862).
  • Lets you: steer how often it rains without holding anything (for example 50/35/10/5, about 10 % rain).
  • Kind: direct call, from your UpdateSimulation detour. Call it only once WM+0x140 and its +0x58 are not null.
  • Gotchas: all-zero odds divide by zero, and every roll then falls to Storm. Zero storm odds never roll Storm. The weather's timers run in real seconds and never follow the clock: pausing time doesn't reduce rain.
  • Byte check: the whole function (game+0x1983B00, game+0x1983B50, game+0x1983B81) plus the roll's guard game+0x1981298, its table use game+0x19812E2 and the timer's call game+0x1984F6D.
  • Status: proven in game (dynamic odds in a driven run). One source still lists it as offline only; the later run supersedes it.

Sky timer and roll (reference)

  • Timer game+0x1984F30: with auto-change (+0x211) on and the sky on target, the delay (+0x14) counts down, then the roll game+0x1981290 picks the first severity with on[i] and rand <= total[i] (else Storm) and a new delay of 150-210 s. The sky moves 0.01 a second, so one severity step takes 33 s.
  • Rain game+0x1985160: a new target every 25-50 s; clamp game+0x1985DE0. Road game+0x1985080: wets at 0.02 x rain a second, dries at 0.0122 a second. Preset update game+0x19852A0: one preset per severity.

Rain follows the sky value and nothing else: clear and cloudy (0-0.58) never rain, threatening rains on 44 % of rolls and never above 0.2, above 0.71 there is always some rain, storm (0.9-1) is full rain. Modelled share of time raining (offline): 25/25/25/25 35 %, 40/35/15/10 17 %, 50/35/10/5 10 %, 60/30/10/0 4 %, 50/50/0/0 never.

Island weather on another world — game+0x2FB9A6

  • Does: in ForzaSimulation, every frame: reads the track id (getter game+0x9247B0), cmp eax,225h, and stores the result in WM+0x58 and WM+0x11C. These pick the island presets (Presets_Island.xml), the island weather fxb (wind curve) and the island rain particles.
  • Lets you: give a custom world Storm Island's weather. Hook the cmp and put 549 (0x225) in eax when it holds your world's id: the game itself picks the island data, nothing is written, nothing to undo.
  • Kind: instruction (hook_instruction).
  • Byte check: 43 bytes at game+0x2FB99A: 48 8B 0D CF F3 35 03 E8 0A 8E 62 00 3D 25 02 00 00 0F 94 C1 48 8B 97 88 04 00 00 88 4A 58 33 C0 84 C9 0F 95 C0 89 82 1C 01 00 00.
  • Status: proven in game. Other cmp 549 sites it doesn't cover: game+0x128F0A6 (particles), game+0x2FEA85, game+0x2AA3FB (ForzaCar); see 06-hooks-world.md for the world-id technique in full.

Wind override — game+0x1984ADE

  • Does: in the weather-state evaluation game+0x1984A10, cmpb $0, 4(%rbx): if the wind component's byte +4 is set, the dword at +8 is used instead of the Wind.Intensity curve.
  • Lets you: hold the wind (flags flap by the material's wind magnitude times this value).
  • Status: design only.

Holding the weather: a sketch

// Hold a preset from the start of UpdateSimulation. Run only while your feature (or world) is on.
using UpdateSim = void (*)(void* wm, float dt);    // dt arrives in xmm1, as the second float argument
static UpdateSim o_update_sim;
static char* g_game;
static volatile int g_hold_preset = -1;            // set from your settings; -1 = off

static void d_update_sim(void* wm, float dt) {
    if (g_hold_preset >= 0 && *reinterpret_cast<void**>(wm) == g_game + 0x2F64920) {
        unsigned char c[0x3C] = {};
        c[0x00] = 1; *reinterpret_cast<int*>(c + 0x04) = g_hold_preset;   // has_preset, preset
        c[0x32] = 1; *reinterpret_cast<float*>(c + 0x34) = 1.0f;          // as every game caller
        c[0x38] = 1;                                                      // keep rain in the band
        char* held = static_cast<char*>(wm) + 0xE0;                      // the control in the WM
        if (held[0] != 1 || std::memcmp(held + 0x04, c + 0x04, 4) != 0)   // compare fields, not bytes
            reinterpret_cast<void (*)(void*, const void*)>(g_game + 0x1981860)(wm, c);
    }
    o_update_sim(wm, dt);
}

Byte-check game+0x1981860 before the first call, release with game+0x1981C80 when the hold ends, and check the preset index against the active list (WM+0x158, 0xC8 bytes a preset) first.

9.6 Change the time of day and the clock rate

The time-of-day manager ("ToD", 0x410 bytes, constructor game+0x1975660) is at ForzaSimulation+0x480 (getter game+0x2E1F90). The clock is seconds into the day, 43200 (12:00) at every boot: the save holds no time of day or weather. The rate is 48 game seconds a real second, so a game hour is 75 s and a day 30 minutes.

Try data first: races set AnthemEventRaces.TimeOfDayStart / TimeOfDayEnd (hhmm, -1 = keep the hour; the race flow still stops the clock). Rivals uses GameTunableSettings Rivals\FixedTimeOfDay (54000 = 15:00).

TimeOfDay::Update — game+0x197B170

  • Does: once a frame (called at game+0x300933): clock += dt x rate unless paused, wraps at 86400; a jump over 1800 s sets the jump flag; a run-until stops at its target with pause = 1.
  • Lets you: change the rate or hold the clock.
  • Kind: function. But Extra Options' Weather Control plugin hooks this function with its own jump ("hooked TimeOfDay::Update at game+0x197b170"), so a platform hook here is refused when that plugin is installed. Prefer the Evaluate instruction hook below.
  • Byte check: the rate use vmulss xmm0,xmm1,[rcx+18h] lies in the 73 bytes at game+0x197B19F; the run-until arrival starts 80 79 28 00 74 23 C5 FA 10 41 1C at game+0x197B1E8 (41 bytes).
  • Status: offline only for mods here (Weather Control's own hook runs in game).

Time-of-day Evaluate, after the weather blend — game+0x197B9B7

  • Does: Evaluate (game+0x197B7B0, one call a frame at game+0x197B42F, runs while ToD+0x29 is set) builds the frame's lighting state from the set's curves, then blends in the weather's lighting (call game+0x19788E0 at game+0x197B9B2). The hooked instruction is vbroadcastss xmm1,[rsi+304h], before the first derived write.
  • Lets you: read and write the clock once a frame on the game's thread, and read the evaluated look (sun, fog, tone map) for logs or your own effects.
  • Kind: instruction (hook_instruction).
  • Registers: rdi = ToD manager, rsi = the evaluated frame state (9.11), r14 = the set in use, xmm6 = day fraction t (kept until game+0x197B9D4).
  • Byte check: C4 E2 79 18 8E 04 03 00 00 (9 bytes, no RIP-relative operand).
  • Status: proven in game (hour pinned, with log lines reading clock, rate, pause and locks every frame).

Pinning an hour (what worked): write the clock (through the inverse of the TimeScale remap, below), set pause +0x24 and both locks +0x25 and +0x27 so free roam's start_time and a race's SetTimeOfDay leave it alone, raise the jump flag +0x2A the next frame so the look snaps, and put everything back as you found it when your feature ends. Gate it on the current world. Extra Options' Weather Control backs off when it sees the game's locks set ("the game has locked this clock itself"); its own hour lock contests yours if both are on, and one crash was seen inside that plugin with no mod on the stack.

// hook_instruction callback at game+0x197B9B7: pin the clock to g_pin_seconds (raw clock, already inverse-remapped).
static void on_tod(FH2Context* ctx, void*) {
    if (g_pin_seconds < 0) return;
    char* tod = reinterpret_cast<char*>(ctx->rdi);
    *reinterpret_cast<float*>(tod + 0x10) = g_pin_seconds;   // clock
    tod[0x24] = 1; tod[0x25] = 1; tod[0x27] = 1;             // pause, SetTime lock, StopTimeOfDay lock
}

Which time-of-day set — game+0x197B7E5

  • Does: in Evaluate, when nothing is forced (ToD+0 = 0), picks set 1 (timeofday\xboxone\TimeOfDay_island.fxb) for track 549 and set 0 (TimeOfDay.fxb, the mainland) for anything else: cmp eax,225h; cmove ebx,ecx.
  • Lets you: give a custom world the island look: put 0x225 in eax at the cmp when it holds your id. Writing 1 into ToD+0 while your world is loaded (and restoring it) also works.
  • Kind: instruction.
  • Byte check: 25 bytes at game+0x197B7D4: 48 8B 0D 95 F5 CD 01 E8 D0 8F FA FE B9 01 00 00 00 3D 25 02 00 00 0F 44 D9.
  • Status: proven in game.

Clock calls (reference)

FunctionRVAWhatStatus
SetTimegame+0x197AEC0(tod, seconds in xmm1, mode r8d); nothing while +0x25; mode 1 goes through the inverse remap game+0x197ADD0proven in game
GetTimegame+0x197A880the clockproven in game
StopTimeOfDay::OnEntergame+0x93C9C0stateflow stop_time / start_time; nothing while +0x27offline only
RunUntilgame+0x197AFE0runs to a target time; no lock stops itoffline only
RunUntilWithRategame+0x197B030stateflow set_time_of_day with speed; writes the rate (road trips use up to 1500)offline only
Race settergame+0x92F310SetTimeOfDayFromGameOptions: the race's start time if >= 0, then SetTime mode 1offline only
Remapgame+0x197A9E0the TimeScale table lookupproven in game
Network clockgame+0x197AF00real-time clock for onlineoffline only
Set loadergame+0x197AAE0reads all six media\timeofday\xboxone\*.fxb once at boot (from game+0x2E599F)offline only
Command linegame+0x197AA70applies currtime=H:M:S, timespeed=, timestopped= (0 or 1) at boot; whether Azimuth passes arguments is unknowndesign only

A rate you write can be overwritten by RunUntilWithRate on road trips: watch it. Replays run the clock backwards.

The bent day: TimeScale

The look is evaluated at remap(clock), a 100-entry table built from the set's TimeScale curve (at ToD+0x3C, active while ToD+0x1CC). The day is bent so that daylight lasts most of the 30 minutes:

Raw clockEvaluated hoursReal time at rate 48
0h-1h0.00-3.8375 s
1h-4.75h3.83-4.50281 s
4.75h-19h4.50-19.251,069 s
19h-21.27h19.25-20.16170 s
21.27h-23h20.16-20.76130 s
23h-24h20.76-24.0075 s

So to show 17:00 you set the raw clock to about 16.83h. The sun is down from about 20.33h to 4.32h; the light never comes from lower than 20 degrees, so shadows are at most 2.7 times the caster's height.

9.7 Skies, cloud sets and the look

FH2's open-world sky is procedural and drawn around the camera: atmosphere, cloud layers, sun, moon, stars and fog. There is no photo sky. All of this is data; no hooks are needed.

Cloud sets live in media\Sky.zip under Sky/Clouds/<set>/:

FileFormatSize (bytes)Channels
AlphaDiffuse.swatchbinBC5, 4096x153611,190,355R opacity, G thin (1) / dense (0)
FadeDensity.swatchbinBC5, 2048x7682,801,747R fade, G density
TopBottomLight.swatchbinBC5, 2048x7682,801,747R top light, G bottom light
CloudShadowBC4, 1024x1024shadows on the ground
  • Cloud textures carry shape and opacity only. The time of day colours them, so only shapes carry over from a sky panorama, never its colours.
  • Mapping (seen in game): the top row is the zenith, the horizon is row 1280 of 1536, columns wrap round 360 degrees, and the game draws the texture mirrored left to right compared with a normal panorama. The layer turns slowly even with the clock paused (about one turn in 3.3 hours).
  • Which weather uses which set: CloudDefinitions.xml in Sky.zip and the presets. Mainland CloudyA uses Cloud5, CloudyB Cloud6; clear weather has no cloud layer. Cloud7 is used only by the island's fog presets (CloudyFog, ThreateningFog, StormTropicalFog), so replacing it doesn't touch the mainland.
  • Replacing a set: keep the stock file size, dimensions, mips and tiled layout, and replace a set's three textures together. Use set_file (Sky/Clouds/<set>/<file>.swatchbin); the game doesn't read its sky until a world loads, so writing the files on your worker after fh2mod_init is in time. Leave CloudShadow stock and the ground shadows won't match the new clouds. Proven in game.

Lighting and tone files:

  • timeofday\xboxone\TimeOfDay.fxb / TimeOfDay_island.fxb hold the time-of-day curves and the weather lighting overrides (Clear, ClearFog, Threatening, ThreateningFog, Storm3, StormTropical, StormTropicalExtreme). They are read once at boot, so set_file them inside fh2mod_init. An edited copy served this way changed the look in game.
  • dynamicpost\Presets.xml, collection defaultDryDayTonemap <Main><Filmic>, is the live tone curve (global, every world); proven in game. Edit only the dry-day curve and dusk, wet roads and the cockpit view jump back to stock.
  • PostProcess.Bloom.Cutoff 0 makes a whole-screen veil; FH2's default is 0.74.
  • The game reads media\Tracks\AnthemTrackSettings.xml for every world (game+0x1330AC0).
  • On Azimuth 1.0 and later without Extra Options, the platform writes these files to its own layer, not mediaoverride. Always use set_file; never hard-code mediaoverride.

Shader-side details (exposure in stops, the filmic curve, the colour grade) are in 10-file-formats.md.

9.8 Read or write livery layers

The livery editor keeps its design as a tree of CLiveryGroup and CLiveryLayer objects. A mod (or an external tool) can move, scale, recolour and reshape layers in memory while the editor is open, and the editor redraws at once.

CLiveryLayer and CLiveryGroup (vtables)

  • Vtables: CLiveryLayer 0x142EB02D8 (game+0x2EB02D8); CLiveryGroup 0x142EB0460 (+0) and 0x142EB05F8 (its second base at +8). Constructors at game+0x1218240 and game+0x12180B0 (which is which is not recorded). Found through RTTI.
  • Finding a design: scan committed read-write memory for the adjacent pair {0x142EB0460, 0x142EB05F8}. A side's template is a group whose children are all layers sharing one shape. Expect several copies (the editor's, probably the saved library template, and two unexplained 500-layer groups); check each candidate's children before you write.
  • Status: proven in game (an external livery tool wrote several thousand layers into the left side, in the right order and frame).

Layer setters — game+0x12327F0 and neighbours

  • Does: each setter writes one field and sets bit 0 of +0x58 (changed). Layer vtable slots 10-16 are the setter/getter pairs for position, scale, skew and rotation.
  • Lets you: change a layer the way the editor does. From inside the game you can call the setters on the UI thread; from outside, write the fields and OR 1 into +0x58. The editor redraws without the setters' virtual call.
SetterRVAAddressField
Positiongame+0x12327F00x1412327F0+0x18 float x, y
Scalegame+0x12324700x141232470+0x28 float x, y
Rotationgame+0x12324100x141232410+0x50 float degrees
Skewgame+0x12326700x141232670+0x70 float
Colourgame+0x12312400x141231240+0x74 u8 R, G, B, A
SetShapegame+0x1231A600x141231A60+0x78 u16 shape id (getter game+0x12254B0); drops the cached mesh at +0xA8
Group scalegame+0x12324300x141232430one value to both scale floats
  • Byte check: read each setter's prologue from the disk; this guide has no recorded bytes for them.
  • Gotchas:
    • Shapes written directly keep drawing as the old shape (the cached mesh at +0xA8) until the design is reloaded: leave, save and reopen, and they show correctly. SetShape drops the cache, so calling it in game should avoid that (unconfirmed).
    • Index 0 is the bottom layer (drawn first). Hide unused layers with scale 0 and alpha 0.
    • Resetting the side's group to position 0,0, scale 1,1, rotation 0 makes its layers' positions side positions.
    • An external tool finds the game by its image at 0x140000000 (check TimeDateStamp and SizeOfImage); under Azimuth it may need to run as administrator.
  • Status: the fields are proven in game (written directly from outside); calling the setters is offline only.

Units: a circle vinyl (A 01) at scale 1 has a radius of 63 units, about one pixel per unit in the vinyl group editor. To place an ellipse {x, y, rx, ry, degrees} from an image: position (x, -y), scale (rx/63, ry/63), rotation 360 - degrees. Proven in game.

Group transforms fold into their layers as pos' = g.pos + g.s x R(g.rot) x l.pos, scale' = l.scale x g.s, rot' = l.rot + g.rot (degrees). This matched in game when flattening a design into one side; that FH2's own saved groups follow it exactly is unconfirmed.

Shapes are rows of Livery_VinylsDecals in the game database (1,440 rows, ids 101-3840, for example 101 A 01 at GAME:\Media\Livery\Vinyls\A_01.modelbin). A shape id you write must exist there. Each shape is a small flat modelbin, about ±0.25 units across.

Saved designs are in the save folder (Livery_<carId>_<timestamp>\revisions\...\data\C_livery and header), zlib-compressed, with FH2 layers of 31 bytes. The format is in 04-game-data.md for reading only: never edit saves. Change a design in memory while the editor is open and let the game save it.

Paint and masks on the car: the carbin paint list gives each material a zone bit (1 body, 2 stripes/livery, 4 hood, 8 mirrors, 16 wing, 128 window tint, ...); Masks.xml per car names the livery masks Front, Back, Top, Left, Right, Wing (BC4 1024x1024, sampled with the livery UV set). See 10-file-formats.md.

9.9 React to game events: telemetry and stats

FH2 reports what the player does through Xbox telemetry events (EtxEventWrite) and stats (SetStat). Achievements (github.com/Trinculo54/fh2-achievements) rebuilds all 88 achievements from them, offline, without writing the save. Your mod can listen the same way.

EtxEventWrite import slot — game+0x1DD0060

  • Does: the game's import slot for the telemetry writer (0x141DD0060). Azimuth fills it, so it has no code bytes to check. Platform name FH2_GAME_IMPORT_ETXEVENTWRITE.
  • Lets you: see every telemetry event: race ends, skills, XP, smashed boards, roads driven, purchases.
  • Kind: pointer (hook_pointer). The platform chains pointer hooks, so several mods can listen. Always call the original.
  • Arguments: rcx = the event descriptor; the 5th argument is an array of EVENT_DATA_DESCRIPTOR {ptr, size} with one entry per field.
  • Descriptor: +0x00 id (the low 16 bits are the event id), +0x10 the name, +0x20 the field types, low byte of +0x28 the field count.
  • Fields: 0-2 are common (the user and the session); the event's own fields start at 3. The last field is the world: 542 the mainland, 549 Storm Island.
  • Conflicts: Achievements hooks it. Keep your detour short: it runs on whichever thread reports the event.
  • Status: proven in game.
  • Without the platform: swap the slot yourself with InterlockedExchangePointer, keep the value you replaced and always call it (it may be another mod's hook, not Azimuth's). Say in your README that you hook it.

Event ids Achievements uses (field use is in its rules.cpp; for example AnthemRaceEnd: field 8 car, 11 place, 12 event, 20 world):

IdEventIdEvent
4AnthemOnlineRaceEnd101RaceStartParts
6AnthemRaceEnd103RewardBoardSmashed
19CarPurchased104RivalsEnd
27ClubXPWon105RivalsEverywhereEnd
33DistanceDrivenDelta109RoadTripCreated
54IslandRewardBoardSmashed115SkillAchieved
55IslandRoadsDriven116SkillChainCompleted
57IslandSkillChainCompleted129WristbandGained
97RaceEncounterEnd131XPGained

Other events (barn finds, bucket list ends, car meets, championships, DroveToDestination, RoadsDriven, ShowcaseRaceEnd) are sent too, but their fields have not been decoded. Log the name and field types at +0x10 and +0x20 to find them.

Where some events and stats come from (useful when you need the game-side cause rather than the report): OnSmashed game+0x50F910, OnDiscountBoardCollected game+0x50D050, IslandRoadsDriven game+0x9C1010, RaceEncounterEnd game+0x9CD6F2, the race-end handler game+0x9CD9C0 (branch at game+0x9CDA59), race-end stats game+0x62D090, RivalsEverywhereEnd game+0x9D0470, club XP game+0x614C10, the destination screen game+0xE896B0, the rally parts check game+0xE5C959. All offline only.

SetStat — game+0x2F7977

  • Does: inside SetStat (game+0x2F7940), after its "stats enabled" check: the stat and its new value are in registers.
  • Lets you: react to stat changes at once (distance, counts, totals), rather than waiting for the save.
  • Kind: instruction (hook_instruction). Platform name FH2_GAME_SETSTAT_AT.
  • Registers: rsi = the stat name, rbp = the value: type at +0x10 (3 = int, 9 = float), value at +8.
  • Conflicts: Achievements hooks it; instruction hooks chain on the platform.
  • Status: proven in game.

Read the value with a guarded copy (5.8), and copy the name before you keep it: it belongs to the game.

AchievementsModule tick — game+0x3FCD84

  • Does: inside the AchievementsModule update (game+0x3FCD60, vtable +0x20), about 60 times a second on the game thread.
  • Lets you: do game-thread work queued from your worker: show a pop-up, play a UI sound (9.4), raise a UI property change.
  • Kind: instruction, shared by the platform's pop-ups, its HUD layer and Achievements. Use hook_instruction only, never a function hook. On the platform, prefer show_toast for pop-ups.
  • Status: proven in game.

Achievements' pop-ups also need the HUD notification constructor and destructor sites (game+0x73E0B1, game+0x73F046) and call MakeDisplayString (game+0x323310) and Show (game+0x755330); call those two, never hook them. All of that is in 08-hooks-ui-camera-input.md.

Rules from Achievements: event-only counts start at install (they can't be backfilled from the save), and the game database may be another mod's changed copy, so read the overridden Stripped\gamedbRC.slt before the stock one and don't hard-code totals that other mods can change.


9.10 Master address table

All for forza_durango_release_final.exe of 24 Nov 2015, image base 0x140000000. Kinds: P pointer, C call site, F function, I instruction, D direct call, R reference only.

RVAAddressKindWhatStatus
Radio
game+0x10188400x141018840RRadioStreamFmod::loadproven in game
game+0x10189A00x1410189A0Cload's getSoundInfo call (Radio Manager)proven in game
game+0x1018A130x141018A13Cload's createSound call (FH2 Universal Radio)proven in game
game+0x10221F20x1410221F2Cstart's getSubSound call, shared by both radio modsproven in game
game+0x19977400x141997740DFMOD::System::createSound (export)proven in game
game+0x199F5100x14199F510DFMOD::Sound::getSubSound (export)proven in game
game+0x199FBE00x14199FBE0DFMOD::Sound::getUserData (export)proven in game
game+0x3229C00x1403229C0Dgame operator new (game threads only)proven in game
game+0xA65DF00x140A65DF0Fstation lock checkproven in game
game+0xA6A6500x140A6A650Radd to the unlock list (don't)offline only
game+0x66DFD00x14066DFD0Fevent station pickproven in game
game+0x5AE8800x1405AE880Rradio bank loaderoffline only
game+0x1008CC0, 0x101DD60, 0x66BA600x141008CC0, ...Rstation table getter, list reader, load fallbackoffline only
game+0x5AC880, 0x5B12300x1405AC880, 0x1405B1230RDJ event builders (island/mainland bytes); weather lines 0x514AC0offline only
UI sound
game+0xF71C500x140F71C50DAudioManagerDeferred::play (UI thread); object at *0x14365A298, string assign 0x14022C300proven in game
Engine sound
game+0x10103D00x1410103D0Iengine group event path (rbx = sound name)proven in game
game+0x1016A500x141016A50Fengine group update (rcx = group + 0x1A8)proven in game
game+0x101B2580x14101B258Icar audio settings path (rdx)proven in game
game+0x100BF060x14100BF06Igroup upgrade levelsoffline only
game+0x2928400x140292840Rengine bank loaderproven in game
game+0x10121E00x1410121E0Rbank managerproven in game
game+0x1AE90D0 ... 0x1AEA6E00x141AE90D0 ...Drebuilt getChannelGroup (see 9.4)proven in game
game+0x102D0000x14102D000Rdormant engine synth DSP description getteroffline only
Ambience and reverb
game+0x19712900x141971290RCOpenWorldAmbience updateoffline only
game+0x196EF90, 0x196EB40, 0x196B7000x14196EF90, ...Rambience, reverb, soundbank-lookup XML loadersloads seen in game
game+0xF5D4300x140F5D430FAudioManager world load (reverb fix site)design only
game+0x19660800x141966080Dcreate the reverb objectdesign only
game+0x36EA9D00x1436EA9D0Rglobal: reverb objectoffline only
game+0x128C2200x14128C220Rrain zone loadedoffline only
Weather
game+0x19848B00x1419848B0RWeatherManager::Updateoffline only
game+0x19859500x141985950FWeatherManager::UpdateSimulationproven in game
game+0x19848FA0x1419848FACits only call (fallback)fallback only
game+0x19818600x141981860DSetWeatherControlproven in game
game+0x1981C800x141981C80Drelease (PauseWeather false)proven in game
game+0x1981BC00x141981BC0Dfreeze currentproven in game
game+0x1983B000x141983B00DSetOddsproven in game
game+0x1984F30, 0x19812900x141984F30, 0x141981290Rsky timer, sky rolloffline only
game+0x2FB9A60x1402FB9A6Iisland weather compareproven in game
game+0x1984ADE0x141984ADEIwind override testdesign only
Time of day
game+0x197B1700x14197B170FTimeOfDay::Update (Extra Options hooks it)offline only
game+0x197B7B00x14197B7B0REvaluateproven in game
game+0x197B9B70x14197B9B7Iafter the weather blend: clock and lookproven in game
game+0x197B7E50x14197B7E5Iwhich set (cmp 549)proven in game
game+0x197AEC0, 0x197A8800x14197AEC0, 0x14197A880DSetTime, GetTimeproven in game
game+0x93C9C0, 0x197AFE0, 0x197B030, 0x92F310, 0x197AAE00x14093C9C0, ...RStopTimeOfDay, RunUntil, RunUntilWithRate, race setter, set loader (see 9.6)offline only
Liveries
game+0x2EB02D80x142EB02D8RCLiveryLayer vtableproven in game
game+0x2EB04600x142EB0460RCLiveryGroup vtable (second base 0x142EB05F8)proven in game
game+0x12327F0, 0x1232470, 0x1232410, 0x1232670, 0x1231240, 0x1231A600x1412327F0, ...Dlayer setters: position, scale, rotation, skew, colour, shape (see 9.8)offline only
Telemetry and stats
game+0x1DD00600x141DD0060PEtxEventWrite import slotproven in game
game+0x2F79770x1402F7977ISetStat (rsi name, rbp value)proven in game
game+0x3FCD840x1403FCD84IAchievementsModule tick, sharedproven in game

The layer setters are marked offline only because the in-game results came from writing the fields directly; the offsets they write are proven.

9.11 Structures and offsets for this system

More shared layouts (MSVC std::string, vectors, maps) are in 11-structures.md.

Radio

ObjectOffsetWhat
RadioStreamFmod (0x142E76220)+0x08FMOD Sound*
+0x10EventInstance*
+0x28start seek, int32 ms: never write
+0x30the sample (shared_ptr; raw pointer first)
Sample+0x08props
Props+0x00 / +0x20 / +0x40 / +0x60sound / event / display name / artist
+0x8Clength, ms (max 977,656)
+0x90markers vector<int32>: [5] stinger, [6] DJ, [7] end
Radio module+0x78current station name
Pick settings+0xC0 / +0xC1change_to_random_valid_station / random_station_even_on_valid
Progress+0x78station unlock list
RadioState (save)+0x38ActiveStation
Station tableself+0x400x70-byte station records

Engine sound group

Base class of all three groups; rcx in the update is group + 0x1A8.

OffsetTypeWhat
+0x34intthe group's part upgrade level (0-3)
+0x38 / +0x3C / +0x40intintake: turbo level / supercharger level (-1 none) / supercharger kind
+0x50floatEngineRPM (same in all three groups)
+0x54 / +0x58floatThrottle 0-1 / ThrottleDelta
+0x5C / +0x60floatPosTorque / NegTorque (-1 on the limiter's cut)
+0x64 / +0x68floatBoost 0-1 / Doppler
+0x6CfloatClutchPosition (0 declutched)
+0x70intView: 3 chase, 2 bumper or hood, 1 cockpit
+0x74 / +0x78floatFocus / MaxAudibleOverride
+0x7C / +0x80floatintake: SuperchargerRPM / TurboRPM 0-1
+0x84 / +0x88 / +0x8Cint / float / floatengine: gear / GearRatio (negative in reverse) / TransmissionRPM
+0x90 / +0x91u8engine MissedShift / exhaust Backfire (behaviour unconfirmed)
+0xC8u64Studio EventInstance handle (low 32 bits used)
+0x148..+0x198the parameter handles

WeatherManager

OffsetTypeWhat
+0x08 / +0x0C / +0x10 / +0x14floatsky (0 clear .. 1 storm) / sky target / blend / delay to next roll
+0x18floatroad wetness
+0x20 / +0x24floatrain target / rain delay
+0x28 / +0x40vector / sizerain-zone stack
+0x4Cu8rain killed (guess)
+0x58u8island byte (rain particles, island effects)
+0x5C / +0x64float / intrain / severity
+0xA8 / +0xB8int[4]PresetCurrent / PresetNext, per severity
+0xE00x3C bytesthe control (below); +0xE4 held preset index
+0x11Cintisland flag: index into +0x130 and the presets choice
+0x130 / +0x138ptrmainland / island weather fxb data
+0x140ptrfx data (rolls need it and its +0x58)
+0x148 / +0x150 / +0x158ptrpresets: mainland / island / active
+0x1ACfloat[4]odds as running totals (Clear, Cloudy, Threatening, Storm)
+0x1BCu8[4]on[i]
+0x1C0float[4]severity to sky {0, 1/3, 2/3, 1}
+0x1D0 / +0x1E0rain particle effect, mainland / island
+0x210 / +0x211 / +0x214u8 / u8 / floatsplashes allowed / auto-change / splash count factor

Weather control (0x3C bytes)

OffsetWhat
+0x00 / +0x04has_preset (u8) / preset index (int, the preset's +0x60)
+0x08 / +0x0Chas_severity / severity
+0x10 / +0x14has_atmos / sky value (float)
+0x18 / +0x1Chas_env / road wetness (float)
+0x20 / +0x24has_precip / rain (float)
+0x28 / +0x2Chas_wind / wind (float)
+0x30..+0x33, +0x34unknown; every game caller passes 0, 0, 1 and 1.0f
+0x38clamp: 1 = rain kept inside the sky's Precipitation.Intensity band

Presets object: a vector of 0xC8-byte presets at +0x00 / +0x08, and a std::map<std::string, Preset*> with its head at +0x18 (node: left +0, parent +8, right +0x10, _Isnil +0x19, key +0x20, value +0x40). Preset index at +0x60, severity at +0x64 (0 Clear .. 3 Storm).

Time-of-day manager

OffsetTypeWhat
+0x00intforced set (studios); 0 = by track
+0x10floatclock, seconds 0-86400
+0x18floatrate, game seconds per second (48)
+0x1Cfloatrun-until target
+0x24u8pause
+0x25u8lock: SetTime does nothing
+0x26u8rate overridden by the game
+0x27u8lock: StopTimeOfDay does nothing
+0x28u8run-until active
+0x29u8Evaluate on
+0x2Au8clock jumped (the look snaps)
+0x30 / +0x38u8 / floatTrackDesaturate override on / value
+0x3Cfloat[100]TimeScale remap table
+0x1CCu8remap on
+0x368 / +0x388std::stringweather lighting overrides A / B
+0x3A8floatA to B blend
+0x3E0ptr[6]the six time-of-day sets (no spare slot)

Time-of-day frame state

rsi at game+0x197B9B7. Colours are linear (the curves are stored sRGB and decoded).

OffsetWhat
+0x000 / +0x00Csun colour (3 floats) / sun intensity
+0x220 / +0x250 / +0x260fog colour / height-fog colour / fog sun colour
+0x270LightSwitchOnTime
+0x280TrackDesaturate (1.0 by day, 0.9 at night under Clear)
+0x315time jump
+0x324DayNightBlend
+0x328..+0x344tone map keys Luminance0, FStopBias0 .. Luminance3, FStopBias3
+0x36C..+0x380top-down AO values (P, Sa, Sd, I, MaterialPower, MaterialScale)
+0x410 / +0x420 / +0x430static cube sun / ambient colour / intensities
+0x440 / +0x450sky fog colour / sun colour

Offsets marked by the fill function game+0x197BA60 (+0x000, +0x00C, +0x220, +0x250, +0x260, +0x280, +0x410-+0x450) are certain; the rest are likely.

Livery layer and group

Layer fields are in the setter table in 9.8; also +0x58 flags (bit 0 = changed) and +0xA8 the cached shape mesh. A group shares the position (+0x18), scale (+0x28) and rotation (+0x50) fields, has no skew, and keeps its children as a vector<CLiveryNode*> at +0x78 / +0x80 / +0x88.

Telemetry descriptor and SetStat value layouts are in 9.9.

“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 09-hooks-audio-weather-liveries.md at commit bb10508; corrections belong in the original repository.