How to Recomp Retro Games with REA?

I recently gave a talk at C3 Expo about retro games in the AI era, reverse engineering with REA, and the marathon of game launchers I have been building over the past couple of months. If you want the visual deck from that talk, you can flip through the C3 Expo 2026 slides here.

Here is the short version of what I have been up to since October: I have shipped at least 14 launchers covering roughly 30 classic games, all open on my GitHub as rea-* repositories built on top of my rea-launcher-sdk framework (which I walked through in an earlier post). A quick sample of the lineup:

The Sega Racing Launcher hub bringing six arcade classics under unified controller, wheel, and display settings

A launcher is hands down the fastest, safest way to rescue an old PC game stranded on dead APIs and make it run cleanly on a modern OS. Instead of touching the game’s physics or AI, the original executable runs straight on the CPU while translation layers and surgical memory hooks map obsolete calls (such as MS-DOS era 3dfx Voodoo Glide, Windows 95 era WinG, or DirectX 5/6/8) onto DirectX 11/12 or Vulkan, adding 4K, true widescreen, modern gamepads, and force feedback along the way.

The Picture tab in the Screamer Trilogy launcher switching between 3dfx Voodoo Glide, SVGA, widescreen, and modern upscalers

Two recomp attempts and an itch I could not scratch

Wrapping PC executables in launchers works great, yet I wanted to push further into full game recompilation and source reconstruction. Over the past two months I took two big swings at it, and both taught me the hard way where the landmines are buried.

The first swing was rea-colin-mcrae-recomp, an experimental push to reconstruct the entire 1998 Colin McRae Rally in safe Rust using REA. Looking at the Git log, the project kicked off on October 20 and ate up nearly two straight weeks of heavy marathons (673 commits across 11 active days just to hit a playable v0.1.0 on November 1, after getting stuck on a recomp-parked tag on October 28, and over 715 commits through today). Halfway through, I had to hop from Claude Code to Codex to Antigravity just to drag it across the finish line with the Subaru sliding on gravel, working menus, and co-driver audio.

Gameplay preview of the native Rust reconstruction of 1998’s Colin McRae Rally

Even once it was playable, it left a bad taste in my mouth. One nagging engineering question had no good answer: how do I know for sure that this physics loop and these thousands of reconstructed functions actually match the 1998 executable 1:1? I parked that doubt in the back of my head and moved on.

A few days ago, I took a second swing with rea-godot-streets-of-rage-2. There is real value in taking retro classics and abandonware, pulling everything out of the ROM, and reorganizing the whole game inside a modern engine like Godot 4: instead of drowning in unreadable low-level C, any developer can open scenes visually, study how a classic is wired together, and tweak mechanics in high-level GDScript.

Four live screens from rea-godot-streets-of-rage-2 running in Godot 4.7: title screen, character select, Round 1 Downtown, and Round 2 Bridge

Once again, 1:1 fidelity went sideways. I spent a full marathon (over 30 hours and 1,434 agent steps) pushing Antigravity to map every original behavior from the Genesis ROM, record provenance addresses, and write regression tests. At the end of the day I had a semi-playable game boasting 56 out of 56 passing tests, yet broken enough that there was no way I could call it a good port: floaty jumps, vanishing lead pipes, button-mashing combos locking the player up, Barbon standing frozen like a mannequin, Jack throwing knives in an endless loop, missing floor chunks, and enemy waves spawning in the wrong spots mid-stage.

That exact same lingering doubt from Colin McRae came roaring back. Plenty of open-source decomp and recomp projects hit dead-on 1:1 accuracy. So I finally stopped brute-forcing prompts and did what I should have done on day one: I studied the source code of 16 successful open-source recompilation projects to see what they actually do under the hood.

The postmortem: why LLMs drift so badly in game reverse engineering

Auditing the full 1,434-step Streets of Rage 2 transcript alongside the Colin McRae codebase exposed structural failure modes that will bite any developer who points an LLM at a binary without mechanical guardrails.

