Boss Rally / Top Gear Rally: byte-exact decompilation
Boss Rally is a byte-exact decompilation of the PC game Boss Rally and the Nintendo 64 game Top Gear Rally.
- Type: PC port
- Game: Boss Rally
- Runs on Windows, Linux and macOS
- By Jeffrey Wilbur, Strut B, LLC
- Source: https://github.com/jeff-strutb/brally
README
Boss Rally / Top Gear Rally: byte-exact decompilation
Bring your classic game to a new generation
Jeffrey Wilbur, Strut B, LLC · retro@strutb.com
If you hold the rights to a classic game, I would love to help it live again. This repository shows what I do: I take a shipped cartridge back to readable, commented source that rebuilds the original ROM byte for byte, prove every routine behaves exactly as the original did, and then run that source natively on today's hardware, with no emulation of any processor. From there the game can grow: widescreen, two-player split screen, a choice of soundtracks and of front ends, controls for each player, 3D drawn on the GPU through Metal, Vulkan or OpenGL, and builds for macOS, Windows, Linux, iPhone and iPad, all without losing the game your players remember. The originals still build just as they shipped, right beside the remaster.
- Preserve it: source you own and can read, maintain and build on, recovered from the code that shipped, checked against the original at every step.
- Remaster it: modern screens and controls, on the platforms your audience plays on today, with the feel of the original intact.
- Reach new players, and give your longtime fans the version they always pictured.
If you have a game you would like to see again, write to me at retro@strutb.com.
Boss Rally / Top Gear Rally
https://github.com/user-attachments/assets/103d5d28-fac4-4932-8688-9ca0f9e0ae07
Left: Boss Rally's Coastline in the native 64-bit build (Native ports), the decompiled PC source compiled for Apple Silicon and drawn through Metal. Right: Top Gear Rally's Coastline in the native N64 build (ports/tgrally), the decompiled ROM source compiled for Apple Silicon, with the RCP's display lists drawn through Metal.
Top Gear Rally is fully byte-exact and documented. As of October 7, 2026, every one of the N64 game's 572 functions compiles under SGI's IDO 5.3 to the very bytes of the retail ROM, each transcribed by hand. Every function is named and carries a comment saying what it does, and every area of the source has a README listing its files and functions (src/tgrally/). The 1997 cartridge now exists as readable C that rebuilds it exactly.
Play it: download Rally Builder for macOS, Windows or Linux from Releases. It builds a native copy of any of the three games (Boss Rally, Top Gear Rally or Top Gear Rally Remastered, below) from your own BIN/CUE or ROM, checked by MD5; no game data ships with it (builder/).
License, and no claim to the games
I claim no ownership whatsoever of the decompiled source code. Boss Rally and Top Gear Rally, their code and their assets belong to their rights holders. The C in this repository is a reconstruction of their work, recovered by hand so that it compiles back to the original bytes. It is not mine to own, license or give away, and nothing here says otherwise. No game data ships in this repository: every build starts from your own copy of the game.
This project exists for preservation and for love of these games, so that the rally games Boss Game Studios made in the late 1990s can still be read, studied, built and played long after the cartridges, discs and hardware they shipped on are gone.
The work that is my own (the tools, the native ports' platform code, the Remastered renderer and Rally Builder) is dedicated to the public domain under CC0 1.0 Universal. Anyone may use it for any purpose, with no permission or credit needed.
Why CC0. A preservation project should claim as little as possible. CC0
asserts nothing over the reconstructed games, and it gives everything that is
mine to the public domain, with a fallback licence for countries where
copyright cannot be waived outright. That fallback is why CC0 was chosen over
the Unlicense, which has the same intent but no fallback. Files written by
others keep their own terms: tools/brally/c2read/ is under the MIT licence in
its LICENSE.byte-tactics.
The Decompilation Standard
The purpose of a decompilation, as opposed to a recompilation, is preservation: recovering the game itself, as written, in a form that outlives the original hardware and media. Playability and portability are welcome side effects, not the direct goal. With a bit-exact decompilation, every function, built with the original compiler, must reproduce the original machine code byte for byte. A bit-exact match is 100% reliability that the source is accurate to the original, ensuring preservation for future generations.
Project Purpose
A bit-exact decompilation of Boss Rally (PC, 1999), held to the MAME standard: the C source is the single source of truth and must compile to byte-identical output under the original compiler (MSVC 5.0), while the same source also cross-compiles to modern platforms. One tree, two build targets (the SM64 model). Progress is measured only in per-function byte-identical equivalence; playability is a consequence, never a reason to reorder matching. Do keep the port buildable.
Game background
Boss Game Studios built Top Gear Rally for the N64 (1997), then shipped Boss
Rally for Windows (1999) on the same engine. The PC build still emits N64 F3DEX
display lists, ships N64-format textures and big-endian geometry off the disc,
and carries the ROM's diagnostic strings. The PC game ships two
renderer DLLs over one shared core: BRGlide.dll (3dfx Glide: the mature
target and the reference for all matching) and BRD3D.dll (Direct3D: statically
links Microsoft's CRT, so it's reference-only, out of scope).
Two games, two decompilations
It's tempting to assume the N64 game is the PC game compiled for another machine. It isn't. When the PC source is compiled for the N64 and compared against the ROM, only about a fifth of the ROM's code has a clear match. At most around half could turn out to share code with the PC game.
- Boss Rally is the bigger game. It has roughly twice as many game functions as Top Gear Rally. It's a later game built on the same engine, not a straight port.
- Shared code still changed. Where a function exists in both games, the two usually differ by a few percent of their instructions. Two years of edits sit between the 1997 and 1999 releases, so PC source is a strong starting point for an N64 function, not a finished answer.
- Much of the ROM has no PC counterpart. Around 40% is N64-only code: graphics and audio drivers, the front end and other console-specific systems. It has to be decompiled from scratch. Another sixth is Nintendo's system library and a compression library, which are linked in rather than decompiled.
So the N64 game gets its own decompilation, kept apart from the PC tree (see Top Gear Rally (N64) decompilation). The two still help each other. The N64 compiler records operand order that the PC compiler throws away. A matched function on either side is a head start on its twin.
Current Status
Both decompilations count two milestones: M1, functions certified to behave
exactly like the original (T3) plus byte-exact ones (T4), and M2, byte-exact
functions only. The blocks below are snapshots; regenerate the bars and both
treemaps in one step with python3 tools/brally/progressbar.py: do not hand-edit them.
Boss Rally (PC)
Snapshot 2026-10-28.
M1 Contract-valid: compiles & ports (T3 + T4)
████████████████████████████████████████ 100.0% 450,489 / 450,649 B 1,495 / 1,495 fns
M2 Byte-exact (T4)
███████████████████████████████░░░░░░░░░ 78.6% 354,110 / 450,649 B 1,405 / 1,495 fns
| Area | M1: contract-valid | M2: byte-exact |
|---|---|---|
| BossRally.exe | ████████████████████ 100%: 35/35 fns, 2,482 B | ████████████████████ 100%: 35/35 fns, 2,482 B |
| BRally.exe | ████████████████████ 100%: 28/28 fns, 2,860 B | ████████████████████ 100%: 28/28 fns, 2,860 B |
| SetVideo.exe | ████████████████████ 100%: 42/42 fns, 7,251 B | ████████████████████ 100%: 42/42 fns, 7,251 B |
| BRGlide.dll | ████████████████████ 100.0%: 450,489 B, 1,495 fns | ████████████████░░░░ 78.6%: 354,110 B, 1,405 fns |
Every box is one function, sized by its bytes in .text and grouped by module:
green = byte-exact (T4, M2), blue = contract-valid but not yet byte-exact (T3),
amber = still diffing (T2), gray = not started (T1), purple = linker/CRT
(fenced). Green + blue is the M1 corpus. Regenerate: python3 tools/brally/progressmap.py --svg docs/brally/progress-map.svg.
Top Gear Rally (N64)
Complete. All 572 functions are byte-exact (M2 100%), and every one is named and documented in its source.
Snapshot 2026-10-28.
M1 Contract-valid (T3 + T4)
████████████████████████████████████████ 100.0% 379,932 / 379,932 B 572 / 572 fns
M2 Byte-exact (T4)
████████████████████████████████████████ 100.0% 379,932 / 379,932 B 572 / 572 fns
Top Gear Rally (Europe)
The Europe cartridge (PAL, EEPROM saving, faster computer cars on Desert and Jungle) is a sub-variant of the same source, held to the same standard: every function byte-exact against the Europe ROM (docs/tgrally/REGIONS.md).
Snapshot 2026-10-28. Europe: 582 of 582 game functions byte-exact (100.0%), 0 left.
M2 Byte-exact (T4)
████████████████████████████████████████ 100.0% 385,308 / 385,308 B 582 / 582 fns
Top Gear Rally (Japan)
The Japan cartridge (its own title logo, three replaced cars, real-livery
decals, Japanese text through a Japan-only %j escape, renamed terms) is a
sub-variant of the same source, held to the same standard: every function
byte-exact against the Japan ROM
(docs/tgrally/REGIONS.md).
Snapshot 2026-10-28. Japan: 585 of 585 game functions byte-exact (100.0%), 0 left.
M2 Byte-exact (T4)
████████████████████████████████████████ 100.0% 383,948 / 383,948 B 585 / 585 fns
Same map as the PC lane, over the ROM: one box per function, sized by its bytes
and coloured by tier (green = byte-exact, blue = contract-valid, amber = in
progress, gray = not started). Regenerate: python3 tools/tgrally/n64map.py --svg docs/tgrally/progress-map.svg.
More
- docs/brally/cheats.md: the six hidden cheat codes the decompilation found in the PC game.
- docs/brally/port/splitscreen.md: the PC game's complete but unreachable two-player split-screen renderer.
Boss Rally (PC) decompilation
Both milestones are measured in bytes of the game's own functions in BRGlide.dll: the hand-written target (in-scope EXE game code is separately complete). The rest of the DLL's code section is itemised below.
What the bars measure. Both bars count the game's own functions in BRGlide.dll: the code that has to be written by hand. M1 has complete. M2 trails it by 90 functions (96,379 B) that are certified to behave exactly like the original but do not yet compile to identical bytes.
The rest of the DLL. Its code section is 480,853 B; the bars leave out 30,204 B of it, all of which the finished DLL still contains but none of which is hand-written:
| Bytes | What it is | Where it comes from |
|---|---|---|
| 20,151 | padding and jump tables between functions | emitted by the compiler with the functions |
| 7,975 | import stubs and C++ exception-handling glue | generated by the compiler and linker |
| 2,078 | 2 functions the retail game never runs | written, but left out of the count (config/brally/excluded.csv) |
By binary: the three EXEs are complete at both milestones (their game code is fully byte-exact; the static CRT filling out each image is reproduced by linking, not decompiled, and is out of scope). All remaining work is in BRGlide.dll.
Query the tree. Do not trust a number in this file.
.venv/bin/python tools/brally/refcheck.py # corpus must be Glide-keyed
.venv/bin/python tools/brally/total.py # byte-exact functions and bytes, all lanes
.venv/bin/python tools/brally/tiers.py # T1/T2/T3/T4 of the C target (bytes, not just fns)
.venv/bin/python tools/brally/image_build.py # M2 gate: assembled DLL vs original; must be 0 differing bytes AND 0 refslot findings
.venv/bin/python tools/brally/image_build_t3.py # M1 gate: T3+T4 all compile & place; only T3 bodies differ
.venv/bin/python tools/brally/brbox_diff.py --all # M1 behaviour gate: T3 image vs original, every script, every frame
.venv/bin/python tools/brally/fileaudit.py # WHAT IT DOES, filing, T3 tags
image_build.py is the Milestone-2 (byte-exact) gate; image_build_t3.py is
the Milestone-1 (contract-valid) one: it compiles every T3-certified function
as well and proves the whole corpus builds and places, emitting BRGlide.T3.dll.
Its T3 bodies differ in bytes by design, but it is a working drop-in: it runs
the retail game (tested in a Win98 VM under 86Box) and behaves identically to
the original on every scripted session (below).
T1 = draft only; T2 = in the tree, not done; T3 = certified complete, not
byte-exact (tools/brally/t3.py --qualify); T4 = bytes diff clean.
How T3 is verified
"Not byte-exact" must still mean "does exactly what the original does". Two
oracles run the original game headless (tools/brally/brbox.py: the retail
BRGlide.dll under Unicorn, driven by input scripts in tools/brally/brbox_scripts/:
boot, menus, quick race to the finish, time attack and saves, championship and
season save/load, options and video modes, cheats and credits, a force-feedback
wheel, CD music, and two-machine DirectPlay races with join and dropout):
- A5: per function (
tools/brally/t3live.py, ledgerconfig/brally/t3_live.csv): at real calls in the running game, the original body and the T3 body run from the identical captured state; memory, imports, registers, x87 state and live return values must agree. Unreached functions are UNCOVERED, never passed. - A7: whole image (
tools/brally/brbox_diff.py --all, ledgerconfig/brally/whole_image.csv): the assembledBRGlide.T3.dlland the original run every script side by side and must agree on every frame: every Glide call and its arguments, the whole data area, and every network packet (both machines of a network session run the image under test). Currently 26/26 scripts identical.
A7 exists because A5 alone was not enough: the whole-image run found some 25
real transcription bugs (inverted branches, swapped or wrong arguments,
off-by-one indexing, x87 rounding points, and image-builder relocation errors)
in functions A5 had certified. t3.py --qualify requires both, and A7 is never
superseded. Bytes the original itself reads without ever writing (stale stack)
are listed with their evidence in config/brally/ub_scrub.csv and neutralised on both
sides. Function counts
overstate progress: remaining functions are several times larger than matched
ones. Quote bytes with their denominator (the hand-written target shown in the
bars, or BRGlide .text at 480,853 B: say which).
In-scope EXE game code (BRally.exe, BossRally.exe, SetVideo.exe) is complete;
what remains in those images is statically-linked CRT, reproduced by linking.
C++ EH functions are a separate lane (tools/brally/cpp_sweep.py).
A byte-exact session picks targets with python3 tools/brally/t4lane.py --claim
(Pool B). Procedure: docs/brally/MATCHING.md.
The image gate (tools/brally/image_build.py) is the deliverable check a per-function
diff cannot perform: it lays every claim at the address it claims, refuses
overlaps, fills unmatched ranges from the original, and diffs the image.
Keeping it that way
A function is not done until it says what it does and lives in its module.
tools/brally/precommit_rule6.py refuses a commit that adds an @implements without
a WHAT IT DOES: comment, creates a sliceN_MM.c, or adds a new VA to an
existing address batch. tools/brally/fileaudit.py is a ratchet across all three
lanes (undescribed 0, batches 58, stranded 11) and fails on a bad @t3 tag.
Moving byte-exact code can change its codegen: after a refile, sweep both
files and keep the move only if nothing regressed.
Architecture
Every top-level folder is split by game (brally, tgrally); ports/ is
derived platform code, not byte-matched.
src/brally/ the Boss Rally decomp: core/ (game logic), exe/ (the
three Win9x executables), include/ (byte-matched)
src/tgrally/ the Top Gear Rally decomp (IDO 5.3, MIPS)
config/{brally,tgrally}/ function maps, globals, ledgers, worklists
tools/brally/ matching pipeline, oracles, generators
tools/tgrally/ the N64 lane's tools; the soundtrack tools
tools/common/ git hooks, provenance check
tools/toolchains/ MSVC 5.0, Wine, IDO 5.3 (staged by setup.sh)
docs/{brally,tgrally}/ procedure, rules, and everything the work learned
ports/brally/ the native 64-bit port: a retyped fork of the core
plus a cross-platform layer (macOS, Windows, Linux)
ports/tgrally/ the native Top Gear Rally port
ports/common/ Remastered assets (recipes tracked, binaries not)
reference/ the original disc, ROM, compilers and corpora (not tracked)
build/ everything generated, per game and platform:
build/brally/{win32,null-soft,macos-metal,...},
build/tgrally/{n64,null-null,macos-metal,...}
@implements <addr> is a hard claim: MSVC 5.0 emits those original bytes.
The engine is dispatch-driven: only ~13% is reachable by following call
from the entry point, so functions are taken leaves-first.
Further reading: docs/brally/ARCHITECTURE.md, docs/brally/MATCHING.md,
docs/brally/VC5-IDIOMS.md, ports/README.md.
Building & Setup
./setup.sh: stages the matching build entirely inside the repo (nothing installed on the host). Downloads a pinned Wine build, copies MSVC 5.0 and its C runtime source out of a VC++ 5.0 disc image, and extracts the game binaries and original function bytes from the retail disc. Needs (you supply; none tracked in git):reference/msvc/VCPP-5.00.iso, the Boss Rally disc (reference/brally/BossRally.BIN+.cue), optionally the [Top Gear Rally ROM](#reference-rom-yo