---
name: fh2-azimuth-modding
description: Helps write, debug and publish mods for Forza Horizon 2 on PC run through the Azimuth loader. Use when the task mentions Forza Horizon 2, FH2, Azimuth, the FH2 Mod Platform (fh2mod.h, fh2-mods, DWrite.dll), Platform.NET (C#/VB.NET mods), FH2 ANNA, Extra Options (winmm.dll, FH2PluginInitialize), car packs, gamedbRC.slt, string tables, mediaoverride, game+0x addresses, or publishing a mod on FH2Mods.
---

# Forza Horizon 2 modding on Azimuth

You are helping someone mod **Forza Horizon 2 on PC**: the Xbox One build of the game, run by the **Azimuth**
loader. This file is a map. The detail lives in two community sources; open the chapter you need before you
write code, and quote it instead of guessing.

- **FH2 Mod Platform docs** (Trinculo54, MIT): https://fh2mods.com/developers/docs
  (source: https://github.com/Trinculo54/FH2-Mod-Platform)
- **The FH2 Modding Guide** (Trinculo54, text CC BY 4.0, code MIT), 16 chapters on hooks, data, file formats, structures and debugging:
  https://fh2mods.com/developers/docs/guide, one page per chapter, for example
  https://fh2mods.com/developers/docs/guide/05-hooking (original, which may be newer:
  https://github.com/Trinculo54/FH2-Modding-Guide)
- **FH2 Mod Platform for .NET** (Bartholomew Ho, MIT), mods in C# or VB.NET:
  https://fh2mods.com/developers/docs/dotnet (source: https://github.com/qiangqiang101/FH2-ModPlatform.NET)
- **FH2 ANNA** (Bartholomew Ho, MIT), FH3's in-car assistant in FH2; other mods can add menu entries:
  https://fh2mods.com/developers/docs/anna/menu-api (source: https://github.com/qiangqiang101/FH2-ANNA)
- **Game symbols** (a PDB for the exe): https://fh2mods.com/developers/docs/guide/symbols, downloads in the
  latest `symbols-v*` release of the Modding Guide.

## Facts to get right

- **One game build.** Every address is for `forza_durango_release_final.exe` of 24 Nov 2015: PE TimeDateStamp
  `0x565501ED`, SizeOfImage `0x3A18000`, preferred base `0x140000000`. Write addresses as an RVA (`game+0x12CC730`).
  Always work from the base you are given at run time: under Wine and Proton the exe loads elsewhere.
- **Azimuth also runs Forza Motorsport 5 and 6** with the same exe name and base. Check the header before touching
  anything (the platform does this for its mods; an Extra Options plugin compares `game_image_size` itself).
- **One process.** Azimuth maps the game into `azimuth.exe`; the game is not a loaded module, so
  `GetModuleHandle(NULL)` is Azimuth. Azimuth ends the game with `TerminateProcess`: no detach, no destructors.
  Save what matters as you go.
- **Folders.** `<Azimuth>\fh2-mods\` holds platform mods and `platform.log`. The game folder (`Mount`) has `media`,
  overridden by `mediaoverride` and then `mediapc`. Saves are under `<Azimuth>\data\titles\1A96545B\saves\`.
- **Proxy DLL names are taken**: `DWrite.dll` / `d3dcompiler_47.dll` (the platform) and `winmm.dll` (Extra Options).
  Never ship another proxy of your own.

## Pick the route

| Route | What you build | Start with |
|---|---|---|
| FH2 Mod Platform mod | a DLL in `fh2-mods\` exporting `fh2mod_init` | Platform docs: Write your first mod; Guide ch. 2 |
| Extra Options plugin | a DLL in an EO mod's `plugins\` exporting `FH2PluginInitialize` | Guide ch. 3 |
| .NET mod | a C# or VB.NET project referencing the `FH2ModPlatform` package | Platform.NET docs |
| Data-only mod | replaced media, an EO package (`database.json`, `strings.json`), or a platform car pack | Guide ch. 4 and 14; Platform docs: Car packs |

Prefer **data over code**: a database row, a string or a replaced page is safer than a hook and survives other mods.
A platform mod reaches the most players and gets the in-game MODS page, update checks and crash reports.

## Rules every mod follows

1. Never edit saves, and never tell players to delete `mediaoverride\Stripped\gamedbRC.slt`.
2. Change the database with `UPDATE` and `INSERT` only, so other mods' changes survive.
3. Hook only after Extra Options has finished patching (`wait_for_code` on the platform, from your own thread).
   Writing to EO's patch sites earlier makes EO switch itself off for that player.
4. Byte-check every site before hooking, patching or calling it. On a mismatch, log one plain sentence and turn
   that feature off. Never crash and never force it.
5. Always call the original you were given, so other mods' hooks on the same site still run.
6. Read game memory through SEH-guarded copies (clang with `-fms-extensions`; GCC MinGW lacks `__try`).
7. `fh2mod_init` returns 0 every time, even when the mod turns itself off.
8. Make every feature switchable, log what you change in plain sentences, and mark anything that would be a cheat
   online as offline-only.

## Build

clang targeting MinGW ([llvm-mingw](https://github.com/mstorsjo/llvm-mingw)) with CMake and Ninja, linked `-static`.
Keep a PDB for readable crash reports (`-gcodeview -Wl,--pdb=`). The platform has MinHook built in and chains
hooks between mods; without it, ship MinHook's licence with your plugin.

## How to work

- Before writing a hook, find the site in the Guide's hook reference (ch. 6 to 9) and note how sure it is:
  **proven in game**, **offline only** or **unconfirmed**. Tell the user which one applies.
- If the Guide doesn't list what you need, follow ch. 15 to find it, and say clearly that it is new and untested.
- Never invent addresses, struct offsets, API names or version numbers. If the sources don't say, say so and
  suggest how to check (a byte check, the symbols PDB, `platform.log`).
- When something breaks, start from the logs: `fh2-mods\platform.log`, `FH2_ExtraOptions.log`, then Guide ch. 13.
- Linux players run Azimuth under Proton: see the Platform docs page "Linux & Proton".

## Publish on FH2Mods

When the mod is ready, list it at https://fh2mods.com/mods/new. Paste the GitHub repository to fill in the
details, or use **Copy for AI** there: it gives the whole listing as JSON with a note on every field. Fill it only
with facts from the project, leave unknowns empty, and paste it back. FH2Mods links to the creator's own release
and never reuploads files.