Mistake number one was misreading what REA does. rea-agents (229 tools wrapping Ghidra, Kuna, IDA, Frida, and GDB) is an inspection microscope and provenance ledger; it was never a magic “ROM-to-Godot” compiler. Worse yet, checking the raw tool logs from the Streets of Rage 2 session showed zero calls to REA MCP across all 1,434 steps (all 117 MCP calls went to godot-mcp), while the agent improvised ad-hoc Python scripts over raw ROM bytes.

Mistake number two was what I call the prose compression bottleneck. Before touching Godot, the agent summarized the entire Motorola 68000 engine of Streets of Rage 2 (4 heroes, 21 enemy and boss AI state machines, grabs, weapons, camera locks, heightmaps) into half a dozen Markdown files totaling 14 KB of prose (02_physics_and_player_movesets.md was 38 lines; 04_enemies_bosses_and_ai.md was 35 lines). Once the agent started writing GDScript, it coded from its own 35-line summary and filled every gap with generic 2D beat-’em-up heuristics from pretraining.

When I pushed back on the bugs and demanded ROM provenance addresses so nothing would be guessed, mistake number three showed up: provenance theater. The agent dutifully slapped @rom 0x1EF49C comments at the top of files while keeping 100% invented formulas right underneath them, like these actual lines from enemy_ai.gd and player_fighter.gd:

# @rom 0x1EF49C (21 Genesis enemy/boss classes collapsed into one invented match!)
static func get_desired_range(enemy_slug: String, is_boss: bool) -> float:
    match enemy_slug:
        "mr_x": return 135.0
        "jack", "ninja_kunai": return 105.0
        "signal", "jet", "zamza", "abadede": return 88.0

# OS wall-clock timer and float sin() for a 1992 Motorola 68000 cartridge:
if en.enemy_slug == "jet":
    en.pos_y = 22.0 + sin(float(Time.get_ticks_msec()) * 0.006) * 4.0

# Rotating a PNG by -135 degrees (the Mega Drive VDP has zero sprite rotation!):
_weapon_sprite.rotation_degrees = -135.0 * f

In the real cartridge, 0x00DE00 is a jump table dispatching each of the 21 enemy and boss IDs to its own dedicated M68000 state machine, and the lead pipe uses discrete multi-angle tiles paired with a per-frame (dx, dy) hand-anchor lookup table. Even the Python stage extractor (extract_stages.py) made up math: instead of disassembling the ROM’s $FC44 scroll subsections and $FCD6 BCD timers, it divided stage pixel width evenly (sr / len(sec_list) * max_w), locked the camera every fixed 320 pixels, and hardcoded if stage_num == 1 band-aids wherever I sent a screenshot.

And how did 56/56 automated tests stay green the whole time? Tautological self-certifying tests:

  • To stop Jack’s infinite knife loop, the agent invented jack.ai_cooldown = 60 and wrote a test asserting assert(jack.ai_cooldown >= 60).
  • To position the pipe sprite, it invented offset = Vector2(-6.0, -4.0) and wrote a test asserting assert(offset == Vector2(-6.0, -4.0)).

Unit tests that check an agent’s candidate code against constants invented by the exact same agent only lock hallucinations in place behind a green CI badge.

The kicker was sitting right inside tools/. Early on, the agent had built a working headless C runner (md_oracle.c) around genesis_plus_gx_libretro.so to record all 27 BGM tracks and 22 SFX straight off the emulated YM2612 synth, which made the audio 100% authentic immediately. For gameplay, physics, and spawns, that oracle sat completely untouched while I played human QA.

