Navigation
Browse the developer docs

FH2 Modding Guide · Chapter 6

Hook reference: the world

Tracks, streaming, switching worlds, collision and breakable objects.

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

On this page

This chapter lists the game code behind 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

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:

StatusMeaning
Proven in gameA released mod, or a logged test run, used it and it worked.
Offline onlyRead from the exe with a disassembler, or checked against the game's files or an offline harness. Never seen running.
UnconfirmedA 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?

GoalStart withSection
Know which world is loading or has gonetrack loader game+0x133DEDF, destructor game+0x1377B506.3
Know when an area's cells or objects stream inCWorldCollObjMan::AddCell game+0x36A330, cell loader game+0x139AC406.3
Make trees, bushes, fences or clutter breakableProceduralModelsData::Serialize game+0x1871B90 and friends6.4
Add collision (walls, pylons, a whole track)CollisionWorld::GetPolys game+0x12CC7306.5
Remove collision from a template (trunks, walls)template grid query game+0x12CC1A06.5
Let a car drive outside the streamed areavalid-region test game+0x12D3D306.5
Send a travel somewhere elseSwapTrack instruction game+0x9394106.6
Choose the world a save boots intoprofile load game+0xD4ABB46.6
Show the island's maps in another worldfive island-test sites6.6
Add a whole new worldtwo database rows, the zip-scan patch, file hooks6.7
Stop "Failed to load FileChunk"the file cache capacity [game+0x36614A8]6.8
See every file load that failedstd::string operator+ game+0x263E506.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 idMediaNameWorld
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\
308HomeSpace02 (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). Starts 48 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) and game+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:

