This chapter lists the game code behind FH2's worlds: which world is loaded, how areas stream in and out, how the game travels between the mainland and Storm Island, how a new world can be added, how collision is answered, and how procedural trees, fences and props become breakable. Read it if your mod changes the scenery, the ground the cars drive on, or where the player can go. For how to hook safely, read chapter 5 first; for the world's file formats, see chapter 10.
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. Both forms are given the first time an address appears in a table. See
chapter 1.
Contents
- 6.1 What do you want to do?
- 6.2 How the game thinks about worlds
- 6.3 Know when a world loads, streams and goes
- 6.4 Make objects breakable: procedurals, trees, fences and props
- 6.5 Change collision
- 6.6 Switch worlds: travel, boot world and maps
- 6.7 Add a custom world
- 6.8 Archives, streaming and the file cache
- 6.9 Diagnostics for world work
- 6.10 Master table of this chapter's addresses
- 6.11 Structures and offsets for this system
How to read the entries
Each hook entry gives the address in both forms, the kind of hook, what the game function does, what hooking or calling it gets you, the registers or arguments that matter, a byte-check note, known conflicts and a status:
| Status | Meaning |
|---|---|
| Proven in game | A released mod, or a logged test run, used it and it worked. |
| Offline only | Read from the exe with a disassembler, or checked against the game's files or an offline harness. Never seen running. |
| Unconfirmed | A design or a reading that nobody has run or checked twice. Treat it as a lead. |
Hook kinds use the platform's names (function, call site, slot, instruction, byte patch); 5.2 shows the Extra Options plugin equivalent of each.
Extra Options plugins get no chaining and no byte checks from Extra Options (chapter 3), so
several sites below that other mods already hook are only safe to share through the platform. Every site here is made
after wait_for_code; use an infinite wait (0xFFFFFFFF). A 60 s wait once gave up while other mods held the start
for 65 s, and a world that needed its hooks then crashed 3 s into loading.
6.1 What do you want to do?
| Goal | Start with | Section |
|---|---|---|
| Know which world is loading or has gone | track loader game+0x133DEDF, destructor game+0x1377B50 | 6.3 |
| Know when an area's cells or objects stream in | CWorldCollObjMan::AddCell game+0x36A330, cell loader game+0x139AC40 | 6.3 |
| Make trees, bushes, fences or clutter breakable | ProceduralModelsData::Serialize game+0x1871B90 and friends | 6.4 |
| Add collision (walls, pylons, a whole track) | CollisionWorld::GetPolys game+0x12CC730 | 6.5 |
| Remove collision from a template (trunks, walls) | template grid query game+0x12CC1A0 | 6.5 |
| Let a car drive outside the streamed area | valid-region test game+0x12D3D30 | 6.5 |
| Send a travel somewhere else | SwapTrack instruction game+0x939410 | 6.6 |
| Choose the world a save boots into | profile load game+0xD4ABB4 | 6.6 |
| Show the island's maps in another world | five island-test sites | 6.6 |
| Add a whole new world | two database rows, the zip-scan patch, file hooks | 6.7 |
| Stop "Failed to load FileChunk" | the file cache capacity [game+0x36614A8] | 6.8 |
| See every file load that failed | std::string operator+ game+0x263E50 | 6.9 |
6.2 How the game thinks about worlds
Three kinds of world: 542, 549 and "neither"
A world is a row in the game database's Tracks table, joined to an Environments row, and a folder under
<game>\Mount\media\tracks\<MediaName>\.
| Track id | MediaName | World |
|---|---|---|
542 (0x21E) | Anthem (folder anthem) | the mainland |
549 (0x225) | Test03 (folder test03) | Storm Island. Its real files are in the Storm Island DLC package (<game>\Mount\DLC\StormIsland_...\media\tracks\test03\); the base test03 folder holds only buildNumber.txt and triggerzones\ |
| 308 | HomeSpace02 (folder homespace02) | the Autoshow and Buy Car studio (white dome and floor), loaded as a "homespace" |
The code knows only two open worlds. About 60 instructions compare a track id with 549 (cmp eax,0x225 and similar)
and about 30 more call the island test below; 49 more carry 542; 14 functions switch on id - 542 (0 mainland,
7 island). Every other id is "neither": about 20 places then do nothing at all (speed zone, speed trap, event,
bucket-list and road-discovery statistics, the restore point, garage and Autoshow activation, map tutorials). So
nothing driven in a third world lands in the mainland's or the island's statistics. The stateflow treats every id
other than 549 as the mainland. (Offline only; the two readings of the exe give 59 or 63 compares and 26 or 31
callers.)
"Is this the island?" — game+0x296150
- Address:
game+0x296150(0x140296150). Starts48 83 EC. - Kind: direct call, or a call-site hook on one of its callers. Don't hook the function itself: every caller would see your answer.
- What it does: returns
[TrackSwapManager+8] == 549. The map, minimap, pause tile, map-profile loading, traffic and many stateflow branches ask it. - Relatives:
game+0x296390(0x140296390) is the same test plus "no swap pending" (4 callers);game+0x296340(0x140296340) andgame+0x2963E0(0x1402963E0) test "the world is 542".game+0x2F5EF0(0x1402F5EF0, 14 callers) is related; what it decides is not known. - Status: proven in game (redirecting its call sites to answer "island" makes the island's map show; see 6.6).
TrackSwapManager — [game+0x365AD70]
The global at game+0x365AD70 (0x14365AD70) points at the track swap manager:
| Offset | Meaning |
|---|---|
| +0x08 | current track id (int32); getter game+0x9247B0 (mov eax,[rcx+8]; ret) |
| +0x0C | target track id |
| +0x14 | state |
| +0x20 | arrival position |
| +0x30 | arrival rotation (degrees) |
TrackSwapManager::RequestSwap is game+0xFDBDE0 (0x140FDBDE0); its update game+0xFDC5A0 (0x140FDC5A0, called
from the main update at 0x140F7B293) swaps when current and target differ. Reading +0x08 is the cheapest way to
know which world you are in. Offline only (the layout); the current id has been read in game by several mods.
Track id resolver — game+0xFDAA20
- Address:
game+0xFDAA20(0x140FDAA20). Read only; don't hook. - What it does: takes 542 and 549 as they are (compare at
0x140FDAA3E). Any other id runsSELECT MediaTrack FROM Tracks WHERE Id=%dand keeps the row'sMediaTrack. - Why it matters: a world of your own needs
MediaTrackequal to its own id, or it resolves to another world. Note that Storm Island's own row hasMediaTrack542; it never goes through this query. - Gotcha: with no row, the record set's integer reader (
game+0x1090E80, throughgame+0x10908C0) returns its preset0x7FFFFFFF, which becomes the current and target world. There is no fallback. Never let a save hold a track id that has no row in an unmodded game (see the save hooks in 6.6). - Status: offline only (read in full).
The world's row is read by SELECT MediaName, RibbonIndex FROM Tracks WHERE Id=%d at game+0xFC4909 and
game+0xFDC6F3, and by a Tracks INNER JOIN Environments query at game+0xFA32D0. None tests whether a row came
back, and a Tracks row without its Environments row counts as no row. game+0xF9DF00 loops over every
non-homespace row (WHERE IsHomespace='0') once at start-up; what it builds is not known.
Homespaces and open worlds
The track loader sets a "homespace" byte at TrackPresentation11+0xAAD0 when the world's name contains homespace
(case-insensitive). That one byte changes a lot (about 21 readers):
- memory comes from heap tag
0x2Finstead of the track heaps, and the per-car-count memory budget is skipped; - the world gets its own model fixup handler instead of the shared one (
GetModelFixupHandler, 6.7); - open-world streaming is skipped: no GeoChunk archives pinned at TP+0xAB70, no per-frame streaming queue
(
game+0x367BCD0), and no cinematic PVS zones (the pump atgame+0x1341190skips its whole zone block atgame+0x1341AFB).
No other code tests a world's name. The underworld loader and the draw path don't look at the flag.
6.3 Know when a world loads, streams and goes
The TrackPresentation11 object ("TP" below; vtable game+0x2EC23D8) is the loaded world. It holds the world's
name, its placements, models and collision. Mods that keep notes per world (per definition number, per model, per
placement) must drop them when the TP goes: game memory is reused at once.
Track loader, homespace store — game+0x133DEDF
- Address:
game+0x133DEDF(0x14133DEDF), inside the track loadergame+0x133DE30(0x14133DE30). - Kind: instruction hook on
mov [rsi+0xAAD0],al(bytes88 86 D0 AA 00 00). - Registers:
rsi= the TP,al= the homespace flag about to be stored. - What it gets you: every world passes here as it loads, homespace or not. It is the reliable "world X is loading"
point. The world's name is the MSVC
std::stringatTP+0xAAB0(32 bytes; check capacity at+0x18before reading inline text, see chapter 11):Anthemon the mainland,Test03on Storm Island. - Disagreement: one reading puts the flag set at
game+0x133DECD; that is the compare (a case-insensitivestristr-style call atgame+0x1089A80).game+0x133DEDFis the store and the one that has been hooked. - Status: proven in game.
TrackPresentation unload — game+0x1385857
- Address:
game+0x1385857(0x141385857), in the unload routinegame+0x1385760. - Kind: instruction hook on
mov [rdi+0x1AA20],rcx(bytes48 89 8F 20 AA 01 00).rdi= the TP. - What it gets you: a point where the world is being taken down, before the destructor.
- Status: proven in game.
TrackPresentation11 destructor — game+0x1377B50
- Address:
game+0x1377B50(0x141377B50);fh2game.h:FH2_GAME_TRACKPRESENTATION11_DTOR. - Kind: function hook. Arguments
(tp, a, b, c); the body isgame+0x13228E0. - What it gets you: "this world is gone". Forget everything you know about it here.
- Byte check:
48 89 4C 24 08 57 48 83 EC 30 48 C7 44 24 20 FE FF FF FF. WreckingBall also checks that theleaat+0x28points at the vtablegame+0x2EC23D8. - Conflicts: WreckingBall's in-progress track-change fix and a track-import mod both hook it. Two mods that each compare in-memory bytes before hooking fail both ways: whichever hooks second sees a jump and refuses, and only timing decides who wins. Check against the exe on disk and let the platform chain (5.4).
- Enable order: if you use it together with the loader hook above, enable the destructor and unload hooks first and the "world is loading" hook last, and treat the three as all or nothing.
- Status: proven in game.
// World load and unload notes (platform mod, API 7+). Error handling and the disk fallback trimmed.
static std::atomic<void*> g_world; // the current TP, or null
using DtorFn = void (*)(void*, void*, void*, void*);
static DtorFn o_tp_dtor;
static void on_world_loading(FH2Context* c, void*) {
g_world.store(reinterpret_cast<void*>(c->rsi)); // name: std::string at TP+0xAAB0
}
static void d_tp_dtor(void* tp, void* a, void* b, void* c) {
if (g_world.load() == tp) g_world.store(nullptr); // drop per-world notes here
o_tp_dtor(tp, a, b, c); // always call on
}
// on your own thread, after char* game = (char*)api->wait_for_code(0xFFFFFFFFu) and the byte checks:
api->hook_function(mod, "TrackPresentation11 dtor", game + FH2_GAME_TRACKPRESENTATION11_DTOR,
(void*)&d_tp_dtor, (void**)&o_tp_dtor);
api->hook_instruction(mod, "world loading", game + 0x133DEDF, on_world_loading, nullptr);
api->enable_hooks(mod, nullptr);
Areas streaming in and out
The open world is cut into cells. A position maps to a cell through the world's .hex file (100 m hexagons); each
cell's PVSZ block lists the placements, models, textures, collision and other records that must be resident. The
places to watch:
| Address | What | Kind | Status |
|---|---|---|---|
game+0x36A330 (0x14036A330) | CWorldCollObjMan::AddCell: a streamed cell's procedural objects arrive | function | proven in game (WreckingBall, 6.4) |
game+0x368D90 (0x140368D90) | CWorldCollObjMan::SpawnCell | function | proven in game (WreckingBall, logging) |
game+0x139AC40 (0x14139AC40) | TP vtable +0x280: cell load (also the cinematic zone change event) | slot or function | offline only |
game+0x137BB40 (0x14137BB40) | TP vtable +0x288: cell unload | slot or function | offline only |
game+0x1359640 (0x141359640) | loop over a cell's records: type 0x00 load and activate, 0x80 prefetch | read | offline only (it carries the ambient-occlusion tiles, proven in game) |
game+0x1341190 (0x141341190) | PVS request and unload pump; skips cinematic zones in homespaces at game+0x1341AFB | read | offline only |
game+0x1871B90 (0x141871B90) | ProceduralModelsData::Serialize: a procedural library (trees, fences) loads | function | proven in game (WreckingBall) |
Notes:
- The cell loader increments a u8 reference count at placement+0x24 and reads the per-model record and model object without a bounds check. A cell that lists a model number at or past the record count writes out of bounds; the record count is the real model-id limit of a world.
- The current cell is the dword at
TP+0x19518(orTP+0x19570before byteTP+0x18231is set);TP+0x19518is a list of 22 ids merged from two trackers at TP+0x190F0 and TP+0x19300. CWorldCollObjMan+0x4F0holds the position the world's objects stream around (the car in view), stored by its update atgame+0x383936.
Cinematic zones
A world's .pvs holds a map of numbered cinematic streaming zones. The post-race rewards scene lives in zone 10065
(126 character models: the avatar, the two rep girls, wristband props); the mainland and Storm Island ship it.
| Address | What | Status |
|---|---|---|
game+0x17402A0 -> game+0x13302C0 | zone request; an id not in the world's map is silently dropped | offline only, consequence proven in game |
game+0x1746810 | "zone ready": a missing id counts as not ready, with no timeout | offline only |
So a world without zone 10065, or any homespace world, never finishes the rewards scene. A track-import mod served a
trimmed copy of the route's PostRace_Rewards_Complete_01.xml instead (proven in game); see
chapter 7.
The streaming wait (the 60-second dark screen)
After a load or a reset, wait_for_streaming_around_local_human_car waits for the TP tick to say "ready".
- Tick:
game+0x13079A0(0x1413079A0), runs while byte[tp+0x10BC]is set. It asks the streamer (vtable +0x1B8) whether it is idle and, when a position is set ([tp+0x10C0], the car's), whether the position is inside the current cell. - Inside-cell test:
game+0x133B580(0x14133B580). False while[tp+0x8094]is set or the current cell is -1; otherwise it passes only within the cell's own hexagon centre plus radius + 10 m (110 m for 100 m cells). - Give-up: after 60 s (the double at
game+0x1F29778) it finishes anyway atgame+0x1307AC0, then sets the simulation's "track ready" byte[sim+0x3D7]. - Lesson (proven in game): a reset that sits dark for exactly 60 s means the car's position is in a
.hexslot whose cell's own hexagon is elsewhere. It is not navigation; the.navplays no part in this wait. - Fix: give every slot the road crosses a cell of its own in the
.hex(offline only), or, as a DLL fix, hookgame+0x133B580to answer true inside your track (unconfirmed).
IsStreamingReadyAroundPos (vtable game+0x2D09308, update game+0x8B2200) reads the tester flags at +0x20/+0x21:
a position in no .hex cell hangs the wait. Proven in game.
6.4 Make objects breakable: procedurals, trees, fences and props
Everything here comes from WreckingBall (github.com/Trinculo54/WreckingBall), which ships these hooks in its
releases: trees and bushes break, broken trees throw logs, fences and clutter break, wooden poles fall and concrete
pylons are solid. The source is one file, src/wreckingball.cpp; read it alongside this section. Unless marked, the
status of each entry is proven in game (released). The platform names all of these sites in fh2game.h.
The objects involved
- Procedural libraries (
Procedural::ProceduralModels, vtablegame+0x2F5A300) place thousands of instances of one kind:TREEANDBUSHTEMPLATEholds trees and bushes,BARRIERTEMPLATEfences and railings. CWorldCollObjManmanages world collision objects: static until hit, then made dynamic, broken into pieces and cleaned up.CWorldCollObj(vtablegame+0x2C6A208) is one object; slot 0 isOnCollision.- Definitions (
CCollObjPhysicsDefinition, 0xF0 bytes) describe an object's shapes, mass, break speed, render model and break effect. They are numbered per map: the mainland and Storm Island use different numbers for the same thing, so match them by name hash (game+0x126E020).
ProceduralModelsData::Serialize — game+0x1871B90
- Address:
game+0x1871B90(0x141871B90). Kind: function hook. Signature:void(data, archive). - Byte check:
40 57 48 83 EC 50. - What the game does: loads a procedural library as an area streams in.
- What a hook gets you: run the original, then rewrite the library's groups. WreckingBall groups tree instances
by size and resizes the group vector at
data+0x60with the game's ownvector<Group>::resize(game+0x1881EC0, so the game's allocator is used), then writes one 0x1C-byteGroupper run:{def, batch, start, count, bbBatch=-1, bbStart=0, bbCount=0}. The definition picks the behaviour: 110 bush, 97 tree, 98 big tree (counts for the Lumberjack skill). - Gotcha: the same address is reused for a new library. Drop every note about the old object here first;
WreckingBall's crash at
game+0x369029was notes outliving their object.
CWorldCollObjMan::AddCell — game+0x36A330
- Address:
game+0x36A330(0x14036A330). Kind: function hook. Signature:void(mgr, msg). - Byte check:
48 89 5C 24 08 57 48 81 EC 80 00 00(fh2game.h; WreckingBall checks the first six). - Arguments:
msg+0x60= the provider (check its vtable isProceduralModels),msg+0x68= count (u16); provider+0xF8= the data,+0x58= procedural index,+0x18= name. - What a hook gets you: the moment a cell's objects arrive; translate your groups into this map's definition numbers before calling on.
CWorldCollObjMan::SpawnCell game+0x368D90 (void(mgr, cell); cell+0x20 provider, +0x28 procedural id, +0x30
count) and MakeDynamic game+0x368C60 (void(mgr, obj); a static object becomes loose) are useful for logging. The
game subtracts the centre of mass in SpawnCell (at game+0x3690A2), which matters when you place a pole's base.
Definition lookup and render model — game+0x12CC010, game+0x12CD300
- Addresses: lookup
game+0x12CC010(0x1412CC010),uint8_t*(table, uint32 id); render modelgame+0x12CD300(0x1412CD300),int(table, uint32 id). Both are leaf functions without unwind data. - Byte check:
48 8B 41 08 44 0F B7 C2 C1 EA 10(both). - Id:
(piece << 16) | def; piece0xFFFF= the whole object. The table's list is attable+8, its end at+0x10. - What a hook gets you: definitions of your own. WreckingBall answers for its ids
0xF0xx(tree size clones), a pole body with one box, and a pool of log bodies0xF080-0xF0FB, and returns another model for render-only definitions. - Gotcha: copies under your own ids make no break sound: sounds are keyed by definition index. Use real definitions where the sound matters.
CWorldCollObj::OnCollision — slot at game+0x2C6A208
- Address: vtable
game+0x2C6A208(0x142C6A208), slot 0 (the function isgame+0x378230). - Kind: slot (
hook_pointer). Signature:void(obj, contact). - Arguments:
contact+8has a vtable;+0x38is the other party's type (1 = car) and+0x40returnscar+0x10. The car's dynamics are atcar+0x4C08; GetVelocity is its vtable +0x288, SetVelocity +0x290 (game+0x12E3CF0).car+0x4D08is the car kind (0 = the player). - What a hook gets you: react to a hit: slow the car by the object's size, keep some barriers solid, start a pole falling. Slow only the player's car; changing AI cars' speed caused problems.
Collision template load and grid query — game+0x12B2500, game+0x12CC1A0
- Template load:
game+0x12B2500(0x1412B2500), function hook,void(holder), byte check40 57 48 83 EC 40.holder+0x28= the resource (StreamedPhysics::CollisionTemplateResource, vtablegame+0x2EB43C0),+0x30= the template. The resource's name string is atres+0xC0;procphysin the name marks procedural physics (tree trunks). - Grid query:
game+0x12CC1A0(0x1412CC1A0), function hook,int(T = template+0xD8, const float* box, int max, uint8_t** outTris, uint8_t** outVerts, uint8_t flag), byte check48 89 5C 24 20 57 41 54. Filter the output to remove collision: WreckingBall drops the solid trunk triangles of breakable trees and the point-cloud barrier points, so the game's smashable code meets the car instead of a wall. Triangle layout in 6.11.
BreakIntoPieces and the loose copy's model — game+0x36AC80, game+0x36AEAC
- BreakIntoPieces:
game+0x36AC80(0x14036AC80), function hook,void(mgr, obj), byte check48 8B C4 48 89 50 10 48 89 48 08 55. The game spawns one loose piece per child of the definition atobj+0x124. For a tree whose pieces aren't streamed in, WreckingBall swapsobj+0x124to a fallback tree that is resident for the call, then puts it back. - Model pick: instruction hook at
game+0x36AEAC(0x14036AEAC), bytes48 8D 4D C0 48 89 4C 24 20.r15= the object,r14= the manager,eax= the model about to be bound. Writeeaxto keep the original's look; the procedural's own model is reached bybatch+0x50-> R ->[R]->+0x10-> the placed instance[tp+0xFB78 + idx*0x70]+0x10.
CWorldCollObjMan::Update — game+0x384C00
- Address:
game+0x384C00(0x140384C00). Kind: function hook. Signature:void(mgr, float, float). - Byte check:
48 8B C4 55 56 57 41 54 41 55. - What a hook gets you: a per-frame callback on the game thread that owns world objects. Spawning, despawning, moving bodies and clean-up are safe from here, unlike from your own thread.
- Conflicts: NitroSystem hooks it too. WreckingBall 1.3.0 checked memory and lost the feature; 1.3.3 checks the disk and chains.
Binding and drawing broken pieces — game+0x132B390, game+0x13A41E0
CTrackPresentation::BindCollObjInstanceToModelgame+0x132B390(0x14132B390),uint64(tp, int slot, int model, const float* m, void* key). Check thatCTrackPresentationvtable (game+0x2EB8590) slot +0x338 still holds it. Tells you which render slot an object was bound to.- Render node update
game+0x13A41E0(0x1413A41E0),uint64(a, b, c, d, uint8_t* node, ...), byte check48 8B C4 44 89 48 20 4C 89 40 18. The node's world matrix is atnode+0x20(translation at+0x50). WreckingBall stretches log matrices here and moves a pole's base down, because the game draws a body around its piece's centre of mass. Guard against changing one node twice. This is also the placement draw function: it sets the alpha-to-coverage blend state before the alpha-tested list (game+0x13A4620) and restores opaque after (game+0x13A46EF).
Game calls for spawning and clean-up
| Address | Name | Arguments as used |
|---|---|---|
game+0x369690 (0x140369690) | SpawnObject | (mgr, u8 flag, id, slot, vec4* pos, Matrix34* rot, int, key*); byte check 48 8B C4 44 89 40 18 88 50 10 |
game+0x37A7D0 (0x14037A7D0) | RecycleSlot | (mgr): takes a slot, recycling the farthest loose piece |
game+0x377340 (0x140377340) | BindModel | (mgr, slot, obj, model, m) |
game+0x369E80 (0x140369E80) | AddPhysics | (mgr, obj) |
game+0x3820C0 (0x1403820C0) | SpawnEffect | (mgr, std::string* "SMASHABLE_x", Matrix44*, dir, vel, scale, bool, bool, car*) |
game+0x126E020 (0x14126E020) | NameHash | (const char* s, bool caseless, seed 0x1505) |
game+0x1874600 (0x141874600) | decode a procedural instance | (data, Matrix44* out, inst, float* scaleOut) |
game+0x384A10 (0x140384A10) | debris despawn | (read; not called) |
Call these from the manager update above, on the game thread. Through vtables: IPresentation slot +0x178 is
SetModelInstanceHidden(int* idx, bool hidden, bool lods), called on mgr+0x10.
Gotchas for anything you spawn:
- Debris clean-up exempts only default-key objects (the default key is the global at
game+0x2C6881C), and RecycleSlot takes the farthest loose piece. A new object meant to stay needs a key-based exemption and a guard against recycling. - Models only stream in near where the game uses them. The apple tree is resident only near orchards. Check that
[tp+0xF618][model]has its resource at+8(null = not loaded) before drawing with it. - Wires stay up. Telephone wires keep hanging after a pole falls; nobody has found what owns them.
- Map facts WreckingBall relies on: pole models 8953/8954 (whole) and 8619-8621 (pieces) on the mainland, 1748/1749 and 1501-1503 on Storm Island; the concrete pylon is model 8616, mainland only, with no collision of its own. Fence names map to the game's breakable definitions: Wood 113, Wicker 116, Tarp 115, Wire and Chain 96, Plastic 129, Bollard 14, Fenc/Rail/Barrier 114. Bushes, crops and vineyard rows break as definition 110; 266 is the game's own breakable vine row.
Skill retrigger tuning (Load slots)
The skills' Load is slot 14 (+0x70) of each skill vtable. After the original, SkillBase+0x24 is RetriggerDelay
(float) and, for Destruction, +0x44 is MaxTimeBetweenCollisions.
| Skill | Vtable | Slot address | Original |
|---|---|---|---|
| Destruction | game+0x2D4BBF0 | game+0x2D4BC60 | game+0xA81770 |
| Lumberjack | game+0x2D4BA28 | game+0x2D4BA98 | game+0xA81930 |
| Sideswipe | game+0x2D4B270 | game+0x2D4B2E0 | game+0xA80D90 |
Props that vanish or draw wrongly (placements)
Offline readings, useful if you add or move placed props. FH2 culls and switches LOD for whole placements only
(band pick game+0x1251FE0). A small-object cull (game+0x133ADC0) drops a placement beyond about
screenAreaDistances x its radius (main view 200, cube map 70, mirror 8), so a 1 m prop on its own placement
vanishes at about 200 m unless node flag 0x2000 (+0xB8) is set. Back faces are always culled on placements. A
placement can use at most 256 texture positions; past that it is not drawn (proven in game).
6.5 Change collision
CollisionWorld::GetPolys — game+0x12CC730
- Address:
game+0x12CC730(0x1412CC730);fh2game.h:FH2_GAME_COLLISIONWORLD_GETPOLYS. - Kind: function hook.
- Signature:
int(world, const float* box, int max, uint8_t** tris, uint8_t** verts, uint8_t flags). - What the game does: returns the triangles a query box touches, for wheels, bodies, cameras and effects.
- What a hook gets you: extra static collision anywhere. Call the original, then add your triangles and vertices
to the output and return the new count. WreckingBall adds a 10-triangle box around each concrete pylon; a
track-import mod answered a whole circuit's ground this way; an on-foot mod uses it too. See WreckingBall's
d_getPolysfor working code. - Byte check:
48 8B C4 44 89 40 18 48 89 48 08 55. - Rules learnt the hard way (proven in game):
- Respect
max. Queries ask for 200 to 2,000 triangles. Only the 200-triangle queries overflowed in a kerb-dense track. When you must cut, return the triangles nearest the box centre first, not in file order. - Flags must share a bit. A triangle whose header flags share no bit with the query's
flagsis skipped. Cameras query with flag0x04(the call atgame+0x12BB312), so collision without bit0x04is ignored by cameras: about 7 % of queries in one run. - Vertex
wis a packed normal. WithUseVertexNormals TRUEin PhysicsSettings.ini the wheel contact (game+0x12B8230) reads each vertex'swas a u32: x in bits 0-10 and z in bits 11-21 (signed, /1023), y in bits 22-31 (signed, /511), blended by the hit's barycentrics.w = 1.0made every contact normal point straight up and cars bounced down every hill. - Compound worlds ask each child.
CollWorldAll::GetPolys(the cars' query) andCompoundCollisionWorld::GetPolyspass the same box to each child world, so a hook on this function hands out its triangles once per child. Filter onworldif duplicates matter.
- Respect
- Conflicts: WreckingBall, a track-import mod and an on-foot mod. Chain through the platform; never replace. WreckingBall 1.3.0 refused its pylons when it found another mod's jump here; 1.3.3 checks the disk.
- Status: proven in game.
Valid-region test — game+0x12D3D30
- Address:
game+0x12D3D30(0x1412D3D30),CollisionWorldvtable (game+0x2EB46A0) slot 3. - Kind: function hook. Signature:
int(world, box). - What the game does: returns 0 only if the box lies inside a box of each of the world's two valid-region lists;
otherwise 1, and the car is frozen in place.
CompoundCollisionWorld(game+0x12D3E00) ORs its children; the box-in-box test isgame+0x12507D0. - Where the regions come from:
game+0x135B250builds aCollisionValidRegion(0x30 bytes: two vectors of 32-byte boxes{min xyz, _, max xyz, _}), boxes of +/-(0.85 r + 415) m (y +/-100,000) around the cells in TP+0x19570 and TP+0x19518, queued throughgame+0x131C260andgame+0x12AF910. - What a hook gets you: answer 0 inside your own collision, so a car can drive where the stock world has no streamed cells.
- Byte check:
40 57 48 83 EC 30 48 C7 44 24 20 FE FF FF FF. - Status: proven in game.
Collision that comes from the world's own files
- Per-frame collision requests come from the active zone's fifth PVSZ vector (zone+0x60, read at
game+0x1327E33). Each entry indexes the root collision table at TP+0xFB90, andgame+0x132D540instantiates only requested roots. No entries means no ground. Proven in game. CollObjs.xmlis never parsed in FH2: its path appears only in a prefetch list (game+0x2D8710). Every stock copy is stubs.CollObjTypes.xmlis asked for in every world and exists in none ("Failed to load" is normal).- Physics definitions are loaded by
ForzaSimulationvtable slot 0x128 (game+0x2D3320) from<track>\PhysicsDefinitions.bin.
Falling out of the world
- The out-of-bounds and fall resets (
game+0x2A8B50) fire on surface 55, on falling below y = -50, or on lying rolled over. A car landing on a floor above -50 is never reset. None reads the navigation world. - Surface 55
InvisibleTeleportingBorder(used atgame+0x1059350) is the game's own reset surface; a floor of it under a world should reset escapes at once (unconfirmed, never tried). - The car reset target is
game+0xF5DB40. Free roam always uses respawn mode 3 (last stable position), not the nearest road; see chapter 7 for the modes.
6.6 Switch worlds: travel, boot world and maps
Stock travel is a stateflow: stateflow\track_swap_flow.xml runs common_track_swap with the literal names
Test03 or anthem, unloads and reloads the navigation world by that name, and the travel descriptor
(game+0x17D060) knows only Mainland (542) and Island (549). Native travel (game+0x93F0F0) knows only those two;
any other id falls through to the mainland transition. No data file can name a third world, so travel anywhere else
needs the instruction hooks below. No platform API starts a stateflow state, so a DLL can't start a trip from a
menu without a private call; trips start from a prompt in the world.
Scope your travel hooks: stateflow update — game+0x19281E0
- Address:
game+0x19281E0(0x1419281E0). Kind: function hook. Signature:(Instance*, Context*), main thread, once per state machine per tick. - What a hook gets you: "this update is inside state X". Set a thread-local flag around the original call when the machine's frame chain holds your own state, and let the travel hooks below act only while it is set. SwapTrack runs inside this update. It is also the best hang detector: log each machine's state changes, and a machine whose last line never changes is waiting forever.
- Layout: Instance +0x28 first frame, +0x30 top frame, +0x50 action (1 enter, 2 wait entered, 3 next node,
5 running, 6 transition, 7 exit, 8 wait exited, 9 pop, 10/11 idle/aborted); Frame +0x08 state definition, +0x18
child; StateDef +0x08
std::stringid, +0x88/+0x90vector<Behavior*>(class names by RTTI). - Status: proven in game.
SwapTrack target — game+0x939410
- Address:
game+0x939410(0x140939410), inside theStates::SwapTrackhandlergame+0x9393B0. (One reading gives the state's function asgame+0x93CFD0, vtablegame+0x2D27730; the hook sites below are in0x9393B0.) - Kind: instruction hook on
mov rcx,[rip+...](bytes48 8B 0D 49 26 B7 02); also check the reads before it atgame+0x9393F9(mov r14d,[rax+0xB0], the descriptor's world id) andgame+0x939400(vmovaps xmm6,[rax+0xE0], its position). - Registers:
r14d= target world id,xmm6= arrival position,xmm7= heading (lane 0). - What it gets you: send a travel to any world id with any arrival pose. The state machine is in
swap_track(action 5) when it runs. - Conflicts: a track-import mod hooks this site and the next two; the platform chains them. Act only inside your own states.
- Status: proven in game, both ways, without the Storm Island DLC and without a restart.
Keep the save clean — game+0x9394F2 and game+0xA6CACD
A save that names a track id with no row in the unmodded game can't be loaded without your mod (6.2). Two hooks keep custom ids out of saves:
game+0x9394F2(0x1409394F2), instruction hook just aftermov [rbx+0x7C],r14d(check the bytes fromgame+0x9394E9:48 85 DB 74 04 44 89 73 7C 48 C7 45 DF 0F 00 00 00).rbx= the PlayerState and may be null. Write 542 back to+0x7C(LastTrackVisited), the arrival pose to+0x10/+0x20, and 0 to+0x30;restore_car_positionthen uses that pose.game+0xA6CACD(0x140A6CACD), instruction hook inside the vec4 property-getter thunkgame+0xA6CAC0(bytes40 53 48 83 EC 30 48 8B 41 08 48 8B DA 48 8D 54 24 20 49 8B C8 FF D0), beforemov rcx,r8; call rax.rax= the getter,r8= the object. Whenr8is the PlayerState andraxis the position gettergame+0x82B110(+0x10) or the facing gettergame+0x18DDCA0(+0x20), pointr8at a 16-byte-aligned stand-in holding a mainland pose. The save then stores that pose; the stock island crossing at (878.06, 3.87, -5613.72), facing (0, 0, 1), works. It answers every reader of those properties, so arm it only while the player is in your world.- Status: proven in game (saves taken in a custom world held LastTrackVisited 542 and the crossing's position).
RestorePointState.RestorePositionstill keeps the real position; what reads it is unknown.
Navigation world on travel — game+0x8AE7C4, game+0x8AE867
LoadNavigationWorld(game+0x8AE700) passes the flow's literal name to the.navloadergame+0x5E4460(component, name, ribbon). The island always passesTest03; a custom world reached by an unchanged flow gets Storm Island's navigation.- Call-site hooks:
game+0x8AE7C4(E8 97 5C D3 FF;rcx= navigation component,rdx= name,r8d= ribbon) for the.nav, andgame+0x8AE867(E8 24 8B B5 FF) for the.oww(loadergame+0x407390). Swap the name. - The loader formats
%s_%02dand usesgame:\media\tracks\%s\Ribbon_%02d\%s.navwhen the engine optionstreamaiopenworldis on, otherwisegame:\media\openworld\%s\%s.nav, with no fallback. - Status: the swapped
.navloads (proven in game); the call-site hooks themselves ran only in an older setup.
Entity groups after a race — game+0x50A2E0
- Address:
game+0x50A2E0(0x14050A2E0), the entity file loader. Kind: function hook. Byte check:48 8B C4 48 89 50 10 55 41 56 41 57. - What it gets you: swap one entity-group file name for another at load. After a race,
quit_racereloads free roam throughglobal.load_correct_offline_freeroam_entity_group, which on any id other than 549 loads the mainland'sentities_route_offline_freeroam.xmland drops your world's own group (its prompts, its minute save). Swapping that name while in your world fixes it. - Status: proven in game.
Boot world — game+0xD4ABB4
- Address:
game+0xD4ABB4(0x140D4ABB4), in the profile loadgame+0xD4A7C0. - Kind: instruction hook on
mov ebx,[rsi+0x7C]; cmp ebx,0x225(bytes8B 5E 7C 81 FB 25 02 00 00). - Registers:
rsi= the save's PlayerState (layout in 6.11). - What it gets you: write a world id and a pose into PlayerState before the game reads them, and the game boots into that world from any save. Writing 549 boots into Storm Island as a save that last visited it would.
- Gotchas:
- The session then saves like any visit to that world, and the next start boots there again.
- For 549, an ownership check follows (
game+0xD4ABB7-0xD4ABE4, asking the content manager at[game+0x34D5C38]). If the DLC is missing it falls back to 542 but keeps the position, so the car lands on the mainland at island coordinates. Other ids skip the check. Don't fake the check: that bypasses the DLC licence. - Cold starts ignore PlayerPosition: they exit the car meet into free roam (
enter_offline_car_meet_nice_boot). - Never write an id the unmodded game lacks unless the save hooks above put it back.
- Status: proven in game.
Map, minimap and loading screen in another world
The island's maps are picked only for 549. These sites make a custom world use the island's map set. Each is
optional and byte-checked; in a custom world, answer "island" (or put 549 in eax):
| Address | Kind | Bytes | What it picks |
|---|---|---|---|
game+0xB62A97 (0x140B62A97) | call site (island test) | E8 B4 36 73 FF 84 C0 | minimap profile hudIsland or hud |
game+0xDDC2CA (0x140DDC2CA) | call site | E8 81 9E 4B FF 84 C0 | pause menu map tile |
game+0x8AE667 (0x1408AE667) | call site | E8 E4 7A 9E FF 84 C0 | LoadMapProfileResources: island map textures in, mainland's out (game+0x8AE65E calls 0x296390 just before) |
game+0x93F191 (0x14093F191) | instruction | 3D 25 02 00 00 74 04 | SwitchOnActiveTrack's cmp eax,0x225: the full map |
game+0xD8703B (0x140D8703B) | instruction | 3D 25 02 00 00 48 8B 06 | MapScene's compare (never saw a custom id; not needed) |
Status: proven in game. Gotcha: SwitchOnActiveTrack (game+0x93F0F0) answers every flow that asks:
free-roam start, race flows, finals, bucket-list unlocks, car changes and the entity group choice. Answering "island"
for all of them made a circuit race show the island's orange "Scramble" label. Answer "island" only while a machine is
in show_map_scene (ui_screens) or its chain holds pause_menu_flow; the map's switch runs as show_map_scene is
entered, outside the update hook, so a pause-menu flag is needed too.
Other single compares that decide island behaviour, hooked the same way:
| Address | What | Status |
|---|---|---|
game+0x197B7E5 (0x14197B7E5) | time-of-day cmp eax,0x225: the island's lighting set | proven in game (chapter 9) |
game+0x2FB9A6 (0x1402FB9A6) | ForzaSimulation cmp eax,0x225: the island's weather presets | worked in game, left off by default |
game+0x5D832A, game+0x5D833D | route preload: treat the custom id as 549 for the branch, then pass the custom id as MediaTrack in r8 | proven in game (chapter 7); one reading names 0x5D8343 instead (offline) |
game+0x92EB56 (0x14092EB56) | island test in SetSpawnMode that turns traffic off on 549 | offline only |
Loading-screen video — game+0xCE76CE. The loading page (Scenes/Anthem/A_FMVLoading.xaml, constructor
game+0xCE7560) picks a video by round robin (counter game+0x351B650) from a table of {wide path, flag}
(island: game+0x1F3E048, else game+0x1F3E170); the flag drives the island watermark. An instruction hook at
game+0xCE76CE (check the 15 bytes from game+0xCE76C4: 41 0F B6 74 C0 08 49 8B 14 C0 48 8D 4C 24 68) can set
rdx to your own Media\UI\Videos\<name>.bk2 (served with set_file) and rsi to 0. The page is built in the
"enter" state before swap_track, so mark the trip from the stateflow hook, not on arrival. FH2 plays Bink 1 as well
as Bink 2, so the free RAD Video Tools are enough. Proven in game.
6.7 Add a custom world
A new world can be added without replacing the mainland or the island: new Tracks and Environments rows, the
world's files, a handful of hooks, and travel through the SwapTrack hooks above. A track-import mod has done this and
driven it end to end (proven in game); this section gives the game-side facts. File formats are in
chapter 10; the database in chapter 4.
The rows
- One
Tracksrow and oneEnvironmentsrow, added withadd_sqlas guardedINSERTs (insert only if the id is absent; never drop and recreate a table, see chapter 2). Copy Storm Island's rows (Tracks 549, Environments 77) and change what differs. MediaTrackmust equal the row's own id, or the resolver sends the id elsewhere.- Pick an unused id above the game's own (ids from 1061 to 9999 are clear of every stock row).
- A world loaded by an id that is neither 542 nor 549 touches neither world's statistics, needs no DLC, and leaves road discovery alone.
- Database changes count from the next launch, like every
add_sql.
Files: what the game will and won't find
| Fact | Status |
|---|---|
The base game mounts only archives listed in media\zipmanifest.xml. Adding entries crashed it at the title screen (the reader game+0xFD1600 doesn't check what it gets back); an override that grew made the game stop reading part-way. | proven in game |
Loose files open only if the start-up scan saw their name. CFileVolume::Exists answers from hash.manifest alone, so a file added after start-up, or missing from the listing, fails with "Failed to load" and no disk access at all. | proven in game |
Archives are mounted closed at start-up (one CCompressedVolume per .zip/.minizip, at the archive's path minus its extension) and opened lazily at the first world load. A pick made before a world's first load reaches every file. An archive name the real folder lacks can never be mounted later in the session. | proven in game |
A world's name is baked into its files: folder, file names, paths inside the .pvs (shaders and materials by full path) and, by hash, the chunk entries. A renamed copy doesn't load. | proven in game |
| An open world can't live under a virtual folder name, because its GeoChunk archives are pinned under the real name. A homespace-type world can. | proven in game |
Every world reads the one global media\Tracks\AnthemTrackSettings.xml (loader game+0x1330AC0); per-track TrackSettings.xml files are dead in FH2. | offline only, confirmed by file logs |
Trigger-zone families are fixed loose files per world (tz_weatherchance, tz_cubemapscenes, tz_dynamicpost, tz_waterreflection, tz_fogdisable); rain zones are chunk entries, not loose files. A 34-byte <triggerzones></triggerzones> stub loads cleanly. | offline only, plus logs |
Zip discovery patch — game+0xFD1666
- Address:
game+0xFD1666(0x140FD1666), in the zip list readergame+0xFD1600. - Kind: byte patch (6 bytes),
api->patch_bytes: expect0F 85 CA 03 00 00(jne +0x3CA), write90 E9 CA 03 00 00(nop; jmp +0x3CA). - What it does: the reader finds archives by scanning folders when a setting is on, which is how the Storm Island package (which has no list) gets its archives. The unconditional jump makes the base game scan too, so a new world's archives are found.
- Timing: the patch must land before the game's first read of
zipmanifest.xml, which comes 64-150 ms after the code is ready: sooner than a platform mod can usually patch. The working approach held the game's reads underMount\media\(at most 3 s) with anNtCreateFilehook until the patch was in, skipping the platform loader thread's own reads. A late patch means the world's archives are not mounted and the game crashes about 3 s into loading. An Extra Options plugin patching from its initialise call may be early enough (unconfirmed). - Status: proven in game.
CFileVolume::Exists — game+0x11F9D30
- Address:
game+0x11F9D30(0x1411F9D30). Kind: function hook. - Signature:
bool(volume, const std::string* path, bool absolutize /*r8b*/, bool use_cache /*r9b*/);pathis undergame:\, for examplemedia\tracks\<world>\ribbon_00\collobjs.xml. - What it gets you: call the original with
use_cache= 0 for your world's paths, and the check goes to the disk (GetFileAttributesExA) instead ofhash.manifest.CFileSys::Existsisgame+0x11F9C80. - Byte check:
48 8B C4 55 41 56 41 57 48 8D 68 D8 48 81 EC 10 01 00 00. - Gotcha, speed: free-roam car loads make 4,000-6,200 calls per long frame, each checked in every overlay folder (Azimuth, Extra Options, the platform). A slow detour causes 50-120 ms stutters; answer from a per-folder list built once.
- Status: proven in game.
A virtual world folder (homespace route)
The route that worked keeps the world under a name that doesn't exist on disk, a twin of homespace02 with the same
length and homespace in it, and redirects at the Windows file layer:
- Hooks on
NtQueryDirectoryFile(Ex),NtCreateFile,NtOpenFile,NtQueryAttributesFile,NtQueryFullAttributesFileandNtClose(to follow folder handles). Through the platform, hook thentdllexports withhook_function; they are not game code and need nowait_for_code. - Add the folder to listings of
media\tracks(append entries atSTATUS_NO_MORE_FILES), and list its files under the virtual names: the start-up scan must see them. Hide files only, never folders: Azimuth stops if a folder it listed can't be opened. - Map paths under the virtual name to the base studio folder plus your own folder, and serve your own files (for
example a renamed
<name>_00.nav). - Serve a copy of the
.pvswith the folder name changed in place. Keep virtual and real names the same length, so no length or offset in the file moves. A.pvsnaming the other folder's materials drew every surface black. - Without
homespacein the name the world takes the open-world path and nothing draws. - Lookups ignore case (the game asks for
ribbon_00\...though the format string saysRibbon_).
GetModelFixupHandler — game+0x13887C0
- Address:
game+0x13887C0(0x1413887C0). Kind: function hook. Signature:handler*(tp). - Code (24 bytes, the byte check):
80 B9 D0 AA 00 00 00 48 8D 81 18 AA 01 00 75 07 48 8D 05 81 81 B3 01 C3: a homespace gets its own TP's handler (TP+0x1AA18), other worlds the shared handler atgame+0x2EC0958(owner pointergame+0x2EC0960, re-pointed per world). - The bug it fixes: material resources are cached globally by lower-case path (create
game+0x10D2B50, findgame+0x10D3140) and outlive the TP. Loading one folder as a world and again as the Buy Car or car-meet studio in one session calls a freed handler: crash atgame+0x4FAB4F(mov rax,[rcx]; jmp [rax+0x10], fromgame+0x10E1B6E). The stock studio loaded as a world crashes the same way. - Fix: return a mod-owned object
{vtable game+0x2EC2388, owner = TP+0x1AA20}that never dies, and clear its owner in the unload and destructor hooks. The handler's three slots (game+0x13A8D80,0x13A8CC0,0x13A8D20) use only the owner at +8. - Status: proven in game.
Other parts a custom world needs
- Underworld (the stand-in terrain far below): loader
game+0x133DB50runs for every world, listsmedia\tracks\<name>Underground\*.modelbin, takes the first entry, and with none does nothing, silently. The name is passed as astd::stringby value; at 16 characters or more it is heap-stored and the world gets no underworld (offline only). Aliasing another world's<name>underground.zipworks (proven in game), but the mainland's stand-in terrain rises hundreds of metres in places and pokes through a foreign track. - Navigation (
.nav): its build hash (u32 at file offset 8 and again in the trailer) ties it to the save's road-discovery record for the world slot. A.navwith another hash loaded in an existing slot clears the player's discovered roads there next time; reuse the slot's hash (island0x9A790429, mainland0xFA38F25E). Roads withroad_type=nonetake no part in discovery, XP or the map. In a third id no discovery component attaches. Offline only (the fix was applied before any run). - Cells (
.hex): every point of the drivable area must fall in a hex slot whose cell keys a placement, and the.pvsgrid must contain the world; otherwise the game hangs or draws nothing (proven in game). See also the 60 s wait in 6.3. - Rewards scene: a homespace world never streams cinematic zones (6.3).
- Entity groups and stateflow: add your enter and return states to an override of
stateflow\track_swap_flow.xml, give the mainland group a copy of the island crossing's trigger and prompt (built from the stockisland_activationentities: a prompt left withTitleStringIDemptythrew "string too long" atgame+0x7A1590), end the enter state with the world's entity-group load, and let a state autostarted by the new group do the arrival (a state that loads a new group kills itself before the fade-in). Copy the minute savemicro_save_continuousinto your route group or nothing saves there. Afterswap_track, runglobal.start_race: SwapTrack resets the race session and the car never takes input otherwise. All proven in game. - Island arrival points are data:
EntityModel.zip\entities_offline_freeroam.xml(island_activation, WorldPosition 8729.18, 86.49, -1133.23, rotation 225) andstateflow.zip\island_ie.xml; the return trip is inentities_offline_freeroam_island.xml(to 878.06, 3.87, -5613.72).
What still needs a restart
A new world folder (names go into the start-up scan), an archive name the real folder lacks, anything through the
database or set_file (races, map pictures, the way back's position), the virtual name and the world id. Switching
which track sits behind one world name during a session is unsafe: the closed archive keeps its old directory size
and entry count (see 6.8), archives stay open for 30 s or more after use,
and material resources are found again by path. The safe design gives each track its own world name and id, tied the
first time the car travels there (unconfirmed: designed, not run).
6.8 Archives, streaming and the file cache
The file cache — [game+0x36614A8]
- Address: the global at
game+0x36614A8(0x1436614A8) points at the I/O file cache:+0x00capacity (u64),+0x08bytes in use,+0x10chunk count,+0x18lock. - What the game does: the cache is made once at boot (
game+0x11F6580, called from the I/O setup atgame+0xF64C41) with the engine optionfilecachesize: 210 MiB, rounded up to 64 KiB. The FileChunk gettergame+0x11F7BF0takes room for each group's compressed bytes throughgame+0x11E6490->game+0x11E63C0, which refuses when in-use + size > capacity, without asking for memory. After three tries at freeing unused chunks (game+0x11EBD40) the getter returns null and the game logsFailed to load FileChunk: N ... (FileChunk Resources). Loaded chunks stay held; each read counts its size rounded up to 4 KiB plus 4 KiB. - What a write gets you: once the pointer is non-null, one aligned 8-byte write of a larger capacity. 1,024 MiB removed every FileChunk failure on a large track; the game then fills the room it has and evicts. Never lower it. The allocator compares under the cache's lock, so a single aligned store is safe.
- Symptoms of a cache too small: "Failed to load FileChunk" for every later group, and models that draw as their record's box. Memory itself was never the limit.
- Status: proven in game. The stock worlds log their own FileChunk failures even unmodded (about 537 per mainland run, 336 per island run); ignore those.
// Raise the file cache (game thread or your own thread, after wait_for_code).
auto cache = *reinterpret_cast<uint64_t* volatile*>(game + 0x36614A8);
if (cache && cache[0] < (1024ull << 20)) cache[0] = 1024ull << 20; // never lower it
The engine options object (game+0x34AF7D0, getter game+0x295940, defaults game+0xF692B0) holds
filecachesize at +0x2454, filechunksize (1 MiB) at +0x2458 and streamsize (1,300 MiB) at +0x2444. streamsize
is a soft budget (game+0xFAE610): raising it does nothing for FileChunk failures. Offline only.
Archive volumes (CCompressedVolume)
| Address | What |
|---|---|
game+0x11DFDA0 | constructor; object 0x1E8 bytes, vtable game+0x2EAD838 |
game+0x11F6780 | Open (lazy): returns at once if open (cmp qword [rbx+0x120],-1 at game+0x11F67BF), else CreateFile2 |
game+0x11F2230 | header reader: .minizip reads 4 KiB at 0; .zip reads the end record at exactly EOF - 22 (no zip comment) |
game+0x12044F0 | close: frees, sets the handle to -1, does not clear the directory start, size and count |
game+0x11E88A0 | "may it close": no pending job, no file open, idle more than 30,000 ms (or forced) |
Status: offline only, read by two independent readers. Hooking Open is expensive: it runs on every file opened
inside every archive. Re-reading a changed archive under the same name would need the directory numbers zeroed when it
reopens (an instruction hook at game+0x11F67BF; unconfirmed).
GeoChunk files must be a multiple of 4,096 bytes. All 40 stock ones are. A rebuilt chunk padded only to 512 bytes
failed its last group every time ("Failed to load FileChunk", the read running past the end by
4096 - size mod 4096). An entry inserted inside a group, or appended without a group of its own, crashes in zlib at
game+0x37DB. Proven in game.
Chunk keys are (type << 24) | index: see the table in 6.11.
Streamed generic objects register a handler per type with streamer->vfunc[0x188](type, handler) in
ForzaSimulation setup (game+0x2E4190, re-setup game+0x2EE640): type 8 triggers, 9 soundscape tiles, 10 sound
banks, and 13 ambient-occlusion tiles (game+0x138C990). An entry loads when a PVSZ cell lists its record.
6.9 Diagnostics for world work
"Failed to load" logger — game+0x263E50
- Address:
game+0x263E50(0x140263E50),std::string operator+(ret, lhs, rhs). Kind: function hook. - What it gets you: the retail build builds every load-failure message and throws it away. It is built with four
joins:
"Failed to load " + name,+ " (",+ category,+ ")". Log results that start withFailed to loadwhen the right-hand side is")", and you get one line per failed load (categories: File, Texture, XML, FileChunk, Common Model, Vertex Shader, State Machine Resources). - Gotchas: every string join in the game passes through here; keep the detour tiny and guard against re-entry. There is no timestamp in the message.
- Status: proven in game (about 94 runs, 42,077 messages, every one four joins).
Stock failures you will see in an unmodded run, and can ignore: nerdconfig.ini, templates_autoshow.xml, three
livery decals, twelve carPaint ... Morphing.durango.vso, some swatches, tires.xml, surfacechanges.xml,
homespace02\tdaosettings.bin, <world>\collobjtypes.xml in every world, and the worlds' own FileChunk failures.
Other diagnostic sites
| Address | Kind | Use | Status |
|---|---|---|---|
game+0x11FC9E0 (0x1411FC9E0) | function | chunk entry reader (entry, dst, size): entry +0x40 progress, +0x44 method, +0x48 size, +0x50 offset | in game (logging) |
game+0x19281E0 (0x1419281E0) | function | stateflow update: log state changes, spot hangs | proven in game |
game+0x10F484D (0x1410F484D) | call site | the game's one DXGIXPresentArray call (E8 76 E0 89 00): frame timing; import slot game+0x1DD0F08 as a fallback | in game (logging) |
NtReadFile | function (ntdll) | each GeoChunk read's offset and length | in game (logging) |
Logging overlay roots is a trap: the game asks every overlay root (Extra Options, the platform, car packs) about every file, so thousands of "missing" lines are normal and can fill a fixed-size log before the interesting part.
Crashes you may meet
| Crash at | Cause | Fix |
|---|---|---|
game+0x13E2A10 (reads +0x18) | the world's .pvs was never served: not in the start-up listing, or hooks not made | serve the file under a listed name |
game+0x4FAB4F | a cached material calling a freed model fixup handler | the lasting handler (6.7) |
game+0x37DB (zlib) | a chunk entry outside its group | give appended entries their own group |
game+0x369029 | notes about a procedural library outliving it | forget notes in Serialize |
game+0x7A1590 / game+0xB282D0 | a prompt's TitleStringID left as empty ("string too long") | build prompts from stock entities |
| title screen, in the zip list reader | zipmanifest.xml edited | use the scan patch instead |
| ~3 s into loading | the zip-scan patch came too late | hold the game's media reads until it is in |
More in chapter 13.
6.10 Master table of this chapter's addresses
Sites to hook, patch or call, and the data a mod writes. Read-only addresses are given in their sections above. Status: P = proven in game, I = ran in game as a logging hook, O = offline only, U = unconfirmed.
| RVA | Full address | Name | Kind | Status |
|---|---|---|---|---|
game+0x17D060 | 0x14017D060 | travel descriptor table (542 and 549 only) | data | O |
game+0x263E50 | 0x140263E50 | std::string operator+ (Failed to load logger) | function | P |
game+0x296150 | 0x140296150 | is the island (id == 549) | call / call sites | P |
game+0x2FB9A6 | 0x1402FB9A6 | ForzaSimulation island compare (weather presets) | instruction | P |
game+0x368C60 | 0x140368C60 | CWorldCollObjMan::MakeDynamic | function | P |
game+0x368D90 | 0x140368D90 | CWorldCollObjMan::SpawnCell | function | P |
game+0x369690 | 0x140369690 | SpawnObject | call | P |
game+0x369E80 | 0x140369E80 | AddPhysics | call | P |
game+0x36A330 | 0x14036A330 | CWorldCollObjMan::AddCell | function | P |
game+0x36AC80 | 0x14036AC80 | CWorldCollObjMan::BreakIntoPieces | function | P |
game+0x36AEAC | 0x14036AEAC | BreakIntoPieces model pick | instruction | P |
game+0x377340 | 0x140377340 | BindModel | call | P |
game+0x37A7D0 | 0x14037A7D0 | RecycleSlot | call | P |
game+0x3820C0 | 0x1403820C0 | SpawnEffect | call | P |
game+0x382F20 | 0x140382F20 | CWorldCollObjMan shutdown | function | U |
game+0x384C00 | 0x140384C00 | CWorldCollObjMan::Update | function | P |
game+0x50A2E0 | 0x14050A2E0 | entity file loader | function | P |
game+0x5D832A | 0x1405D832A | route preload, branch on the island | instruction | P |
game+0x5D833D | 0x1405D833D | route preload, MediaTrack in r8 | instruction | P |
game+0x5E4460 | 0x1405E4460 | .nav loader | call target | P |
game+0x8AE7C4 | 0x1408AE7C4 | LoadNavigationWorld -> .nav loader | call site | P |
game+0x8AE867 | 0x1408AE867 | LoadNavigationWorld -> .oww loader | call site | P |
game+0x8AE667 | 0x1408AE667 | LoadMapProfileResources island test | call site | P |
game+0x939410 | 0x140939410 | SwapTrack target and pose | instruction | P |
game+0x9394F2 | 0x1409394F2 | SwapTrack after the LastTrackVisited write | instruction | P |
game+0x93F191 | 0x14093F191 | SwitchOnActiveTrack island compare | instruction | P |
game+0xA6CACD | 0x140A6CACD | vec4 property getter thunk | instruction | P |
game+0xB62A97 | 0x140B62A97 | minimap set-up island test | call site | P |
game+0xCE76CE | 0x140CE76CE | loading-screen video pick | instruction | P |
game+0xD4ABB4 | 0x140D4ABB4 | profile load: boot world | instruction | P |
game+0xD8703B | 0x140D8703B | MapScene island compare | instruction | P |
game+0xDDC2CA | 0x140DDC2CA | pause menu map tile island test | call site | P |
game+0xF5DB40 | 0x140F5DB40 | car reset target | function | P |
game+0xFD1666 | 0x140FD1666 | zip-scan byte patch | byte patch | P |
game+0xFDAA20 | 0x140FDAA20 | track id resolver | read | O |
game+0x10F484D | 0x1410F484D | DXGIXPresentArray call | call site | I |
game+0x11F9D30 | 0x1411F9D30 | CFileVolume::Exists | function | P |
game+0x11FC9E0 | 0x1411FC9E0 | chunk entry reader | function | I |
game+0x126E020 | 0x14126E020 | NameHash | call | P |
game+0x12B2500 | 0x1412B2500 | collision instance template load | function | P |
game+0x12CC010 | 0x1412CC010 | collision definition lookup | function | P |
game+0x12CC1A0 | 0x1412CC1A0 | collision template grid query | function | P |
game+0x12CC730 | 0x1412CC730 | CollisionWorld::GetPolys | function | P |
game+0x12CD300 | 0x1412CD300 | definition render model | function | P |
game+0x12D3D30 | 0x1412D3D30 | CollisionWorld valid-region test | function | P |
game+0x13079A0 | 0x1413079A0 | TP tick: streaming wait (gives up at 0x1307AC0) | read | P |
game+0x132B390 | 0x14132B390 | BindCollObjInstanceToModel | function | P |
game+0x133B580 | 0x14133B580 | position inside the current cell | read | O |
game+0x133DEDF | 0x14133DEDF | track loader: homespace flag store | instruction | P |
game+0x1377B50 | 0x141377B50 | TrackPresentation11 destructor | function | P |
game+0x137BB40 | 0x14137BB40 | TP cell unload (vtable +0x288) | slot | O |
game+0x1385857 | 0x141385857 | TrackPresentation unload | instruction | P |
game+0x13887C0 | 0x1413887C0 | GetModelFixupHandler | function | P |
game+0x139AC40 | 0x14139AC40 | TP cell load (vtable +0x280) | slot | O |
game+0x13A41E0 | 0x1413A41E0 | render node update and placement draw | function | P |
game+0x1871B90 | 0x141871B90 | ProceduralModelsData::Serialize | function | P |
game+0x1874600 | 0x141874600 | decode a procedural instance | call | P |
game+0x1881EC0 | 0x141881EC0 | vector<Group>::resize | call | P |
game+0x19281E0 | 0x1419281E0 | stateflow state machine update | function | P |
game+0x197B7E5 | 0x14197B7E5 | time of day island compare | instruction | P |
game+0x2C6A208 | 0x142C6A208 | CWorldCollObj vtable, slot 0 OnCollision | slot | P |
game+0x2D4BC60 | 0x142D4BC60 | Destruction skill Load slot (also Lumberjack, Sideswipe) | slot | P |
game+0x2EC23D8 | 0x142EC23D8 | TrackPresentation11 vtable | data | P |
game+0x365AD70 | 0x14365AD70 | TrackSwapManager pointer | data | O |
game+0x36614A8 | 0x1436614A8 | file cache pointer | data write | P |
6.11 Structures and offsets for this system
General layouts (MSVC 2012 std::string, std::vector, RTTI) are in chapter 11. All offsets
below are offline readings unless a section above says they were used in game.
TrackPresentation11 (TP)
| Offset | Meaning |
|---|---|
| +0x38 + slot*8 | dynamic model instance for a render slot |
| +0x8090 | load-time countdown |
| +0x8094 | byte: not ready (inside-cell test fails) |
| +0x80F8 | underworld model instance |
| +0x8110 | the track settings copy (getter game+0x1304D00, vtable +0xA0); +0x164 GrassFadeStartDistance, +0x43C skyScale |
| +0xAAB0 | world name, MSVC std::string (Anthem, Test03) |
| +0xAAD0 | homespace flag (u8) |
| +0xAB70 | pinned GeoChunk volumes (open worlds only) |
| +0xF618 | model objects by model number; entry +8 = resource, null if not loaded |
| +0xF630 | render nodes; index = count(+0xFB78) + count(+0xFBC0) + slot |
| +0xF7E0 | zone topography (CHexZoneTopography, vtable game+0x2F5AA88) |
| +0xFB10 | the embedded .pvs object |
| +0xFB78 | placements, 0x70 bytes each: +0x10 model, +0x22 animation binding, +0x24 u8 refcount, +0x30 LOD halfs, +0x38 position, +0x44 nine halfs of rotation |
| +0xFB90 | root collision table |
| +0xFBA8 | per-model records, 0x90 bytes each: +0x50 texture list, +0x6C four LOD model ids (u32), +0x7C flags |
| +0xFBC0 | second placement list (streamed instances) |
| +0x10BC, +0x10C0, +0x10C8 | streaming wait: active byte, tracked position, start time |
| +0x15618 | the world's CollisionWorld |
| +0x19518 / +0x19570 | current cells (22 ids) / new cells |
| +0x1AA18 | the TP's own ModelFixupHandler11; +0x1AA20 its owner |
| +0x1ABD0 | ambient-occlusion object (TrackAmbientOcclusion) |
Vtable game+0x2EC23D8 slots seen: +0xA0 settings getter, +0x1B8 cinematic zone request, +0x280 cell load, +0x288
cell unload, +0x300 per-view scene draw (game+0x139D720). CTrackPresentation (vtable game+0x2EB8590) is reached
as CPresentation+0x38; find it by checking its vectors rather than the vtable.
.pvs header counts and what they size
| File offset | Meaning | Rule |
|---|---|---|
| +0x10 | procedural (pgeo) count | sizes the procedural tables |
| +0x14 | record-id space (max object id + 1) | raise it when you add streamed objects |
| +0x18 | objects count | |
| +0x1C | max ids per cell | must be at least the real per-cell maximum |
| +0x20 | max records per cell | must be at least the real per-cell maximum; larger is harmless |
Chunk key types (GeoChunk key = type << 24 | index)
| Type | Content | Type | Content |
|---|---|---|---|
| 0x00 | pgeo (procedurals) | 0x08 | trigger zones (incl. rain zones) |
| 0x01 | .phys ground tiles | 0x09 | AudioTile XML |
| 0x03 | LBWO AI tiles | 0x0A | FMOD bank |
| 0x04 | models | 0x0B | PVSL (lights) |
| 0x05 | textures (idx*16 + piece) | 0x0C | PVSZ (cells) |
| 0x07 | skeletons | 0x0D | ambient-occlusion tiles |
CWorldCollObjMan, CWorldCollObj and definitions
| Manager offset | Meaning | Object offset | Meaning |
|---|---|---|---|
| +0x10 | deferred presentation (real one at +0x38 of it) | +0x08 | body |
| +0x290 | slots vector (4,096) | +0x40 | manager |
| +0x4C8 | definition table | +0xA0 | position |
| +0x4F0 | car-in-view position | +0xB0 / +0xB4 | x and z it broke from |
| +0x508 | free set (value at node+0x1C) | +0xB8 | key (16 bytes) |
| +0x510 | free count | +0xC0 / +0xC4 | procedural / child |
| +0x518 | cells, 0x40 bytes: +0x20 provider, +0x28 procedural id, +0x30 count | +0x124 | definition id; +0x120 fade (half float, 0x4000 = 2 s); +0x148 state (5 = loose piece) |
Definition (CCollObjPhysicsDefinition, vtable game+0x2EB5BD8, 0xF0 bytes): +0x08 inertia, +0x2C inverse inertia,
+0x50 half extents, +0x5C box centre, +0x68 centre of mass (GraphicsOffset), +0x80 shapes, +0x88 children, +0x90
shape count, +0x94 NumChildren, +0x98 BoundingRadius, +0x9C Mass, +0xA0 surface, +0xA8 RenderModelIndex, +0xAC
VisibleDistance, +0xB0 BreakSpeedMph, +0xC0 UniqueIndex, +0xC4 name hash, +0xC8 ObjectTypeIndex (5 = LogPiles), +0xC9
break effect, +0xCA MeshIndex, +0xCC LowSpeedBehaviour. Serialisers: definitions game+0x12DAEE0, shapes
game+0x12DCC80. Shapes: a type byte (0 sphere, 1 box, 2 convex hull, 5 point cloud) and a flags byte (bit 0 =
collides); a box is 0x60 bytes (matrix +0x10, half extents +0x50); a point cloud has its pointer at +8 and count at
+0x10.
Procedural data: +0x00 library name, +0x20 event ids, +0x60 groups (Group, 0x1C bytes: def, model, start, count,
bbBatch, bbStart, bbCount), +0x88 billboards, +0xA0 3D batches (0x58 bytes: +0 instances of 0x20, +0x30 name, +0x50
render data). Provider: +0x18 name, +0x58 procedural index, +0xF8 data.
Collision triangles
Template query and GetPolys output, 32 bytes per triangle:
| Offset | Meaning |
|---|---|
| +0x00 | flags byte (must share a bit with the query's flags; cameras ask with 0x04) |
| +0x01 | surface |
| +0x02 | u16 |
| +0x04 / +0x08 / +0x0C | vertex indices into a vec4 array (vertex w = packed normal) |
| +0x10 | face normal (vec4) |
CollisionValidRegion: 0x30 bytes, two vectors of 32-byte boxes {min x, y, z, pad, max x, y, z, pad}.
PlayerState (the save's state in memory)
| Offset | Meaning |
|---|---|
| +0x10 | PlayerPosition (vec4, w 1) |
| +0x20 | PlayerFacing (forward vector, y up, w 0; a heading of t degrees is (sin t, 0, cos t)) |
| +0x30 | byte: non-zero turns the car along the nearest road first |
| +0x7C | LastTrackVisited (int): the boot world |
Archive volume (CCompressedVolume, 0x1E8 bytes)
| Offset | Meaning |
|---|---|
| +0x28 | file path (std::string) |
| +0x48 | mount path |
| +0x118 | files open inside the archive |
| +0x120 | file handle, -1 when closed |
| +0x130 / +0x134 / +0x138 | directory start / size / entry count (kept across a close) |
| +0x140 | 1 for a .minizip |
| +0x170 | pending job |
| +0x1A0 | GetTickCount of last use |
| +0x1A8 / +0x1C8 | directory entries (40 bytes) / blocks (80 bytes; cached chunk at +0x28) |
