This chapter maps the core objects a mod usually needs: the global roots, the game manager and simulation, views, cars, car physics, cameras, input and render, and the STL layouts the game uses. System-specific objects (collision and procedurals, the radio, weather, the HUD's pages) are in the hook chapters, each ending with its own "Structures and offsets" section.
All addresses are for forza_durango_release_final.exe of 24 Nov 2015 (TimeDateStamp 0x565501ED), image base
0x140000000. Vtables and globals are given at that base; under Wine or Proton add the load delta.
11.1 Finding things yourself
- RTTI: for an object
o,vtable = *(void**)o.vtable[-1]is the MSVCCompleteObjectLocator; its+12holds the RVA of the type descriptor, whose name starts at+16(.?AVForzaCar@@). Checking this is the most reliable way to confirm an object's type before trusting it. - Vtables move between interfaces. Several objects hand out a pointer into the middle of themselves (car physics below). Fields can then sit at negative offsets from the pointer you hold.
- Objects are replaced and freed. The car's physics pointer changes when a simulation restarts, and world objects are freed as areas stream. Re-read pointers each frame from a stable root, check the vtable, and read through guarded copies (chapter 5).
- Offsets below are as the released mods use them. Where a mod relies on one, it byte-checks the code that reads it. Do the same.
11.2 Roots
| Global | Type | Notes |
|---|---|---|
0x1434ABA60 | CForza* (vtable 0x142C47AE0) | the game. +0x48 CGameManager (getter 0x14021DFC0), +0x460 the entity world |
0x14365D7C8 | CControllerManager* (vtable 0x142E7A2E8) | input, see 11.8 |
0x14354F4F8 | App* | [App]+0x28 is the render thread, see 11.9 |
11.3 Game manager and simulation
CGameManager (vtable 0x142C5F8C8):
| Offset | Type | Meaning |
|---|---|---|
+0x28 | bytes | paused flags |
+0x40 | double | game clock (getter 0x140FBCC50) |
+0x48 | float | game speed. Set it with SetGameSpeed (vtable slot 17); the call itself stores here |
+0x78 | components | |
+0x98 | ForzaSimulation* | getter 0x1402E1520 |
ForzaSimulation (vtable 0x142C5FAE0):
| Offset | Meaning |
|---|---|
+0x10 | ICinematicSim (vtable 0x142C5FCC0) |
+0x2D0, +0x2D8 | the views |
+0x30C | car-control value |
+0x328 | CPhysicsWorld |
+0x3CC | render mode (setter 0x140FAF8B0) |
+0x480 | time of day |
+0x488 | weather |
Views: SplitView (0x142C66188), SimulationView (0x142E6F570) and MultiCamView (0x142E6E890). In a
view, +0x20 is the car it follows and +0x40 its camera director (+0xC0 the director in a MultiCamView). Vtable
slot 9 is SetRacingLineMode.
CPhysicsWorld (vtables 0x142EB46E0 / 0x142EB5C00): GetWorldBounds is slot 0xE0 (0x1412C5290). The
bounds cache flag is at +0x205E8, the box at +0x205C0/+0x205D0, the sections at +0x20080.
11.4 Cars: ForzaCar
Vtable 0x142C5CB80, RTTI .?AVForzaCar@@. Every car in the world is one: the player's, AI, traffic and remote
players'.
| Offset | Type | Meaning |
|---|---|---|
+0x4C08 | ptr | car physics interface (CCarDynamics, getter 0x140F605D0) |
+0x4C58 | obj | collidable request set (getter 0x140F60510); a std::list at +8 |
+0x4D08 | int32 | kind: 0 local player, 1 AI, 2 traffic, 3-5 remote players (getter 0x140F62280) |
+0x4D38 | ptr | presentation wrapper; its vtable +0x130 SetAlphaScalar, +0x228 ShowCar, +0x230 HideCar |
+0x50F1 | u8 | cleared by HideCar |
+0x5370 | obj | replay component; its first pointer is the car (only once loaded) |
Vtable slots and functions:
| Slot / address | What |
|---|---|
slot 0x80 → 0x1402A9400 | per-frame update (car, dt, b, d). Hooked by several mods: chain it (chapter 5) |
slot 0x130 → 0x14028D930 | apply collidable state |
slot 0 → 0x14028B380 | deleting destructor, calls ~ForzaCar 0x140289320: drop notes about the car here |
0x14028C590 | alpha float(self, ForzaCar**) |
0x14028D350 | ShouldStartGriefing, the anti-griefing check (chapter 12) |
Filter by kind before acting on a car: a hook on a shared function sees AI, traffic and remote cars too. WreckingBall once slowed AI cars because a pole hit read a car without checking its kind.
11.5 Car physics: CCarDynamics
Vtables 0x142EB4BB8 and, ref-counted, 0x142EB5E18. car+0x4C08 points at an interface inside the object, so the
transform sits at negative offsets from it. Re-read car+0x4C08 every frame: 0x140FAABE0 swaps it when the
simulation restarts.
| Field | Where | Getter / setter (vtable offset) |
|---|---|---|
| position (vec4) | dyn-0x390 | 0x1412CD150 (+0x270); SetPosition (+0x280) |
| rotation rows right, up, forward (3 vec4) | dyn-0x380 | 0x1412CBEB0 (+0x2E0); row 2 is forward |
| velocity (vec4) | dyn-0x350 | 0x1412CDCF0 (+0x288); SetVelocity 0x1412E3CF0 (+0x290) |
| angular velocity, world (vec4) | dyn-0x340 | 0x1412C5C90 (+0x2B8); SetAngularVelocity 0x1412DD910 (+0x2C0) |
| engine speed / redline | dyn+0x148 / dyn+0x1CC | 0x1412C8050 |
| gear (u8) | dyn+0xAA1 | 0x1412C7CF0 |
| controls | dyn+0xDF8 | 0x1412CBEF0 |
Prefer calling the setters to writing the fields: the physics keeps derived state the setters update.
11.6 Cameras
CMultiCam (vtable 0x142E70080) and its subclass ForzaMultiCam (0x142C6C840) direct the cameras. View 0's
director is at view+0x40.
| Offset | Meaning |
|---|---|
+0x188 | camera list, 64-byte entries |
+0x1B0-+0x1D0 | camera-index std::deque<int> (map +0x1B8, map size +0x1C0, offset +0x1C8, size +0x1D0) |
+0x1E8 | target car |
+0x1F0 | player link |
+0x208 | active camera |
+0x219 | cut flag (u8) |
+0x220-+0x2C7 | view 0's camera cache |
+0x2C8 | (ForzaMultiCam) camera taken by the rolled-over check, -1 if none; +0x2CC its timer |
| Function | What |
|---|---|
0x140FE61C0 | PostUpdate: the place to take over the camera each frame |
0x140FE5780 | SetActiveCamera (mc, int) |
0x140FE2AE0 | GetCurrentIndex |
0x140FE2F60 | near-clip forwarder (slot 40) |
0x1403986A0 | rolled-over check (ForzaMultiCam slot 80): switches to the chase camera when the car is upside down |
Camera indices: 0 FollowCam, 1 FollowCam2, 2 DriverCam, 3 Hood, 4 BumperHigh, 12-14 others, 16 PhotoMode,
17 RearView. Other camera classes: CCamPhotoMode (0x142C6C578), CinematicGameCamera (0x142F3BAD0). More in
chapter 8.
11.7 HUD notifications and achievements
| Address | What |
|---|---|
0x14073E0B1, 0x14073F046 | HUDMinorNotificationComponent constructor and destructor (instruction sites; shared) |
+0x128+0x18 | the component's TemplateName |
0x140755330 | Show (call it; never hook it) |
0x140323310 | MakeDisplayString (call it; never hook it) |
0x1403FCD60 | AchievementsModule update (vtable +0x20); its tick site 0x1403FCD84 is shared |
0x1402F7940 | profile SetStat |
0x141DD0060 | EtxEventWrite import slot (telemetry events, EtwPlus.dll) |
On the platform, use its pop-ups (fh2mod_ui.h) instead of driving these yourself.
11.8 Input
CControllerManageris the global0x14365D7C8(vtable0x142E7A2E8). Update0x141075490, ReadPad0x14106C320.- Each controller keeps its copy of the pad state at
+0xBC;+0xAB28is the pad used last. - The input context stack: Push
0x141073090, Pop0x141072F60(a deque at+0x38). 0x1410768D0("release taken controls") belongs to the platform's pad layer: don't hook it.
On the platform, take buttons through the pad layer or hotkeys rather than hooking input. Which buttons the game already uses (RB changes camera, Y rewinds) is in chapter 8.
11.9 Render
[0x14354F4F8]+0x28is the render thread (CRenderThread, vtable0x142C65028); its depth-of-field block is at+0x590-+0x5B8.- The render mode setter is
0x140FAF8B0. Photo mode switches to its own render settings, which keep the player's car on its top level of detail; the driving settings hold it one level down (CarFocusLODMinMaxmin 1).
11.10 The game's STL (MSVC 2012)
The game was built with Visual C++ 2012 and its STL, MSVCP110 (15.6).
Its containers are laid out like this (x64). The sizes and the offsets marked compiler were read back from code built
with a compiler of the game's own build; the rest were found in the game.
| Type | Size | Layout |
|---|---|---|
std::string | 0x20 | 16 bytes inline text or a pointer; size at +0x10; capacity at +0x18; inline while capacity < 16 |
std::wstring | 0x20 | as std::string, inline while capacity < 8 |
std::vector<T> | 0x18 | three pointers: first, last, end of storage |
std::shared_ptr<T> | 0x10 | {ptr, ctrl}; the control block has uses at +8, weak references at +0xC; its vtable slot 0 is _Destroy, slot 1 _Delete_this |
std::unique_ptr<T> | 0x8 | the pointer |
std::list<T> | 0x10 | sentinel node pointer at +0, size at +8; in each node next at +0, prev at +8, value at +0x10 |
std::map<K,V>, std::set<K> | 0x10 | head (sentinel) node pointer at +0, size at +8 (compiler) |
std::deque<T> | 0x28 | iterator proxy pointer at +0, then map +8, map size +0x10, offset +0x18, size +0x20 (compiler); four ints a block |
std::unordered_map<K,V>, std::unordered_set<K> | 0x40 | a std::list of all elements at +0 (size at +8), a std::vector of bucket iterators at +0x10, mask at +0x28, bucket count at +0x30, max load factor (float) at +0x38 (compiler) |
std::function<F> | 0x20 | inline storage, then the pointer to the callable's wrapper at +0x18 (null when empty) (compiler) |
std::mutex, std::recursive_mutex | 0x8 | a pointer to the runtime's mutex (compiler) |
Functions that take a std::string by value free it themselves. Build such a string with the game's allocator
(operator new at 0x1403229C0), on a game thread, or the game will free memory it doesn't own.
