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
- 9.2 Add a station
- 9.3 The DJ, idents and per-race music
- 9.4 Other audio: UI sounds, engine sound, ambience and reverb
- 9.5 Change the weather
- 9.6 Change the time of day and the clock rate
- 9.7 Skies, cloud sets and the look
- 9.8 Read or write livery layers
- 9.9 React to game events: telemetry and stats
- 9.10 Master address table
- 9.11 Structures and offsets for this system
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:
- FH2 Universal Radio (github.com/Trinculo54/FH2-Universal-Radio) takes over one stock station and feeds it from outside sources.
- Radio Manager (github.com/Trinculo54/RadioManager) adds new stations and feeds them from the player's own files (9.2).
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), callsFMOD::System::createSoundfor the track. The last argument is&this->sound, so the stream object isout - 0x08. - Lets you: create your own sound instead, for the station you own. FH2 Universal Radio creates an
OPENUSERstream (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
E8opcode and that the rel32 reachesFMOD::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 calledtryStart), callsFMOD::Sound::getSubSoundto 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 throughFMOD::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:
| Export | RVA | Address |
|---|---|---|
FMOD::System::createSound | game+0x1997740 | 0x141997740 |
FMOD::Sound::getSubSound | game+0x199F510 | 0x14199F510 |
FMOD::Sound::getUserData | game+0x199FBE0 | 0x14199FBE0 |
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 newisgame+0x3229C0(0x1403229C0), byte check48 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>.xmlfor all ten languages (BR, DE, EN, ES, FR, IT, JP, MX, PL, RU) withset_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
RMplus six characters. - Icon: a
swatchbinatui/textures/Anthem/HUD/HUD_RadioIcon_<name>.swatchbin, added toUI/Controls/HUDRadioControl.xaml. Format: 196x96, BC7, premultiplied alpha, one mip, in the Xbox One tiled layout. A station without an icon can borrow the unusedHUD_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 atrbp-0x80in load: name or data+0x00, mode+0x08, exinfo+0x10(0xD8 bytes, inline), sub-sound index+0xE8. Radio Manager sets modeOPENUSER | LOOP_OFF | 2D(the game addsCREATESTREAMandNONBLOCKING), 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+0xA6A650adds 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,
RadioSetMusicTrackandRadioSetMusicFromGameOptionscall it. It builds the "valid" stations from slots 1-8 only, and moves the player to a random valid one whensettings+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
+0xC0for 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+0xC0and+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)
| Site | RVA | What |
|---|---|---|
| Station table getter | game+0x1008CC0 | 0x70-byte station records at self+0x40; lookup game+0x1008BB0 |
| Station list reader | game+0x101DD60 | reads RadioInfo_<lang>.xml (path built at game+0x100FD94) |
| Radio bank loader | game+0x5AE880 | loads station banks, stops at the first station without |
| Load fallback | game+0x66BA60 | what loads when a saved station is missing |
| Random unlock | game+0x66E115 | a random station unlock |
| Unlock action | game+0x8FD160 | the 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 atgame+0x5AC8CEandgame+0x5B12C2).game+0x5B10C0sends 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 ingame+0x514AC0; its branch atgame+0x515050never takesDJSunnyMorningon 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+0x08of the object at*game+0x365A298, vtable0x142E6AE88; the real AudioManager, vtable0x142E6A948, is at its+0x18).UserInterfacevtable+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 MSVCstd::string(16-byte small buffer, size at+0x10, capacity at+0x18= 15) and fill it with the game'sassignatgame+0x22C300(str, text, len). - Threads: the command ring at
this+0x10has 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:
| Global | Event |
|---|---|
0x142C5EFB0 | /Master/UI/PauseMenu/HZ2_SFX_UI_PauseMenu_Select_01 |
0x142C5EFF8 | /Master/UI/PopUpMenu/HZ2_SFX_HUD_PopUpMenu_Back_01 |
0x142C5EFD0, 0x142C5EFD8 | pause 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, 0x142C5F218 | countdown 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+0x10103A0builds 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,r9balways 1. Swaprbxfor 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(subtract0x1A8to get the group). One set of notes says+0x1C8, reached through a thunk; the code that worked in game uses0x1A8. - Byte check:
48 89 5C 24 08 48 89 6C. - Status: proven in game. Fields in 9.11.
Two more engine-sound instruction sites
| Site | In | Registers | Byte check | Status |
|---|---|---|---|---|
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 name | 49 83 C9 FF 45 33 C0 48 | proven in game |
game+0x100BF06 (0x14100BF06) | game+0x100BCE0: sets a group's upgrade levels | rsi = level record (+0x5C + 4*channel level, +0x68 supercharger, +0x6C turbo, +0x80 selector), rdi = group | 8B 46 6C 89 47 38 8B 46 | offline only |
Banks and the bank manager
- Engine bank loader
game+0x292840(direct call): runsSELECT MediaName FROM Data_Engine UNION SELECT MediaName FROM Data_Motorand loads each bank from the sound zip (format string atgame+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
lookupIDis atgame+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:
game+0x1AE90D0 (handle, &sys): the Studio system from the table at0x143728520, indexed by(handle >> 5) & 7. Ifsys+0xFDis 0, stop (0x65).scope = 0; game+0x1AE9240 (&scope, sys): take the API lock.async = *(sys+0x78); the command buffer isasync+0x200ifgame+0x1AEAF90 (async)returns true, elsegame+0x1AE9A70 (*(async+0x1E8), &cmd, 0x20).- Fill the command:
*(u64*)(cmd+8) = 0; *(void**)cmd = 0x142346990; *(u32*)(cmd+8) = 0x20; *(u32*)(cmd+0x10) = handle; *(void**)(cmd+0x18) = 0. r = game+0x1AEA6E0 (async, cmd); ifr == 0theChannelGroup*is atcmd+0x18.0x66means the event isn't playing yet: retry each update (it works about half a second after a car loads).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 withgetDSP,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
0x08trigger zones (reverbREV_TZ, rainrainzone,AMB_TZ_*),0x09AudioTileXML (emitters),0x0AFMOD 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.
| Site | RVA | What | Status |
|---|---|---|---|
| Ambience / reverb / soundbank-lookup loaders | game+0x196EF90 / 0x196EB40 / 0x196B700 | per-world XMLs; vtables 0x142F64318, 0x142F64398 (slot 1), 0x142F64100 (slot 7) | ambience and lookup loads seen in game |
| Zone enter / exit | game+0x196C360 / 0x196C460 | AudioTriggerLoadedHandler (0x142E6B740); then 0x1965C10 / 0x1965DE0 route rev_type to reverb, amb_event to ambience | offline only |
| Audio tile worker | game+0x196CEA0 | parses AudioTile XML; template lookup 0x19672A0 | offline only |
| Crowd-point search | game+0x1961670 | nearest four; a point with a route id plays only on that route | offline 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.xmlwhose0_Defaultnames 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+0x282atgame+0xF7AC89; what sets it is unknown. - Status: offline only (design only for the file swap).
AudioManager world load — game+0xF5D430
- Does: AudioManager vtable
0x142E6A948slot 12. Atgame+0xF5D4BAit re-reads<world>_reverb.xmlonly if the reverb object (globalgame+0x36EA9D0) exists. - The bug: the reverb object is created once at start-up (by
game+0x1966080, gated atgame+0xF690EAon the start-up optionsdisablereverbandanthemaudiodata, 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.xmlwas asked for exactly once per session. - Fix (design only): function hook here; if
[game+0x36EA9D0]is null, callgame+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; creator48 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 theWeatherPresettable (0 Clear ... 13 StormTropicalFog). - Odds come from the zone file
media\tracks\<world>\triggerzones\tz_weatherchance\tz_weatherchance.tz: tagsclear,cloudy,threatening,stormon 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) andPresets_Island.xml(14). Each names acloudScapeand alighting, andAllowedTransitionlists with achance. 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. Whetherset_filereaches the read ofPresets_Island.xmlis 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 =
+0xF4with 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, atgame+0x19848FAin 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 passesabs(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'sSetWeatherControlandPauseWeatheruse. - 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:
PauseWeatherwith pause = false: calls SetWeatherControl with nothing held (clamp 1). The stateflow eventglobal.unpause_weatheralso releases a hold.game+0x1981BC0freezes 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, andon[i] = odds[i] > 0at+0x1BC. Withroll_nowand no sky held, the next frame rolls. Its game callers are thetz_weatherchanceenter 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+0x140and its+0x58are 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 guardgame+0x1981298, its table usegame+0x19812E2and the timer's callgame+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 rollgame+0x1981290picks the first severity withon[i]andrand <= 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; clampgame+0x1985DE0. Roadgame+0x1985080: wets at 0.02 x rain a second, dries at 0.0122 a second. Preset updategame+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 (gettergame+0x9247B0),cmp eax,225h, and stores the result inWM+0x58andWM+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
cmpand put 549 (0x225) ineaxwhen 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 549sites 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+4is set, the dword at+8is used instead of theWind.Intensitycurve. - 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 rateunless 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 atgame+0x197B19F; the run-until arrival starts80 79 28 00 74 23 C5 FA 10 41 1Catgame+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 atgame+0x197B42F, runs whileToD+0x29is set) builds the frame's lighting state from the set's curves, then blends in the weather's lighting (call game+0x19788E0atgame+0x197B9B2). The hooked instruction isvbroadcastss 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 untilgame+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
0x225ineaxat thecmpwhen it holds your id. Writing 1 intoToD+0while 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)
| Function | RVA | What | Status |
|---|---|---|---|
| SetTime | game+0x197AEC0 | (tod, seconds in xmm1, mode r8d); nothing while +0x25; mode 1 goes through the inverse remap game+0x197ADD0 | proven in game |
| GetTime | game+0x197A880 | the clock | proven in game |
| StopTimeOfDay::OnEnter | game+0x93C9C0 | stateflow stop_time / start_time; nothing while +0x27 | offline only |
| RunUntil | game+0x197AFE0 | runs to a target time; no lock stops it | offline only |
| RunUntilWithRate | game+0x197B030 | stateflow set_time_of_day with speed; writes the rate (road trips use up to 1500) | offline only |
| Race setter | game+0x92F310 | SetTimeOfDayFromGameOptions: the race's start time if >= 0, then SetTime mode 1 | offline only |
| Remap | game+0x197A9E0 | the TimeScale table lookup | proven in game |
| Network clock | game+0x197AF00 | real-time clock for online | offline only |
| Set loader | game+0x197AAE0 | reads all six media\timeofday\xboxone\*.fxb once at boot (from game+0x2E599F) | offline only |
| Command line | game+0x197AA70 | applies currtime=H:M:S, timespeed=, timestopped= (0 or 1) at boot; whether Azimuth passes arguments is unknown | design 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 clock | Evaluated hours | Real time at rate 48 |
|---|---|---|
| 0h-1h | 0.00-3.83 | 75 s |
| 1h-4.75h | 3.83-4.50 | 281 s |
| 4.75h-19h | 4.50-19.25 | 1,069 s |
| 19h-21.27h | 19.25-20.16 | 170 s |
| 21.27h-23h | 20.16-20.76 | 130 s |
| 23h-24h | 20.76-24.00 | 75 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>/:
| File | Format | Size (bytes) | Channels |
|---|---|---|---|
AlphaDiffuse.swatchbin | BC5, 4096x1536 | 11,190,355 | R opacity, G thin (1) / dense (0) |
FadeDensity.swatchbin | BC5, 2048x768 | 2,801,747 | R fade, G density |
TopBottomLight.swatchbin | BC5, 2048x768 | 2,801,747 | R top light, G bottom light |
CloudShadow | BC4, 1024x1024 | shadows 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.xmlin 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 afterfh2mod_initis in time. LeaveCloudShadowstock and the ground shadows won't match the new clouds. Proven in game.
Lighting and tone files:
timeofday\xboxone\TimeOfDay.fxb/TimeOfDay_island.fxbhold the time-of-day curves and the weather lighting overrides (Clear, ClearFog, Threatening, ThreateningFog, Storm3, StormTropical, StormTropicalExtreme). They are read once at boot, soset_filethem insidefh2mod_init. An edited copy served this way changed the look in game.dynamicpost\Presets.xml, collectiondefaultDryDayTonemap<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.Cutoff0 makes a whole-screen veil; FH2's default is 0.74.- The game reads
media\Tracks\AnthemTrackSettings.xmlfor 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 useset_file; never hard-codemediaoverride.
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:
CLiveryLayer0x142EB02D8(game+0x2EB02D8);CLiveryGroup0x142EB0460(+0) and0x142EB05F8(its second base at+8). Constructors atgame+0x1218240andgame+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.
| Setter | RVA | Address | Field |
|---|---|---|---|
| Position | game+0x12327F0 | 0x1412327F0 | +0x18 float x, y |
| Scale | game+0x1232470 | 0x141232470 | +0x28 float x, y |
| Rotation | game+0x1232410 | 0x141232410 | +0x50 float degrees |
| Skew | game+0x1232670 | 0x141232670 | +0x70 float |
| Colour | game+0x1231240 | 0x141231240 | +0x74 u8 R, G, B, A |
| SetShape | game+0x1231A60 | 0x141231A60 | +0x78 u16 shape id (getter game+0x12254B0); drops the cached mesh at +0xA8 |
| Group scale | game+0x1232430 | 0x141232430 | one 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.
- Shapes written directly keep drawing as the old shape (the cached mesh at
- 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 nameFH2_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 ofEVENT_DATA_DESCRIPTOR{ptr, size}with one entry per field. - Descriptor:
+0x00id (the low 16 bits are the event id),+0x10the name,+0x20the field types, low byte of+0x28the 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):
| Id | Event | Id | Event |
|---|---|---|---|
| 4 | AnthemOnlineRaceEnd | 101 | RaceStartParts |
| 6 | AnthemRaceEnd | 103 | RewardBoardSmashed |
| 19 | CarPurchased | 104 | RivalsEnd |
| 27 | ClubXPWon | 105 | RivalsEverywhereEnd |
| 33 | DistanceDrivenDelta | 109 | RoadTripCreated |
| 54 | IslandRewardBoardSmashed | 115 | SkillAchieved |
| 55 | IslandRoadsDriven | 116 | SkillChainCompleted |
| 57 | IslandSkillChainCompleted | 129 | WristbandGained |
| 97 | RaceEncounterEnd | 131 | XPGained |
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 nameFH2_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
AchievementsModuleupdate (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_instructiononly, never a function hook. On the platform, prefershow_toastfor 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.
| RVA | Address | Kind | What | Status |
|---|---|---|---|---|
| Radio | ||||
game+0x1018840 | 0x141018840 | R | RadioStreamFmod::load | proven in game |
game+0x10189A0 | 0x1410189A0 | C | load's getSoundInfo call (Radio Manager) | proven in game |
game+0x1018A13 | 0x141018A13 | C | load's createSound call (FH2 Universal Radio) | proven in game |
game+0x10221F2 | 0x1410221F2 | C | start's getSubSound call, shared by both radio mods | proven in game |
game+0x1997740 | 0x141997740 | D | FMOD::System::createSound (export) | proven in game |
game+0x199F510 | 0x14199F510 | D | FMOD::Sound::getSubSound (export) | proven in game |
game+0x199FBE0 | 0x14199FBE0 | D | FMOD::Sound::getUserData (export) | proven in game |
game+0x3229C0 | 0x1403229C0 | D | game operator new (game threads only) | proven in game |
game+0xA65DF0 | 0x140A65DF0 | F | station lock check | proven in game |
game+0xA6A650 | 0x140A6A650 | R | add to the unlock list (don't) | offline only |
game+0x66DFD0 | 0x14066DFD0 | F | event station pick | proven in game |
game+0x5AE880 | 0x1405AE880 | R | radio bank loader | offline only |
game+0x1008CC0, 0x101DD60, 0x66BA60 | 0x141008CC0, ... | R | station table getter, list reader, load fallback | offline only |
game+0x5AC880, 0x5B1230 | 0x1405AC880, 0x1405B1230 | R | DJ event builders (island/mainland bytes); weather lines 0x514AC0 | offline only |
| UI sound | ||||
game+0xF71C50 | 0x140F71C50 | D | AudioManagerDeferred::play (UI thread); object at *0x14365A298, string assign 0x14022C300 | proven in game |
| Engine sound | ||||
game+0x10103D0 | 0x1410103D0 | I | engine group event path (rbx = sound name) | proven in game |
game+0x1016A50 | 0x141016A50 | F | engine group update (rcx = group + 0x1A8) | proven in game |
game+0x101B258 | 0x14101B258 | I | car audio settings path (rdx) | proven in game |
game+0x100BF06 | 0x14100BF06 | I | group upgrade levels | offline only |
game+0x292840 | 0x140292840 | R | engine bank loader | proven in game |
game+0x10121E0 | 0x1410121E0 | R | bank manager | proven in game |
game+0x1AE90D0 ... 0x1AEA6E0 | 0x141AE90D0 ... | D | rebuilt getChannelGroup (see 9.4) | proven in game |
game+0x102D000 | 0x14102D000 | R | dormant engine synth DSP description getter | offline only |
| Ambience and reverb | ||||
game+0x1971290 | 0x141971290 | R | COpenWorldAmbience update | offline only |
game+0x196EF90, 0x196EB40, 0x196B700 | 0x14196EF90, ... | R | ambience, reverb, soundbank-lookup XML loaders | loads seen in game |
game+0xF5D430 | 0x140F5D430 | F | AudioManager world load (reverb fix site) | design only |
game+0x1966080 | 0x141966080 | D | create the reverb object | design only |
game+0x36EA9D0 | 0x1436EA9D0 | R | global: reverb object | offline only |
game+0x128C220 | 0x14128C220 | R | rain zone loaded | offline only |
| Weather | ||||
game+0x19848B0 | 0x1419848B0 | R | WeatherManager::Update | offline only |
game+0x1985950 | 0x141985950 | F | WeatherManager::UpdateSimulation | proven in game |
game+0x19848FA | 0x1419848FA | C | its only call (fallback) | fallback only |
game+0x1981860 | 0x141981860 | D | SetWeatherControl | proven in game |
game+0x1981C80 | 0x141981C80 | D | release (PauseWeather false) | proven in game |
game+0x1981BC0 | 0x141981BC0 | D | freeze current | proven in game |
game+0x1983B00 | 0x141983B00 | D | SetOdds | proven in game |
game+0x1984F30, 0x1981290 | 0x141984F30, 0x141981290 | R | sky timer, sky roll | offline only |
game+0x2FB9A6 | 0x1402FB9A6 | I | island weather compare | proven in game |
game+0x1984ADE | 0x141984ADE | I | wind override test | design only |
| Time of day | ||||
game+0x197B170 | 0x14197B170 | F | TimeOfDay::Update (Extra Options hooks it) | offline only |
game+0x197B7B0 | 0x14197B7B0 | R | Evaluate | proven in game |
game+0x197B9B7 | 0x14197B9B7 | I | after the weather blend: clock and look | proven in game |
game+0x197B7E5 | 0x14197B7E5 | I | which set (cmp 549) | proven in game |
game+0x197AEC0, 0x197A880 | 0x14197AEC0, 0x14197A880 | D | SetTime, GetTime | proven in game |
game+0x93C9C0, 0x197AFE0, 0x197B030, 0x92F310, 0x197AAE0 | 0x14093C9C0, ... | R | StopTimeOfDay, RunUntil, RunUntilWithRate, race setter, set loader (see 9.6) | offline only |
| Liveries | ||||
game+0x2EB02D8 | 0x142EB02D8 | R | CLiveryLayer vtable | proven in game |
game+0x2EB0460 | 0x142EB0460 | R | CLiveryGroup vtable (second base 0x142EB05F8) | proven in game |
game+0x12327F0, 0x1232470, 0x1232410, 0x1232670, 0x1231240, 0x1231A60 | 0x1412327F0, ... | D | layer setters: position, scale, rotation, skew, colour, shape (see 9.8) | offline only |
| Telemetry and stats | ||||
game+0x1DD0060 | 0x141DD0060 | P | EtxEventWrite import slot | proven in game |
game+0x2F7977 | 0x1402F7977 | I | SetStat (rsi name, rbp value) | proven in game |
game+0x3FCD84 | 0x1403FCD84 | I | AchievementsModule tick, shared | proven 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
| Object | Offset | What |
|---|---|---|
RadioStreamFmod (0x142E76220) | +0x08 | FMOD Sound* |
+0x10 | EventInstance* | |
+0x28 | start seek, int32 ms: never write | |
+0x30 | the sample (shared_ptr; raw pointer first) | |
| Sample | +0x08 | props |
| Props | +0x00 / +0x20 / +0x40 / +0x60 | sound / event / display name / artist |
+0x8C | length, ms (max 977,656) | |
+0x90 | markers vector<int32>: [5] stinger, [6] DJ, [7] end | |
| Radio module | +0x78 | current station name |
| Pick settings | +0xC0 / +0xC1 | change_to_random_valid_station / random_station_even_on_valid |
| Progress | +0x78 | station unlock list |
| RadioState (save) | +0x38 | ActiveStation |
| Station table | self+0x40 | 0x70-byte station records |
Engine sound group
Base class of all three groups; rcx in the update is group + 0x1A8.
| Offset | Type | What |
|---|---|---|
+0x34 | int | the group's part upgrade level (0-3) |
+0x38 / +0x3C / +0x40 | int | intake: turbo level / supercharger level (-1 none) / supercharger kind |
+0x50 | float | EngineRPM (same in all three groups) |
+0x54 / +0x58 | float | Throttle 0-1 / ThrottleDelta |
+0x5C / +0x60 | float | PosTorque / NegTorque (-1 on the limiter's cut) |
+0x64 / +0x68 | float | Boost 0-1 / Doppler |
+0x6C | float | ClutchPosition (0 declutched) |
+0x70 | int | View: 3 chase, 2 bumper or hood, 1 cockpit |
+0x74 / +0x78 | float | Focus / MaxAudibleOverride |
+0x7C / +0x80 | float | intake: SuperchargerRPM / TurboRPM 0-1 |
+0x84 / +0x88 / +0x8C | int / float / float | engine: gear / GearRatio (negative in reverse) / TransmissionRPM |
+0x90 / +0x91 | u8 | engine MissedShift / exhaust Backfire (behaviour unconfirmed) |
+0xC8 | u64 | Studio EventInstance handle (low 32 bits used) |
+0x148..+0x198 | the parameter handles |
WeatherManager
| Offset | Type | What |
|---|---|---|
+0x08 / +0x0C / +0x10 / +0x14 | float | sky (0 clear .. 1 storm) / sky target / blend / delay to next roll |
+0x18 | float | road wetness |
+0x20 / +0x24 | float | rain target / rain delay |
+0x28 / +0x40 | vector / size | rain-zone stack |
+0x4C | u8 | rain killed (guess) |
+0x58 | u8 | island byte (rain particles, island effects) |
+0x5C / +0x64 | float / int | rain / severity |
+0xA8 / +0xB8 | int[4] | PresetCurrent / PresetNext, per severity |
+0xE0 | 0x3C bytes | the control (below); +0xE4 held preset index |
+0x11C | int | island flag: index into +0x130 and the presets choice |
+0x130 / +0x138 | ptr | mainland / island weather fxb data |
+0x140 | ptr | fx data (rolls need it and its +0x58) |
+0x148 / +0x150 / +0x158 | ptr | presets: mainland / island / active |
+0x1AC | float[4] | odds as running totals (Clear, Cloudy, Threatening, Storm) |
+0x1BC | u8[4] | on[i] |
+0x1C0 | float[4] | severity to sky {0, 1/3, 2/3, 1} |
+0x1D0 / +0x1E0 | rain particle effect, mainland / island | |
+0x210 / +0x211 / +0x214 | u8 / u8 / float | splashes allowed / auto-change / splash count factor |
Weather control (0x3C bytes)
| Offset | What |
|---|---|
+0x00 / +0x04 | has_preset (u8) / preset index (int, the preset's +0x60) |
+0x08 / +0x0C | has_severity / severity |
+0x10 / +0x14 | has_atmos / sky value (float) |
+0x18 / +0x1C | has_env / road wetness (float) |
+0x20 / +0x24 | has_precip / rain (float) |
+0x28 / +0x2C | has_wind / wind (float) |
+0x30..+0x33, +0x34 | unknown; every game caller passes 0, 0, 1 and 1.0f |
+0x38 | clamp: 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
| Offset | Type | What |
|---|---|---|
+0x00 | int | forced set (studios); 0 = by track |
+0x10 | float | clock, seconds 0-86400 |
+0x18 | float | rate, game seconds per second (48) |
+0x1C | float | run-until target |
+0x24 | u8 | pause |
+0x25 | u8 | lock: SetTime does nothing |
+0x26 | u8 | rate overridden by the game |
+0x27 | u8 | lock: StopTimeOfDay does nothing |
+0x28 | u8 | run-until active |
+0x29 | u8 | Evaluate on |
+0x2A | u8 | clock jumped (the look snaps) |
+0x30 / +0x38 | u8 / float | TrackDesaturate override on / value |
+0x3C | float[100] | TimeScale remap table |
+0x1CC | u8 | remap on |
+0x368 / +0x388 | std::string | weather lighting overrides A / B |
+0x3A8 | float | A to B blend |
+0x3E0 | ptr[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).
| Offset | What |
|---|---|
+0x000 / +0x00C | sun colour (3 floats) / sun intensity |
+0x220 / +0x250 / +0x260 | fog colour / height-fog colour / fog sun colour |
+0x270 | LightSwitchOnTime |
+0x280 | TrackDesaturate (1.0 by day, 0.9 at night under Clear) |
+0x315 | time jump |
+0x324 | DayNightBlend |
+0x328..+0x344 | tone map keys Luminance0, FStopBias0 .. Luminance3, FStopBias3 |
+0x36C..+0x380 | top-down AO values (P, Sa, Sd, I, MaterialPower, MaterialScale) |
+0x410 / +0x420 / +0x430 | static cube sun / ambient colour / intensities |
+0x440 / +0x450 | sky 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.
