Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,27 @@ jobs:
"VERSION=$version" >> $env:GITHUB_ENV
"ARTIFACT_DIR=artifacts/AzimuthRPC-$version-win-x64" >> $env:GITHUB_ENV
"MOD_VERSION=$modVersion" >> $env:GITHUB_ENV
"MOD_ARTIFACT_DIR=artifacts/FH2ML-AzimuthRPC-$modVersion" >> $env:GITHUB_ENV
"MOD_ARTIFACT_DIR=artifacts/FH2ModPlatform-AzimuthRPC-$modVersion" >> $env:GITHUB_ENV
"version=$version" >> $env:GITHUB_OUTPUT
"mod_version=$modVersion" >> $env:GITHUB_OUTPUT

- name: Build, test and smoke-test standalone
shell: pwsh
run: ./publish.ps1

- name: Build FH2ML DLL
- name: Build FH2 Mod Platform DLL
shell: pwsh
run: ./native/FH2ML.AzimuthRPC/build.ps1

- name: Verify release outputs
shell: pwsh
run: |
$exe = Join-Path $env:ARTIFACT_DIR 'AzimuthRPC.exe'
$dll = Join-Path $env:MOD_ARTIFACT_DIR 'AzimuthRPC.dll'
$manifest = Join-Path $env:MOD_ARTIFACT_DIR 'mod.json'
$dll = Join-Path $env:MOD_ARTIFACT_DIR 'fh2-mods/AzimuthRPC.dll'
$platformDll = Join-Path $env:MOD_ARTIFACT_DIR 'd3dcompiler_47.dll'
if (-not (Test-Path $exe)) { throw "Missing $exe" }
if (-not (Test-Path $dll)) { throw "Missing $dll" }
if (-not (Test-Path $manifest)) { throw "Missing $manifest" }
if (-not (Test-Path $platformDll)) { throw "Missing $platformDll" }
foreach ($folder in @($env:ARTIFACT_DIR, $env:MOD_ARTIFACT_DIR)) {
$license = Join-Path $folder 'LICENSE'
if (-not (Test-Path $license)) { throw "Missing $license" }
Expand All @@ -118,10 +118,10 @@ jobs:
if-no-files-found: error
retention-days: 30

- name: Upload FH2ML DLL artifact
- name: Upload FH2 Mod Platform DLL artifact
uses: actions/upload-artifact@v4
with:
name: FH2ML-AzimuthRPC-${{ env.MOD_VERSION }}
name: FH2ModPlatform-AzimuthRPC-${{ env.MOD_VERSION }}
path: ${{ env.MOD_ARTIFACT_DIR }}
if-no-files-found: error
retention-days: 30
Expand Down Expand Up @@ -182,14 +182,14 @@ jobs:
if: steps.release_check.outputs.exists != 'true'
uses: actions/download-artifact@v4
with:
name: FH2ML-AzimuthRPC-${{ needs.build.outputs.mod_version }}
name: FH2ModPlatform-AzimuthRPC-${{ needs.build.outputs.mod_version }}
path: release/fh2ml

- name: Package FH2ML ZIP
if: steps.release_check.outputs.exists != 'true'
shell: pwsh
run: |
$zip = "release/FH2ML-AzimuthRPC-${{ needs.build.outputs.mod_version }}.zip"
$zip = "release/FH2ModPlatform-AzimuthRPC-${{ needs.build.outputs.mod_version }}.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path 'release/fh2ml/*' -DestinationPath $zip -CompressionLevel Optimal
if (-not (Test-Path $zip)) { throw "Missing $zip" }
Expand All @@ -204,8 +204,8 @@ jobs:
run: |
$tag = "v$env:VERSION"
$exe = 'release/standalone/AzimuthRPC.exe'
$dll = 'release/fh2ml/AzimuthRPC.dll'
$zip = "release/FH2ML-AzimuthRPC-$env:MOD_VERSION.zip"
$dll = 'release/fh2ml/fh2-mods/AzimuthRPC.dll'
$zip = "release/FH2ModPlatform-AzimuthRPC-$env:MOD_VERSION.zip"
$license = 'release/standalone/LICENSE'

gh release create $tag $exe $dll $zip $license `
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Project><PropertyGroup><Version>0.9.9</Version><AssemblyVersion>0.9.9.0</AssemblyVersion><FileVersion>0.9.9.0</FileVersion><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><TreatWarningsAsErrors>true</TreatWarningsAsErrors><PlatformTarget>x64</PlatformTarget><UseSharedCompilation>false</UseSharedCompilation></PropertyGroup></Project>
<Project><PropertyGroup><Version>0.9.10</Version><AssemblyVersion>0.9.10.0</AssemblyVersion><FileVersion>0.9.10.0</FileVersion><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><TreatWarningsAsErrors>true</TreatWarningsAsErrors><PlatformTarget>x64</PlatformTarget><UseSharedCompilation>false</UseSharedCompilation></PropertyGroup></Project>
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,57 +41,58 @@ Download the newest build from [GitHub Releases](https://github.com/Refilewski/A
4. Run `AzimuthRPC.exe`.
5. AzimuthRPC stays in the system tray and connects automatically when the supported FH2 build is detected.

### FH2ML mod
### FH2 Mod Platform mod

Download `FH2ML-AzimuthRPC-<version>.zip` from the latest release and extract it as one FH2ML mod:
Download `FH2ModPlatform-AzimuthRPC-<version>.zip` from the latest release and extract its contents next to `azimuth.exe`:

```text
Azimuth/
mods/
azimuth-rpc/
AzimuthRPC.dll
mod.json
README.md
azimuth.exe
d3dcompiler_47.dll
fh2-mods/
AzimuthRPC.dll
```

The native mod runs inside Azimuth/FH2ML and talks directly to Discord IPC. Do not run the standalone EXE and FH2ML DLL at the same time, or both may try to update the same Rich Presence.
The native DLL uses Trinculo54's **FH2 Mod Platform 2.7.3+**, not the earlier FH2ML manifest ABI. The zip ships the official platform loader. If other mods already installed a newer `d3dcompiler_47.dll`, keep the newer version.

The plugin runs in-process, using the platform's game-base service and local Discord IPC. **Do not run the standalone EXE and native DLL together**, because both may update the same Rich Presence.

## Compatibility

AzimuthRPC currently targets **Forza Horizon 2 Xbox One 1.0.0.64** on Windows x64 through Azimuth. Unknown game builds are rejected instead of using offsets against an unsupported executable.

Compatibility can vary with Azimuth and FH2ML versions or other mods. If something breaks, include your exact setup in the issue report.
Compatibility can vary with Azimuth and FH2 Mod Platform versions or other mods. If something breaks, include your exact setup in the issue report.

**Linux / Wine support is not available yet.** A Linux Discord IPC path/bridge is being explored.

## Diagnostics & privacy

Both the standalone EXE and the FH2ML DLL write `%LOCALAPPDATA%\\AzimuthRPC\\logs\\AzimuthRPC.log` (paste that path into Windows Explorer). The native DLL now logs as soon as `FH2ML_Initialize` is called, including rejected host API versions or unsupported game-image checks. If no log is created, first verify the executable actually started or the loader called the DLL initializer; an absent log alone does **not** prove that car offsets changed. Logs can contain runtime telemetry, memory probe values, loaded module names and Discord IPC status, so **review the log before uploading it publicly**.
Both the standalone EXE and the FH2ML DLL write `%LOCALAPPDATA%\\AzimuthRPC\\logs\\AzimuthRPC.log` (paste that path into Windows Explorer). The native DLL now logs as soon as `fh2mod_init` is called, including rejected host API versions or unsupported game-image checks. If no log is created, first verify the executable actually started or the loader called the DLL initializer; an absent log alone does **not** prove that car offsets changed. Logs can contain runtime telemetry, memory probe values, loaded module names and Discord IPC status, so **review the log before uploading it publicly**.

The **standalone EXE automatically removes `AzimuthRPC.log` and its rotated `.1` log after a normal exit** (tray `Exit`). If it crashes or is force-terminated, logs are kept for troubleshooting. To preserve logs while testing, launch the standalone with `--keep-logs`; copy the log before exiting if you need to share it. Cleanup is best-effort if another process keeps the file open.

The FH2ML native DLL still retains logs: it has no safe, guaranteed shutdown callback, and attempting deletion inside `DllMain` during process teardown could cause instability. Don't run the standalone and native DLL at the same time.
The FH2 Mod Platform native DLL still retains logs: it has no safe, guaranteed shutdown callback, and attempting deletion inside `DllMain` during process teardown could cause instability. Don't run the standalone and native DLL at the same time.

### Share diagnostics on Discord (standalone)

Right-click the tray icon and choose **Send logs to Discord...**. A preview shows the exact content and nothing is uploaded until the user clicks Send. The EXE includes only recent diagnostic lines, with common Windows user profile names, credentials, and webhook URLs redacted. Please inspect the preview yourself before sharing.

The app contacts an HTTPS, rate-limited Supabase Edge Function owned by the FH2Mods project. It forwards a text attachment to the Discord support webhook, which is stored in Supabase Vault, **not embedded in the EXE or in GitHub**. This action is optional and does not run at startup or shutdown. The native FH2ML DLL has no tray menu; its logs can still be shared manually.
The app contacts an HTTPS, rate-limited Supabase Edge Function owned by the FH2Mods project. It forwards a text attachment to the Discord support webhook, which is stored in Supabase Vault, **not embedded in the EXE or in GitHub**. This action is optional and does not run at startup or shutdown. The native FH2 Mod Platform DLL has no tray menu; its logs can still be shared manually.


AzimuthRPC does not ask for your Discord password or token. No game files, saves or raw memory captures are included in this repository.

## Build from source

The managed projects require the **.NET 8 SDK** on Windows x64. Building the native FH2ML DLL additionally requires **Visual Studio Build Tools** and **CMake**.
The managed projects require the **.NET 8 SDK** on Windows x64. Building the native FH2 Mod Platform DLL additionally requires **Visual Studio Build Tools** and **CMake**.

Standalone build:

```powershell
./publish.ps1
```

Native FH2ML build:
Native FH2 Mod Platform build:

```powershell
./native/FH2ML.AzimuthRPC/build.ps1
Expand Down Expand Up @@ -125,3 +126,5 @@ AzimuthRPC is **source-available**, not OSI open source. The [AzimuthRPC Use-Onl
## Disclaimer

AzimuthRPC is an independent fan project by **Refilewski**. It is not affiliated with Microsoft, Xbox, Playground Games, Turn 10, Discord or Azimuth. No game, DLC, game files or license keys are included.

Compatibility note: both runtimes now attempt a bounded, ambiguity-checked fallback if the known car ID field cannot be parsed. This is a hypothesis for Azimuth 1.0.2, **not** an in-game verified fix; see `native/FH2ML.AzimuthRPC/README.md` for diagnostics.
22 changes: 10 additions & 12 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# AzimuthRPC v0.9.9
# AzimuthRPC v0.9.10

Discord Rich Presence polish and car-detection diagnostics.
Native DLL migration to FH2 Mod Platform 2.7.3 and guarded car-ID compatibility recovery.

- "Loading Race" now appears **without a second line**: removes the generic "Forza Horizon 2 via Azimuth" state and prevents a stale car or speed from being shown while loading. This applies to both standalone EXE and native FH2ML DLL.
- The standalone log now records changes to a compact, privacy-conscious snapshot diagnostic: game UI mode, inferred activity, hook/telemetry status, event context and car ID parse result. No raw game-memory bytes are dumped.
- Car ID validation now reports a reason such as `empty`, `too-short`, `unterminated`, `invalid-character`, `missing-underscore`, or `ok` so users with missing vehicle names can provide actionable logs.
- Adds automated regression coverage for race-loading second-line suppression and snapshot diagnostics.
- Retains v0.9.8 standalone startup log fallback and the log folder shortcut, plus the v0.9.7 native startup diagnostics.
- Replaces the old FH2ML ABI with `fh2mod_init`, platform registration, logging and game-base discovery.
- The DLL no longer rejects startup when the game image is not yet mapped.
- Native DLL: use FH2 Mod Platform's instruction hook in the game's HUD to capture a freshly displayed vehicle pointer, confirm the known player-car vtable and decode the native short/heap car-name string at `car+0x350`. The HUD path is preferred while fresh; no gameplay memory is patched directly.
- The standalone EXE and native DLL prefer the known `AudioEngine+0x278` car-ID field, and try a bounded, unambiguous candidate within the same object when it is unavailable.
- Existing Discord IPC, presence, speed, location and game-state handling are unchanged.
- Platform release package ships the official v2.7.3 loader and required license notices.
- Synthetic regression covers both relocated and ambiguous car IDs. Live HUD hook decoding still needs in-game verification.

## Compatibility

Still targets FH2 Xbox One 1.0.0.64 through Azimuth. This release does **not** change memory offsets or claim confirmed compatibility with every Azimuth version or mod combination.

## Collecting useful reports

Use `%LOCALAPPDATA%\AzimuthRPC\logs\AzimuthRPC.log` (or the standalone fallback `%TEMP%\AzimuthRPC\AzimuthRPC.log`). Include the **Snapshot diagnostic:** lines with your Azimuth version, other mods such as Extra Options, and whether you used the EXE or FH2ML DLL. Please review/redact any sensitive data before sharing.
Live gameplay testing on Azimuth 1.0.2 is **still required**. The fallback is a conservative compatibility heuristic, not a confirmed new offset.
16 changes: 8 additions & 8 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ AzimuthRPC now has two production-facing runtime targets plus developer tooling.

`AzimuthRPC.Debug` remains developer tooling. It owns the WPF UI, process discovery, external read handle, research scanners/dumps and the existing external telemetry hooks.

### Native FH2ML mod
### Native FH2 Mod Platform mod

`native/FH2ML.AzimuthRPC` is a separate native x64 C++ runtime. It does not host Core or the .NET runtime. It exports `FH2ML_Initialize`, validates the supported FH2 image, performs direct in-process reads and talks to Discord IPC itself.
`native/FH2ML.AzimuthRPC` is a separate native C++ x64 runtime which does not host .NET. It exports `fh2mod_init`, uses the vendored MIT-licensed FH2 Mod Platform header, registers with the host and gets the FH2 image base via `game_base()`. Initialization is not blocked by game load timing: the worker waits for Azimuth to map the supported PE image. The native runtime performs guarded in-process reads and writes Discord IPC. It does not install gameplay hooks.

The current FH2ML host API pointer is deliberately treated as opaque because the shared `sdk/FH2ML.h` contract is not vendored here yet. No gameplay patch or hook is installed by the native RPC MVP.
Both native and managed car readers prefer the historically observed `AudioEngine+0x278` field. If that fails, a uniquely plausible ID within a bounded portion of the same audio object can serve as a fallback. The fallback is **not** a confirmed Azimuth 1.0.2 offset and must be validated in-game.

### Managed InProcess experiments

`AzimuthRPC.InProcess` is still a managed guarded-read adapter experiment. `NativeBootstrapImplemented` remains false. It should not be confused with the working native FH2ML C++ plugin.
`AzimuthRPC.InProcess` is still a managed guarded-read adapter experiment. `NativeBootstrapImplemented` remains false. It should not be confused with the working native FH2 Mod Platform C++ plugin.

## Snapshot/read model

The managed reader uses bounded, guarded reads and revalidates roots before publishing a snapshot. One vehicle sample supplies the current car, speed, XYZ/mirror and velocity data. Unsupported PE layouts fail closed.

The native FH2ML implementation follows the same conservative principle: validate the supported build, validate pointer/data ranges and publish only coherent data.
The native FH2 Mod Platform implementation follows the same conservative principle: validate the supported build, validate pointer/data ranges and publish only coherent data.

Neither runtime claims an atomic game transaction; the game may continue changing while a sample is taken.

Expand All @@ -42,15 +42,15 @@ Current runtime state detection covers:
- World Map;
- in-world fallback from coherent vehicle telemetry.

The standalone debug path also retains external event-context / normalized-rev hooks used for research and richer activity interpretation. Those hooks are not currently installed by the native FH2ML DLL.
The standalone debug path also retains external event-context / normalized-rev hooks used for research and richer activity interpretation. Those hooks are not currently installed by the native FH2 Mod Platform DLL.

Mainland location presence currently comes from player coordinates plus known anchors/coarse polygons. It is a pragmatic resolver, not a discovered native road/region/landmark source. Native location discovery stays under `docs/research/` until live evidence is strong enough to replace that resolver.

## Concurrency and shutdown

The standalone worker owns mutable process/IPC resources and clears state on detach/restart. Debug hooks verify ownership before restoration and remain best-effort because safe cross-mod hot-unload is not proven.

The native DLL performs substantial work outside `DllMain`; `FH2ML_Initialize` starts the runtime worker. No hot-unload contract is claimed yet.
The native DLL performs substantial work outside `DllMain`; `fh2mod_init` starts the runtime worker. No hot-unload contract is claimed yet.

## Repository/test boundaries

Expand All @@ -62,7 +62,7 @@ Research notes, failed hypotheses and native-location investigation live under `

The next useful native steps are:

1. vendor/share the real FH2ML SDK header and use the versioned host API without guessing ABI layouts;
1. verify car-ID recovery in live Azimuth 1.0.2 and replace the heuristic with a confirmed source when available;
2. add validated event/free-roam telemetry to the native runtime without introducing unsafe hook ownership;
3. replace coarse location polygons only when a real FH2 road/region/landmark source is identified and live-validated;
4. define an explicit unload/shutdown contract before attempting hot unload.
11 changes: 11 additions & 0 deletions docs/OFFSETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Only **FH2 Xbox One1.0.0.64**. Image RVAs are added to dynamically resolved Game

Mapped headers must match file identity. Preferred base is tried first, then eligible image/private allocation bases. No stable heap address is assumed.

## Current vehicle from HUD (new native FH2 Mod Platform path)

**SOURCE-CONFIRMED / NEEDS LIVE AZIMUTH 1.0.2 VALIDATION** (based on public implementations, not our own live capture):
- HUD speedometer instruction `GameBase+0x783E67`: an FH2 Mod Platform instruction hook sees the HUD object in RDI.
- `HUD+0xE8`: pointer to the car currently displayed by the HUD.
- `Car+0x0` vtable: compare to `GameBase+0x2C5CB80` (player-car type from Extra Options).
- `Car+0x350`: native narrow car media-name string. 16-byte inline storage for short strings, heap pointer for longer strings; object length at +0x10 and capacity at +0x18.
- The platform-native DLL uses this read as primary when the hook is fresh (8-second window), validates type/string and falls back to the legacy AudioEngine path when unavailable. The EXE has no platform HUD hook; it retains its current AudioEngine mechanism.

Sources: [VirtualDashboard](https://github.com/suderek22/FH2_VirtualDashboard/blob/main/VirtualDashboard.cpp#L32-L56) (HUD hook + car string); [Extra Options](https://github.com/RokkuDayo/ForzaHorizon2_ExtraOptions/blob/main/game_addresses.h) (player-car vtable). Both projects are GPL-3.0; only observed offsets/data layouts are documented here, not their source code.

## Vehicle fields

| Name | Offset; root | Type / meaning | Status; discovery; confidence | Guards / notes |
Expand Down
Loading
Loading