Over in rea-colin-mcrae-recomp, engineering discipline was much tighter (2,168 Ghidra procedures tracked with Q16.16 fixed-point math), yet a full audit still found silent drift across 31.7% of core 1P functions for the exact same reason: no live lockstep oracle against Rally.exe, plus routine tail truncation (369 functions marked complete after porting the first 50 lines and dropping the back half, leaving driver arms, wishbones, and cockpit gauges frozen, alongside Ghidra jb vs jl signedness traps that turned tire grip into black ice).

How successful open-source recomp projects actually work

I went through the source code of 16 modern recompilation and native-port repositories spanning Xbox 360 (UnleashedRecomp, fm4-static-recomp on ReXGlue and ShiftGlue), Original Xbox (soulcalibur2-recomp on xboxrecomp), PlayStation 4 (driveclub-recomp), PlayStation 2 (gt4-staticrecomp and PS2Recomp), PlayStation 3 (ps3recomp), Nintendo 64 (N64Recomp + RT64), Switch (Switch2RECOMP and mp4-recomp), 3DS (UprisingRecompiled), Sega Naomi 2 (VF4-Final-Tuned-Rev-B-Recomp), Sega Model 1 (vf1-recomp), PC Engine CD (RondoRecomp), and Super Nintendo (snesrecomp and SuperMarioAllStars).

One finding holds across every single one of them without exception:

Zero successful 1:1 projects ask an LLM (or a human) to rewrite game physics, AI, combat, or level scripts in prose or high-level engine scripts.

The lone counter-example in the group that ripped ROM tiles to .png and rewrote gameplay in 1,741 lines of Godot GDScript (Super-Mario-Bros.-Remastered-Public) flat-out warns in its own README that it does not replace the original games and documents corner-collision quirks, camera-barrier bugs, and entity jitter.

Every project that hits 100% fidelity preserves all of the original compiled instructions (anywhere from 6,000 to over 153,000 functions) and read-only data tables mechanically, either through an ahead-of-time static instruction lifter to C/C++ or by executing native machine code directly when the host shares the same CPU ISA (legacy Win32 PC games and the PS4, which is already x86-64 FreeBSD/Orbis).

Where do LLMs and REA deliver 10x leverage? Everywhere around the binary:

  • Building and fuzz-testing the deterministic instruction lifter (PPC, ARM64, MIPS, SH-4, M68k, 65816 to C).
  • Implementing OS kernel HLE syscalls (Xbox, Orbis, Horizon, PS2/PS3).
  • Translating legacy GPU command streams and shaders (Xenos, NV2A, NVN, GS, GX, PICA200, VDP) to Vulkan or Direct3D 12, plus emulating hardware audio DSPs.
  • Writing surgical, reversible post-lift hooks (16:9/21:9 widescreen, 144/240 Hz camera and pose interpolation while keeping the internal simulation tick locked at 25/30/60 Hz without ever multiplying game physics by float delta).
  • Building automated differential verification oracles (such as gt4-staticrecomp validating PS2 Booth-truncated float multiplies against 592 encrypted replay demos on the retail disc, or RondoRecomp diffing 402,593 chunk calls against a reference interpreter with zero differences).

F-Zero AX Monster Ride running at high resolution through the Nintendo arcade launcher hub

The 4 paradigms: picking the right architecture before you write a line of code

Before starting any game reverse-engineering project, map your goal onto the four tiers below and always pick the lowest-numbered tier that satisfies what you actually need:

Tier / ParadigmHow game code runs1:1 guaranteeEngine editabilityWhen to use it
Tier 1: Native Loader + HooksOriginal x86 / x86-64 machine code runs directly on the host CPU with API wrappers and memory patches100% native on Day 1Low (external Rust/C++ hook modules)Legacy PC games (rea-launcher-sdk) and PlayStation 4 (eboot.bin mapped below 1 TiB + shadPS4 Vulkan)
Tier 2: Static Binary Recompilation (AOT)Mechanical lifter translates 100% of ROM/EXE instructions to C/C++ over guest virtual RAMNear-100% automatic (verified via --verify)Medium (symbol overrides and mid-asm hooks)Console and arcade exclusives (X360, Xbox, Switch, N64, PS2, PS3, GC/Wii/WiiU, 3DS, SNES, Genesis, Dreamcast/Naomi)
Tier 3: Hybrid Core in a Modern EngineLifted C (or a tiny CPU runner) lives inside a GDExtension / native plugin while maps and sprites live in Godot/Unity100% original feel on Day 1High (TileMap, SpriteFrames, and Inspector live)When you want to open, study, and edit the game in Godot or Unity without losing original physics and AI
Tier 4: Pure Rewritten Engine Port (GDScript / Rust / C#)Logic and table interpreters rewritten in the target language from raw disassembly0% automatic (extreme LLM drift risk)Maximum (100% idiomatic engine code)Only when zero C/binary code is a hard requirement and you build a frame-by-frame differential oracle before gameplay

Diagram comparing the 4 architectural tiers for 1:1 game recompilation and engine porting with REA

The step-by-step playbook for an REA project

Once you respect that architectural boundary, the workflow splits cleanly depending on whether you want a binary-exact native build (Tiers 1 and 2) or a modern engine port in Godot or Unity (Tiers 3 and 4).

Path A: Binary-exact 1:1 native port (modern PC, 4K, 120+ FPS)

  1. M0 (Artifact pinning and repo hygiene): record the SHA-256 of your legally owned ROM, ISO, or executable in binary-manifest.json, and keep every copyrighted binary and generated/ directory inside .gitignore. Use REA (inspect_pe_imports, inspect_binary_layout, open_binary) to locate sections, jump tables, and OS boundaries without dumping thousands of decompiled functions into the LLM’s context window.
  2. M1 (Deterministic lifter and strict FPU discipline): pick the established platform lifter (ReXGlue/ShiftGlue on X360, xboxrecomp on Xbox, N64Recomp on N64, Switch2RECOMP on Switch, PS2Recomp/ps3recomp, snesrecomp, or an M68k -> C emitter). Compile with -fno-strict-aliasing and strict floating-point flags (/fp:strict), and fuzz single instructions against Unicorn until sign, carry, and denormal mismatches hit zero.
  3. M2 (Headless lockstep gate): before touching a windowing library, boot the lifted binary headlessly and compare register plus RAM hashes every N frames (--verify N) against a reference interpreter or emulator.
  4. M3 to M5 (GPU, audio, and A/B enhancements): bring up your Vulkan translator and audio DSP against a reference CPU rasterizer or emulator frame dump. Put 4K scaling, Hor+ widescreen, and 144/240 Hz pose interpolation behind runtime A/B switches proving that with the switch off, guest simulation state stays bit-identical to the original. Never hand-edit generated .c files; apply patches via deterministic scripts that assert exact instruction bytes before patching.

1990’s Rad Mobile running with a CRT shader, arcade cabinet bezel, and synthesized force feedback driven from live game memory

Path B: Translating into Godot, Unity, or idiomatic Rust without losing 1:1

If your whole goal is opening Streets of Rage 2 (or any 8/16/32-bit classic) inside Godot 4 or Unity to study game architecture and build new content, you have two drift-proof ways to pull it off:

Option 1 (Recommended): Hybrid GDExtension (or Unity Native Plugin) Core. Extract all sprites, palettes, tilemaps (TileMapLayer), hitboxes, and enemy spawn tables into native, editable Godot resources (.tres, .png, .json). Keep the frame-exact physics, grabs, and 21 enemy AI routines running as mechanically lifted C (or a tiny M68000 logic runner over a 64 KB Work RAM buffer) inside a GDExtension. Every 60 Hz tick, Godot pushes your Inspector/scene edits into the RAM table and reads (x, y, z, anim_id, hp) back out to drive Node2D scenes. You get 100% authentic gameplay on Day 1, full visual stage editing inside Godot, and the freedom to port routines from C to GDScript one at a time behind lockstep tests.

Option 2 (100% pure GDScript / C# / Rust): Verbatim extraction + CI RAM lockstep. If zero C or binary code at runtime is non-negotiable, wire four mechanical gates into make check before writing a single fighter script:

  1. Ban prose-intermediary coding: never implement gameplay from Markdown summaries. Translate directly against raw instructions (jb vs jl, 16.16 fixed-point math, exact bitmasks) and account for 100% of every [start..end] byte span in function-map.json so function tails cannot get truncated.
  2. Round-trip byte proofs on every table extractor: animations, (dx, dy, frame_id) weapon hand anchors, scroll locks, and enemy wave scripts are compact ROM bytecodes. Every Python extractor must pass pack(extract(rom_slice)) == rom_slice, making silent byte drops and invented formulas impossible.
  3. Headless differential RAM oracle before gameplay: on Genesis, 40 extra lines in md_oracle.c calling retro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM) on genesis_plus_gx_libretro.so dump frame-by-frame .jsonl traces of exact (x, y, z), state, animation, HP, camera, and RNG across scripted joypad inputs. On x86 PC games, run Rally.exe tick routines inside Unicorn at 25 Hz. Feed the identical input trace into godot --headless (or your Rust binary) and fail on the exact first diverging frame and field.
  4. Static anti-drift linter (check_no_drift.py): fail CI immediately if simulation code calls wall-clock timers (Time.get_ticks_msec(), Instant::now()), integrates by float delta, invokes generic engine physics (move_and_slide()), calls host RNG (randf()), adds unanchored per-stage hacks (if stage_num == 1), or writes parity tests that do not load an external oracle trace.

In AI-assisted reverse engineering, the iron rule is simple: expected values must always come from the original binary running inside an independent oracle. The moment an LLM writes the candidate code and also invents the test assertions, drift is guaranteed.

Practical prompt examples: what to actually ask the LLM

To make this concrete, compare how you steer the agent. When I kicked off the Godot experiment, my naive prompt basically said: “use REA to dissect the ROM, document all the physics and AI in Markdown files, and then reimplement it 1:1 in Godot”. That prompt practically forces the LLM to compress machine code into prose and hallucinate the rest.

Today, alongside locking those prohibitions inside a root AGENTS.md, I break the work into tight, stage-gated prompts that pin the architecture and demand a working oracle before any gameplay code is allowed to exist.

1. Kickoff prompt (Gate 0 + Headless Oracle before any gameplay code):

Inspect the target binary/ROM at <PATH> using REA MCP tools (inspect_binary_layout,
inspect_pe_imports, open_binary, xrefs, read_bytes). Do NOT write any gameplay code
and do NOT summarize game logic into prose markdown files.

Complete Milestone 0 only:
1. Record exact SHA-256/SHA-1 hashes in docs/binary-manifest.json and add all
   binaries, ROMs, extracted assets, and generated/ folders to .gitignore.
2. Map code/data sections and RAM struct offsets (player X/Y/Z, state, anim, HP,
   camera, RNG, enemy slots) into docs/ram-map.json, citing exact instruction addresses.
3. Build a headless reference oracle in tools/oracle/ (using libretro
   RETRO_MEMORY_SYSTEM_RAM for console ROMs, or Unicorn/Wine for x86 PC) that steps
   deterministic input bitmasks and dumps per-frame state to .oracle.jsonl.
4. Add tools/audit/check_no_drift.py to CI blocking wall-clock timers, host RNG,
   float delta physics, engine physics solvers, per-stage hacks, and parity tests
   that do not load an .oracle.jsonl fixture.
Stop and show me a verified 300-frame .oracle.jsonl dump before writing engine code.

2. Prompt for Native Static Recompilation (Tier 2: Consoles and Arcades -> C/Vulkan):

We are using Tier 2 (Static Binary Recompilation). Never rewrite game physics, AI,
or level logic by hand, and never hand-edit files inside generated/.

1. Configure the deterministic ISA-to-C lifter (<ReXGlue / N64Recomp / xboxrecomp /
   M68k-to-C>) over the pinned binary with -fno-strict-aliasing and strict FPU flags.
2. Build a Unicorn single-instruction + FPU conformance fuzzer in tests/isa/ covering
   signed/unsigned flags, carry/overflow, and denormals until mismatches == 0.
3. Add a headless --verify lockstep mode comparing register + RAM hashes every frame
   against the reference interpreter across 10,000 frames (0 divergences allowed).
4. Focus your implementation strictly on OS HLE syscalls, GPU command/shader
   translation to Vulkan, hardware DSP audio, and idempotent post_lift.py hooks
   (16:9 Hor+ and sub-tick render interpolation gated behind an A/B flag where
   OFF is bit-identical to the reference).

3. Prompt for a Modern Engine with a Hybrid Core (Tier 3: Godot GDExtension / Unity):

We are building a Tier 3 Hybrid Godot 4 port: 100% authentic Day-1 gameplay paired
with editable Godot scenes and resources.

1. Write deterministic Python extractors in tools/extractors/ for tiles, palettes,
   sprites, hitboxes, and stage spawn tables into native Godot resources (.tres,
   TileMapLayer, SpriteFrames). Every extractor MUST pass a byte round-trip test:
   pack(extract(rom_slice)) == rom_slice, with zero silent padding drops.
2. Keep the original frame-exact gameplay logic inside a C/Rust GDExtension module
   (mechanically lifted routines over a 64 KB Work RAM buffer at fixed 60 Hz).
3. Sync Godot Inspector/scene resource edits into the shadow RAM table on stage load,
   and sync entity (x, y, z, anim_id, facing, hp) out to Node2D scenes every tick.
4. Verify via godot --headless that a 1,200-frame combat trace matches .oracle.jsonl
   with 0 coordinate or HP delta.

4. Prompt for porting pure GDScript / Rust routines without drift (Tier 4):

Port ONLY the player grab/vault state machine [0xSTART..0xEND] from raw disassembly
using REA (analyze_function, read_bytes, trace_native_values).

Hard constraints:
- Read raw instructions directly (check jb/ja vs jl/jg, Q16.16 fixed-point shifts,
  and exact bitmasks). Do not code from prose notes.
- Account for 100% of bytes in [0xSTART..0xEND] in docs/function-map.json. Zero
  omitted branches or truncated function tails.
- Record 5 deterministic input traces in the headless oracle covering front grab,
  pummel, 28-frame vault, back throw, and walk-away release.
- Run those exact input traces in godot --headless (fixed 60 Hz integer math) and
  diff every frame against .oracle.jsonl. Do NOT write self-referential unit tests
  with invented constants; iterate until frame divergence == 0 and make check passes.

Earlier today I put this exact discipline to work on both projects that had left me dissatisfied. In rea-colin-mcrae-recomp, wiring a 25 Hz Unicorn lockstep oracle against Rally.exe across 600 closed-loop ticks with zero-LSB error immediately exposed a 25x body-roll dt bug, closed all 369 truncated function tails (including full 3D cockpit interiors across all 14 cars and 16-bit RGB565 blending), and shipped v0.1.9. Over in rea-godot-streets-of-rage-2, plugging in the Genesis RAM differential oracle and the anti-drift linter wiped out those sin() and PNG-rotation hacks in favor of discrete ROM weapon anchors, all 21 dedicated M68000 AI state machines, and the exact 28-frame shoulder-pivot vault and suplex engine.

Pairing AI coding agents with REA turns reverse-engineering marathons that used to take two years into a matter of days. Just keep the AI aimed where it shines (tooling, verified extractors, HLE, shaders, and differential oracles) and never let prose stand in for machine semantics.