OffsetMeaning
+0x08current track id (int32); getter game+0x9247B0 (mov eax,[rcx+8]; ret)
+0x0Ctarget track id
+0x14state
+0x20arrival position
+0x30arrival 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 runs SELECT MediaTrack FROM Tracks WHERE Id=%d and keeps the row's MediaTrack.
  • Why it matters: a world of your own needs MediaTrack equal to its own id, or it resolves to another world. Note that Storm Island's own row has MediaTrack 542; it never goes through this query.
  • Gotcha: with no row, the record set's integer reader (game+0x1090E80, through game+0x10908C0) returns its preset 0x7FFFFFFF, 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 0x2F instead 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 at game+0x1341190 skips its whole zone block at game+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 loader game+0x133DE30 (0x14133DE30).
  • Kind: instruction hook on mov [rsi+0xAAD0],al (bytes 88 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::string at TP+0xAAB0 (32 bytes; check capacity at +0x18 before reading inline text, see chapter 11): Anthem on the mainland, Test03 on Storm Island.
  • Disagreement: one reading puts the flag set at game+0x133DECD; that is the compare (a case-insensitive stristr-style call at game+0x1089A80). game+0x133DEDF is the store and the one that has been hooked.
  • Status: proven in game.

TrackPresentation unload — game+0x1385857

  • Address: game+0x1385857 (0x141385857), in the unload routine game+0x1385760.
  • Kind: instruction hook on mov [rdi+0x1AA20],rcx (bytes 48 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 is game+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 the lea at +0x28 points at the vtable game+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:

AddressWhatKindStatus
game+0x36A330 (0x14036A330)CWorldCollObjMan::AddCell: a streamed cell's procedural objects arrivefunctionproven in game (WreckingBall, 6.4)
game+0x368D90 (0x140368D90)CWorldCollObjMan::SpawnCellfunctionproven in game (WreckingBall, logging)
game+0x139AC40 (0x14139AC40)TP vtable +0x280: cell load (also the cinematic zone change event)slot or functionoffline only
game+0x137BB40 (0x14137BB40)TP vtable +0x288: cell unloadslot or functionoffline only
game+0x1359640 (0x141359640)loop over a cell's records: type 0x00 load and activate, 0x80 prefetchreadoffline 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+0x1341AFBreadoffline only
game+0x1871B90 (0x141871B90)ProceduralModelsData::Serialize: a procedural library (trees, fences) loadsfunctionproven 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 (or TP+0x19570 before byte TP+0x18231 is set); TP+0x19518 is a list of 22 ids merged from two trackers at TP+0x190F0 and TP+0x19300.
  • CWorldCollObjMan+0x4F0 holds the position the world's objects stream around (the car in view), stored by its update at game+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.

AddressWhatStatus
game+0x17402A0 -> game+0x13302C0zone request; an id not in the world's map is silently droppedoffline only, consequence proven in game
game+0x1746810"zone ready": a missing id counts as not ready, with no timeoutoffline 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 at game+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 .hex slot whose cell's own hexagon is elsewhere. It is not navigation; the .nav plays 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, hook game+0x133B580 to 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, vtable game+0x2F5A300) place thousands of instances of one kind: TREEANDBUSHTEMPLATE holds trees and bushes, BARRIERTEMPLATE fences and railings.
  • CWorldCollObjMan manages world collision objects: static until hit, then made dynamic, broken into pieces and cleaned up. CWorldCollObj (vtable game+0x2C6A208) is one object; slot 0 is OnCollision.
  • 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+0x60 with the game's own vector<Group>::resize (game+0x1881EC0, so the game's allocator is used), then writes one 0x1C-byte Group per 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+0x369029 was 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 is ProceduralModels), 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 model game+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; piece 0xFFFF = the whole object. The table's list is at table+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 bodies 0xF080-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 is game+0x378230).
  • Kind: slot (hook_pointer). Signature: void(obj, contact).
  • Arguments: contact+8 has a vtable; +0x38 is the other party's type (1 = car) and +0x40 returns car+0x10. The car's dynamics are at car+0x4C08; GetVelocity is its vtable +0x288, SetVelocity +0x290 (game+0x12E3CF0). car+0x4D08 is 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 check 40 57 48 83 EC 40. holder+0x28 = the resource (StreamedPhysics::CollisionTemplateResource, vtable game+0x2EB43C0), +0x30 = the template. The resource's name string is at res+0xC0; procphys in 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 check 48 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 check 48 8B C4 48 89 50 10 48 89 48 08 55. The game spawns one loose piece per child of the definition at obj+0x124. For a tree whose pieces aren't streamed in, WreckingBall swaps obj+0x124 to a fallback tree that is resident for the call, then puts it back.
  • Model pick: instruction hook at game+0x36AEAC (0x14036AEAC), bytes 48 8D 4D C0 48 89 4C 24 20. r15 = the object, r14 = the manager, eax = the model about to be bound. Write eax to keep the original's look; the procedural's own model is reached by batch+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::BindCollObjInstanceToModel game+0x132B390 (0x14132B390), uint64(tp, int slot, int model, const float* m, void* key). Check that CTrackPresentation vtable (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 check 48 8B C4 44 89 48 20 4C 89 40 18. The node's world matrix is at node+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

AddressNameArguments 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.

SkillVtableSlot addressOriginal
Destructiongame+0x2D4BBF0game+0x2D4BC60game+0xA81770
Lumberjackgame+0x2D4BA28game+0x2D4BA98game+0xA81930
Sideswipegame+0x2D4B270game+0x2D4B2E0game+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_getPolys for 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 flags is skipped. Cameras query with flag 0x04 (the call at game+0x12BB312), so collision without bit 0x04 is ignored by cameras: about 7 % of queries in one run.
    • Vertex w is a packed normal. With UseVertexNormals TRUE in PhysicsSettings.ini the wheel contact (game+0x12B8230) reads each vertex's w as 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.0 made every contact normal point straight up and cars bounced down every hill.
    • Compound worlds ask each child. CollWorldAll::GetPolys (the cars' query) and CompoundCollisionWorld::GetPolys pass the same box to each child world, so a hook on this function hands out its triangles once per child. Filter on world if duplicates matter.
  • 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), CollisionWorld vtable (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 is game+0x12507D0.
  • Where the regions come from: game+0x135B250 builds a CollisionValidRegion (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 through game+0x131C260 and game+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, and game+0x132D540 instantiates only requested roots. No entries means no ground. Proven in game.
  • CollObjs.xml is never parsed in FH2: its path appears only in a prefetch list (game+0x2D8710). Every stock copy is stubs. CollObjTypes.xml is asked for in every world and exists in none ("Failed to load" is normal).
  • Physics definitions are loaded by ForzaSimulation vtable 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 at game+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::string id, +0x88/+0x90 vector<Behavior*> (class names by RTTI).
  • Status: proven in game.

SwapTrack target — game+0x939410

  • Address: game+0x939410 (0x140939410), inside the States::SwapTrack handler game+0x9393B0. (One reading gives the state's function as game+0x93CFD0, vtable game+0x2D27730; the hook sites below are in 0x9393B0.)
  • Kind: instruction hook on mov rcx,[rip+...] (bytes 48 8B 0D 49 26 B7 02); also check the reads before it at game+0x9393F9 (mov r14d,[rax+0xB0], the descriptor's world id) and game+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 after mov [rbx+0x7C],r14d (check the bytes from game+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_position then uses that pose.
  • game+0xA6CACD (0x140A6CACD), instruction hook inside the vec4 property-getter thunk game+0xA6CAC0 (bytes 40 53 48 83 EC 30 48 8B 41 08 48 8B DA 48 8D 54 24 20 49 8B C8 FF D0), before mov rcx,r8; call rax. rax = the getter, r8 = the object. When r8 is the PlayerState and rax is the position getter game+0x82B110 (+0x10) or the facing getter game+0x18DDCA0 (+0x20), point r8 at 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.RestorePosition still keeps the real position; what reads it is unknown.
  • LoadNavigationWorld (game+0x8AE700) passes the flow's literal name to the .nav loader game+0x5E4460 (component, name, ribbon). The island always passes Test03; 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, and game+0x8AE867 (E8 24 8B B5 FF) for the .oww (loader game+0x407390). Swap the name.
  • The loader formats %s_%02d and uses game:\media\tracks\%s\Ribbon_%02d\%s.nav when the engine option streamaiopenworld is on, otherwise game:\media\openworld\%s\%s.nav, with no fallback.
  • Status: the swapped .nav loads (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_race reloads free roam through global.load_correct_offline_freeroam_entity_group, which on any id other than 549 loads the mainland's entities_route_offline_freeroam.xml and 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 load game+0xD4A7C0.
  • Kind: instruction hook on mov ebx,[rsi+0x7C]; cmp ebx,0x225 (bytes 8B 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):

AddressKindBytesWhat it picks
game+0xB62A97 (0x140B62A97)call site (island test)E8 B4 36 73 FF 84 C0minimap profile hudIsland or hud
game+0xDDC2CA (0x140DDC2CA)call siteE8 81 9E 4B FF 84 C0pause menu map tile
game+0x8AE667 (0x1408AE667)call siteE8 E4 7A 9E FF 84 C0LoadMapProfileResources: island map textures in, mainland's out (game+0x8AE65E calls 0x296390 just before)
game+0x93F191 (0x14093F191)instruction3D 25 02 00 00 74 04SwitchOnActiveTrack's cmp eax,0x225: the full map
game+0xD8703B (0x140D8703B)instruction3D 25 02 00 00 48 8B 06MapScene'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:

AddressWhatStatus
game+0x197B7E5 (0x14197B7E5)time-of-day cmp eax,0x225: the island's lighting setproven in game (chapter 9)
game+0x2FB9A6 (0x1402FB9A6)ForzaSimulation cmp eax,0x225: the island's weather presetsworked in game, left off by default
game+0x5D832A, game+0x5D833Droute preload: treat the custom id as 549 for the branch, then pass the custom id as MediaTrack in r8proven in game (chapter 7); one reading names 0x5D8343 instead (offline)
game+0x92EB56 (0x14092EB56)island test in SetSpawnMode that turns traffic off on 549offline 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 Tracks row and one Environments row, added with add_sql as guarded INSERTs (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.
  • MediaTrack must 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

FactStatus
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 reader game+0xFD1600.
  • Kind: byte patch (6 bytes), api->patch_bytes: expect 0F 85 CA 03 00 00 (jne +0x3CA), write 90 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 under Mount\media\ (at most 3 s) with an NtCreateFile hook 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*/); path is under game:\, for example media\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 of hash.manifest. CFileSys::Exists is game+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, NtQueryFullAttributesFile and NtClose (to follow folder handles). Through the platform, hook the ntdll exports with hook_function; they are not game code and need no wait_for_code.
  • Add the folder to listings of media\tracks (append entries at STATUS_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 .pvs with the folder name changed in place. Keep virtual and real names the same length, so no length or offset in the file moves. A .pvs naming the other folder's materials drew every surface black.
  • Without homespace in 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 says Ribbon_).

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 at game+0x2EC0958 (owner pointer game+0x2EC0960, re-pointed per world).
  • The bug it fixes: material resources are cached globally by lower-case path (create game+0x10D2B50, find game+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 at game+0x4FAB4F (mov rax,[rcx]; jmp [rax+0x10], from game+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+0x133DB50 runs for every world, lists media\tracks\<name>Underground\*.modelbin, takes the first entry, and with none does nothing, silently. The name is passed as a std::string by value; at 16 characters or more it is heap-stored and the world gets no underworld (offline only). Aliasing another world's <name>underground.zip works (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 .nav with another hash loaded in an existing slot clears the player's discovered roads there next time; reuse the slot's hash (island 0x9A790429, mainland 0xFA38F25E). Roads with road_type=none take 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 .pvs grid 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 stock island_activation entities: a prompt left with TitleStringID empty threw "string too long" at game+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 save micro_save_continuous into your route group or nothing saves there. After swap_track, run global.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) and stateflow.zip\island_ie.xml; the return trip is in entities_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: +0x00 capacity (u64), +0x08 bytes in use, +0x10 chunk count, +0x18 lock.
  • What the game does: the cache is made once at boot (game+0x11F6580, called from the I/O setup at game+0xF64C41) with the engine option filecachesize: 210 MiB, rounded up to 64 KiB. The FileChunk getter game+0x11F7BF0 takes room for each group's compressed bytes through game+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 logs Failed 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)

AddressWhat
game+0x11DFDA0constructor; object 0x1E8 bytes, vtable game+0x2EAD838
game+0x11F6780Open (lazy): returns at once if open (cmp qword [rbx+0x120],-1 at game+0x11F67BF), else CreateFile2
game+0x11F2230header reader: .minizip reads 4 KiB at 0; .zip reads the end record at exactly EOF - 22 (no zip comment)
game+0x12044F0close: 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 with Failed to load when 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

AddressKindUseStatus
game+0x11FC9E0 (0x1411FC9E0)functionchunk entry reader (entry, dst, size): entry +0x40 progress, +0x44 method, +0x48 size, +0x50 offsetin game (logging)
game+0x19281E0 (0x1419281E0)functionstateflow update: log state changes, spot hangsproven in game
game+0x10F484D (0x1410F484D)call sitethe game's one DXGIXPresentArray call (E8 76 E0 89 00): frame timing; import slot game+0x1DD0F08 as a fallbackin game (logging)
NtReadFilefunction (ntdll)each GeoChunk read's offset and lengthin 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 atCauseFix
game+0x13E2A10 (reads +0x18)the world's .pvs was never served: not in the start-up listing, or hooks not madeserve the file under a listed name
game+0x4FAB4Fa cached material calling a freed model fixup handlerthe lasting handler (6.7)
game+0x37DB (zlib)a chunk entry outside its groupgive appended entries their own group
game+0x369029notes about a procedural library outliving itforget notes in Serialize
game+0x7A1590 / game+0xB282D0a prompt's TitleStringID left as empty ("string too long")build prompts from stock entities
title screen, in the zip list readerzipmanifest.xml editeduse the scan patch instead
~3 s into loadingthe zip-scan patch came too latehold 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.

RVAFull addressNameKindStatus
game+0x17D0600x14017D060travel descriptor table (542 and 549 only)dataO
game+0x263E500x140263E50std::string operator+ (Failed to load logger)functionP
game+0x2961500x140296150is the island (id == 549)call / call sitesP
game+0x2FB9A60x1402FB9A6ForzaSimulation island compare (weather presets)instructionP
game+0x368C600x140368C60CWorldCollObjMan::MakeDynamicfunctionP
game+0x368D900x140368D90CWorldCollObjMan::SpawnCellfunctionP
game+0x3696900x140369690SpawnObjectcallP
game+0x369E800x140369E80AddPhysicscallP
game+0x36A3300x14036A330CWorldCollObjMan::AddCellfunctionP
game+0x36AC800x14036AC80CWorldCollObjMan::BreakIntoPiecesfunctionP
game+0x36AEAC0x14036AEACBreakIntoPieces model pickinstructionP
game+0x3773400x140377340BindModelcallP
game+0x37A7D00x14037A7D0RecycleSlotcallP
game+0x3820C00x1403820C0SpawnEffectcallP
game+0x382F200x140382F20CWorldCollObjMan shutdownfunctionU
game+0x384C000x140384C00CWorldCollObjMan::UpdatefunctionP
game+0x50A2E00x14050A2E0entity file loaderfunctionP
game+0x5D832A0x1405D832Aroute preload, branch on the islandinstructionP
game+0x5D833D0x1405D833Droute preload, MediaTrack in r8instructionP
game+0x5E44600x1405E4460.nav loadercall targetP
game+0x8AE7C40x1408AE7C4LoadNavigationWorld -> .nav loadercall siteP
game+0x8AE8670x1408AE867LoadNavigationWorld -> .oww loadercall siteP
game+0x8AE6670x1408AE667LoadMapProfileResources island testcall siteP
game+0x9394100x140939410SwapTrack target and poseinstructionP
game+0x9394F20x1409394F2SwapTrack after the LastTrackVisited writeinstructionP
game+0x93F1910x14093F191SwitchOnActiveTrack island compareinstructionP
game+0xA6CACD0x140A6CACDvec4 property getter thunkinstructionP
game+0xB62A970x140B62A97minimap set-up island testcall siteP
game+0xCE76CE0x140CE76CEloading-screen video pickinstructionP
game+0xD4ABB40x140D4ABB4profile load: boot worldinstructionP
game+0xD8703B0x140D8703BMapScene island compareinstructionP
game+0xDDC2CA0x140DDC2CApause menu map tile island testcall siteP
game+0xF5DB400x140F5DB40car reset targetfunctionP
game+0xFD16660x140FD1666zip-scan byte patchbyte patchP
game+0xFDAA200x140FDAA20track id resolverreadO
game+0x10F484D0x1410F484DDXGIXPresentArray callcall siteI
game+0x11F9D300x1411F9D30CFileVolume::ExistsfunctionP
game+0x11FC9E00x1411FC9E0chunk entry readerfunctionI
game+0x126E0200x14126E020NameHashcallP
game+0x12B25000x1412B2500collision instance template loadfunctionP
game+0x12CC0100x1412CC010collision definition lookupfunctionP
game+0x12CC1A00x1412CC1A0collision template grid queryfunctionP
game+0x12CC7300x1412CC730CollisionWorld::GetPolysfunctionP
game+0x12CD3000x1412CD300definition render modelfunctionP
game+0x12D3D300x1412D3D30CollisionWorld valid-region testfunctionP
game+0x13079A00x1413079A0TP tick: streaming wait (gives up at 0x1307AC0)readP
game+0x132B3900x14132B390BindCollObjInstanceToModelfunctionP
game+0x133B5800x14133B580position inside the current cellreadO
game+0x133DEDF0x14133DEDFtrack loader: homespace flag storeinstructionP
game+0x1377B500x141377B50TrackPresentation11 destructorfunctionP
game+0x137BB400x14137BB40TP cell unload (vtable +0x288)slotO
game+0x13858570x141385857TrackPresentation unloadinstructionP
game+0x13887C00x1413887C0GetModelFixupHandlerfunctionP
game+0x139AC400x14139AC40TP cell load (vtable +0x280)slotO
game+0x13A41E00x1413A41E0render node update and placement drawfunctionP
game+0x1871B900x141871B90ProceduralModelsData::SerializefunctionP
game+0x18746000x141874600decode a procedural instancecallP
game+0x1881EC00x141881EC0vector<Group>::resizecallP
game+0x19281E00x1419281E0stateflow state machine updatefunctionP
game+0x197B7E50x14197B7E5time of day island compareinstructionP
game+0x2C6A2080x142C6A208CWorldCollObj vtable, slot 0 OnCollisionslotP
game+0x2D4BC600x142D4BC60Destruction skill Load slot (also Lumberjack, Sideswipe)slotP
game+0x2EC23D80x142EC23D8TrackPresentation11 vtabledataP
game+0x365AD700x14365AD70TrackSwapManager pointerdataO
game+0x36614A80x1436614A8file cache pointerdata writeP

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)

OffsetMeaning
+0x38 + slot*8dynamic model instance for a render slot
+0x8090load-time countdown
+0x8094byte: not ready (inside-cell test fails)
+0x80F8underworld model instance
+0x8110the track settings copy (getter game+0x1304D00, vtable +0xA0); +0x164 GrassFadeStartDistance, +0x43C skyScale
+0xAAB0world name, MSVC std::string (Anthem, Test03)
+0xAAD0homespace flag (u8)
+0xAB70pinned GeoChunk volumes (open worlds only)
+0xF618model objects by model number; entry +8 = resource, null if not loaded
+0xF630render nodes; index = count(+0xFB78) + count(+0xFBC0) + slot
+0xF7E0zone topography (CHexZoneTopography, vtable game+0x2F5AA88)
+0xFB10the embedded .pvs object
+0xFB78placements, 0x70 bytes each: +0x10 model, +0x22 animation binding, +0x24 u8 refcount, +0x30 LOD halfs, +0x38 position, +0x44 nine halfs of rotation
+0xFB90root collision table
+0xFBA8per-model records, 0x90 bytes each: +0x50 texture list, +0x6C four LOD model ids (u32), +0x7C flags
+0xFBC0second placement list (streamed instances)
+0x10BC, +0x10C0, +0x10C8streaming wait: active byte, tracked position, start time
+0x15618the world's CollisionWorld
+0x19518 / +0x19570current cells (22 ids) / new cells
+0x1AA18the TP's own ModelFixupHandler11; +0x1AA20 its owner
+0x1ABD0ambient-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 offsetMeaningRule
+0x10procedural (pgeo) countsizes the procedural tables
+0x14record-id space (max object id + 1)raise it when you add streamed objects
+0x18objects count
+0x1Cmax ids per cellmust be at least the real per-cell maximum
+0x20max records per cellmust be at least the real per-cell maximum; larger is harmless

Chunk key types (GeoChunk key = type << 24 | index)

TypeContentTypeContent
0x00pgeo (procedurals)0x08trigger zones (incl. rain zones)
0x01.phys ground tiles0x09AudioTile XML
0x03LBWO AI tiles0x0AFMOD bank
0x04models0x0BPVSL (lights)
0x05textures (idx*16 + piece)0x0CPVSZ (cells)
0x07skeletons0x0Dambient-occlusion tiles

CWorldCollObjMan, CWorldCollObj and definitions

Manager offsetMeaningObject offsetMeaning
+0x10deferred presentation (real one at +0x38 of it)+0x08body
+0x290slots vector (4,096)+0x40manager
+0x4C8definition table+0xA0position
+0x4F0car-in-view position+0xB0 / +0xB4x and z it broke from
+0x508free set (value at node+0x1C)+0xB8key (16 bytes)
+0x510free count+0xC0 / +0xC4procedural / child
+0x518cells, 0x40 bytes: +0x20 provider, +0x28 procedural id, +0x30 count+0x124definition 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:

OffsetMeaning
+0x00flags byte (must share a bit with the query's flags; cameras ask with 0x04)
+0x01surface
+0x02u16
+0x04 / +0x08 / +0x0Cvertex indices into a vec4 array (vertex w = packed normal)
+0x10face 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)

OffsetMeaning
+0x10PlayerPosition (vec4, w 1)
+0x20PlayerFacing (forward vector, y up, w 0; a heading of t degrees is (sin t, 0, cos t))
+0x30byte: non-zero turns the car along the nearest road first
+0x7CLastTrackVisited (int): the boot world

Archive volume (CCompressedVolume, 0x1E8 bytes)

OffsetMeaning
+0x28file path (std::string)
+0x48mount path
+0x118files open inside the archive
+0x120file handle, -1 when closed
+0x130 / +0x134 / +0x138directory start / size / entry count (kept across a close)
+0x1401 for a .minizip
+0x170pending job
+0x1A0GetTickCount of last use
+0x1A8 / +0x1C8directory entries (40 bytes) / blocks (80 bytes; cached chunk at +0x28)

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