San Francisco Rush 2049: Recompiled

San Francisco Rush 2049: Recompiled is a native PC port of the N64 game that runs the game's code natively with high resolutions and 60fps.

README

San Francisco Rush 2049: Recompiled

Made with AI. Almost all of the code, documentation and tests in this repo were written by AI agents (Claude), directed and play-tested by a person. None of it is offered to the upstream projects it builds on, which don't take AI-written code.

A native PC port of the N64 version of San Francisco Rush 2049, made by static recompilation (N64Recomp + N64ModernRuntime + RT64): the game's own MIPS code translated to C and run natively, with RT64 drawing it. It is not an emulator and it contains no game data: you supply your own ROM.

Status: playable on Windows. Menus, Single Race, Circuit, Ghost Race, Stunt and Battle run at full speed, all six race tracks race to the results screen, two- and four-player split screen renders, and Controller Pak saves survive a restart. There is a Linux build too, which boots and runs the title screen and first attract race with a software Vulkan driver (that driver then crashes on a bug of its own), but nobody has played it on a Linux GPU or a Steam Deck yet. Split screen with a controller for each player has only been tried with virtual controllers.

In a browser: play it here, with your own ROM. The same game builds as a web page (see In a browser below), with the launcher and menus, sound, keyboard controls, and your ROM picked from disk and kept in the browser, never uploaded. It plays the title screen, the menus and races in Chrome at close to 60 frames a second, as the desktop build does. Play it in Chrome or Edge: Firefox draws it slowly on many computers. The web support works for every N64 recomp, not just this one, and lives in a project of its own, N64Recomp-browser. Banjo-Kazooie: Recompiled plays in Chrome on it too, in a fork of its own, BanjoRecomp-web (not made by the Banjo team), and so does Majora's Mask in Zelda 64: Recompiled, in Zelda64Recomp-web (not made by the Zelda 64: Recompiled team), Donkey Kong 64: Recompiled, in Donkey-Kong-64-Recompiled-web (not made by its team), and Conker's Bad Fur Day: Recompiled, in CBFD-Recompiled-web (not made by its authors). Those ports are there to build out and test the web support on more games than this one: what one of them turns up is fixed in the web support, so every game gets it, this one included.

Modern enhancements

Every one of these is an option in the recomp's settings menu (General, Graphics and Sound tabs), and every option has an Original value that runs the game as it shipped.

  • High resolution: renders at the window's size, up to 4K and beyond, instead of 320×240, with 2× MSAA.
  • Hi-res menu and HUD text: the game's bitmap fonts are upscaled instead of drawn as 240p blocks.
  • Hi-res title screen: the title picture is drawn from a 4× AI upscale (Real-ESRGAN) instead of at 240p. The repo ships only a patch, which the game applies to its own picture.
  • 60 fps and unlocked frame rates: the game logic runs at 60 instead of 30, and on a high-refresh monitor RT64 interpolates between frames up to the display's refresh rate. In a browser it runs at 30 while the device can't keep 60 up, which a phone plays more smoothly.
  • Lower input lag: each frame is drawn as soon as the game has worked it out instead of at the next screen refresh, so what you press shows on screen one frame (17 ms) sooner at 60 fps.
  • Widescreen: 3D widens to the window's aspect ratio, the race HUD moves out to the edges, two- and four-player split screen fills the window, and the menu background is carried out into the side bars.
  • Draw distance and detail: distant scenery is drawn from four times as far, so less of it pops in, the flat backdrops of far hills and buildings stay at their own distance instead of cutting into the scenery in front of them, and models keep their detailed versions four times as far out, so curves stay round and small details stay in view.
  • No scenery culling: the whole track's scenery is drawn wherever you are. The game left out what it reckoned couldn't be seen from the stretch of road you were on, so buildings, walls and signs popped in and out as you drove from one stretch into the next, some of them a few car lengths away. On a weaker PC, Reduced draws only what can be seen from the stretches around you, and the tallest towers and any building that already looks more than a sliver tall from where you are, or low but wide, above you or down a slope, wherever it is in view (the game's lists leave out much that can be seen from far off), so scenery comes in well ahead of the car, while it is still small, for a fraction of the cost.
  • See-through scenery in order: trees, lamps, sails and glass are see-through pictures that the game draws wherever they come in its list, so solid scenery behind one that happened to be drawn after it painted over it: the tree by the sculpture on Track 1 was half see-through against the track behind it. See-through scenery is now drawn after the rest of the scene, farthest first, so it shows over whatever is behind it: a street lamp and a sail at Track 1's start cover the boats behind them, not the other way round. The cars' effects and the ghosts' arrows are still drawn over it.
  • Ghost arrows after the scenery: the arrow over a ghost was drawn before part of the scenery, which then painted over it however far behind the ghost it was: on Track 1 the buildings beside the straight after the Slim Jim sign, and the signal arm on the bridge at its end, cut into the arrows of ghosts in plain view. The arrows are now drawn after the scenery, so only what is between you and an arrow covers it, and only the part of it behind that: a sign a ghost drives under no longer makes its arrow blink out.
  • Enhanced audio: MusyX music and sound effects are mixed at 44.1 kHz with a better interpolator instead of the game's 22.05 kHz mix, loud peaks are softly limited instead of clipping, and playback no longer skips or drops out when the audio output falls behind.
  • Rewind: hold Rewind (Backspace, or the left stick click) in a single-player race to run the race backwards, up to about a minute.
  • Save Ghosts: after a Ghost Race finished inside the time limit, the game's own SAVE GHOST prompt comes up and writes the ghost to the Controller Pak, where it is offered in later Ghost Races on that track, after a restart too. It shows the ghost each pak already holds for that track and asks before replacing it. As shipped, the game kept a ghost only until you quit (as GHOST 1) and showed the prompt only for a developer's profile name. Saving needs a player profile on the pak: Just Play has none, so it keeps the ghost for the session.
  • Large 4-player map: where the four views of a 4-player split screen meet, the track map is the 64-pixel one 1 to 3 players see, see-through as theirs, instead of a 32-pixel picture on a dark square with the cars' markers on top of each other.
  • Races for 3 and 4 players: Single Race and Practice are offered to 3 and 4 players, each in a quarter of the screen (with 3, the fourth quarter shows the track map and the clock). As shipped they were for 1 or 2 players, and only Stunt and Battle took more. Computer cars race with them as with 1 and 2 players: 3 with 3 players, 1 with 4.
  • Race position always shown: a player's race position stays on the HUD after a crash. As shipped it went off the screen while the car was wrecked and for 5 seconds after it was put back on the track, 7-8 seconds a crash.
  • Large Controller Paks: about 1.9 MB of save space per pak instead of 32 KiB, so ghosts and profiles don't run out of room.
  • Rumble and saves together: every controller has both a Controller Pak and a Rumble Pak in, so races rumble and players, records and ghosts still save. A real controller holds one or the other.
  • Modern controls: keyboard and gamepad (Xbox, PlayStation, Switch Pro, and N64/GameCube adapters) with driving-friendly defaults, rebindable on the Controls tab. Each controller is a player of its own, as on the console (see Controls).
  • Mouse cursor on screen: off by default. Set Mouse Cursor to Always Shown and the cursor stays where you left it while you play with a controller or the keyboard, to point at things in a recording, or to Shown While Moving and it shows whenever the mouse moves, with a controller too, and hides once the mouse has been still for two seconds. Otherwise it hides as soon as a controller or a key is pressed, until the mouse moves.
  • No frame copies to RAM: each frame stays on the GPU instead of also being drawn again at 320×240 and copied back into the console's memory, which the game isn't known to read. Saves GPU time, and about 6 ms a frame in a browser.
  • Light on the CPU: the game holds 60 fps on a single CPU core, and a 4-player race spreads over a few more. On a weak GPU, see Performance.

Settings are saved as JSON in %LOCALAPPDATA%\Rush2049Recompiled\ (~/.config/Rush2049Recompiled/ on Linux), or in the working directory when it holds a portable.txt, so they can also be edited by hand while the game is closed. Controller Pak saves are there too, as saves/controllerpak_<port>.mpk (the .mpk format emulators use); one can be a symlink, to share saves through a synced folder, and stays one when the game saves. Start held down while the game starts opens the game's own CONTROLLER PAK screen, as on the console: A on a controller lists its pak's notes, where one can be deleted, and B goes back, then on to the game, with nothing changed. For the game exactly as it shipped, set every Original value:

EnhancementOptionKeyDefaultOriginal
60 fpsGame Frame Rategraphics.json game_frame_rate"60" ("MatchFramerate" draws above 60, at the rate Framerate presents)"Original" (30 fps)
Smooth motion on high-refresh displaysFramerategraphics.json rr_option"Display" (the monitor's refresh rate, interpolating between the game's frames)"Original"
Lower input lagInput Laggraphics.json input_lag"Reduced" (60 fps and above)"Original"
Widescreen 3DAspect Ratiographics.json ar_option"Expand""Original" (4:3)
Widescreen race HUDHUD Placementgraphics.json hr_option"Clamp16x9""Original"
Large 4-player mapSplit-Screen Mapgraphics.json split_screen_map"Large""Original" (32 pixels, on a dark square)
Widescreen split screenSplit-Screen Aspect Ratiographics.json split_screen_ratio"Expand" (as wide as HUD Placement allows; "Full": the whole window, whatever HUD Placement says; both need Aspect Ratio at Expand and HUD Placement other than Original)"Original" (4:3, pillarboxed)
Widescreen menusMenu Aspect Ratiographics.json menu_ratio"Expand" (up to about 21:9; needs Aspect Ratio at Expand)"Original" (4:3, pillarboxed)
Draw distanceDraw Distancegraphics.json draw_distance"Far" (4×; "Farthest" is 16×)"Original"
Model detailLevel of Detailgraphics.json level_of_detail"High" (4× the distances; "Highest": always the most detailed)"Original"
No scenery cullingScenery Cullinggraphics.json scenery_culling"Off" ("Original" in a browser; "Reduced": what can be seen from the stretches around you, the tallest towers and any building that looks tall or wide from where you are)"Original"
See-through scenery in orderSee-Through Ordergraphics.json see_through_order"Sorted""Original"
Ghost arrows after the sceneryGhost Arrowsgraphics.json ghost_arrows"AfterScenery""Original"
Rendering resolutionResolutiongraphics.json res_option"Auto" (window size)"Original" (320×240)
Anti-aliasingMS Anti-Aliasinggraphics.json msaa_option"MSAA2X""None"
Hi-res menu and HUD textHi-res Fontgraphics.json hires_font"On""Off"
Hi-res title screenHi-res Title Screengraphics.json hires_title"On""Original" (240p)
No frame copies to RAMCopy Frames to RAMgraphics.json copy_frames_to_ram"Off" (takes effect on the next start)"Original" (every frame copied)
44.1 kHz MusyX mixMusyX Mixingsound.json musyx_mix"HighQuality""Original" (22.05 kHz)
Rumble and saves togetherController Accessorygeneral.json accessory"Both""Controller Pak" (saves, no rumble) or "Rumble Pak" (rumble, no saves)
Large Controller PaksController Pak Sizegeneral.json pak_size"Large" (62 banks, about 1.9 MB)"Original" (32 KiB)
RewindRewindgeneral.json rewind"On""Off"
Save GhostsSave Ghostsgeneral.json save_ghosts"On""Original" (no SAVE GHOST prompt)
Races for 3 and 4 playersRace Playersgeneral.json race_players"UpToFour""Original" (races for 1 or 2)
Race position always shownRace Positiongeneral.json race_position"Always""Original" (off the screen for a while after a crash)
Mouse cursor on screenMouse Cursorgeneral.json mouse_cursor"Original" ("Shown" keeps it on screen while a controller or the keyboard is used; "Moving" shows it while the mouse moves and hides it after two seconds still)"Original" (hidden once a controller or a key is pressed, until the mouse moves)

Not options, because they don't change the game: the keyboard and gamepad layouts, playback at half the game's sample level so its mix doesn't clip, and the Expansion Pak, which the game was built for.

Getting it running

You need your own copy of the game either way. A release on the Releases page is the game without the ROM, for Windows (a zip: unzip it and run Rush2049Recompiled.exe from that folder, see Run below) and for Linux on x86-64 (a .tar.gz: extract it and run Rush2049Recompiled in that folder). The Linux build needs glibc 2.35 or newer (Ubuntu 22.04, Debian 12 or later), a Vulkan driver, and GTK 3 and FreeType, which desktop distributions have; it brings its own SDL2. Otherwise build it from source.

The ROM. San Francisco Rush 2049 (U), the US release, as a .z64 with SHA-1 3f99351d7bb61656614bdb2aa1a90cfe55d1922c. The build and the launcher both check its hash. Other regions and revisions are not supported. The launcher also takes it packed in a .zip, .7z, .gz, .xz or .tar (a .tar.gz or .tar.xz too) and finds the ROM inside.

The toolchain (Windows): LLVM's clang-cl 15 or newer with the MSVC build tools and the Windows SDK, CMake 3.x (CMake 4 rejects some of the submodules), Ninja, GNU make, Python 3.11, and for the mod-support library a clang built with the MIPS target (MSYS2's is; llvm.org's Windows builds are not) plus ld.lld. Make a Python venv at .venv with spimdisasm, rabbitizer and numpy. On Linux (Ubuntu 24.04, what CI builds; releases are built on 22.04, tools/docker/Dockerfile.linux): clang lld libsdl2-dev libgtk-3-dev libfreetype-dev, CMake 3.31 and Ninja, and pass -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ to tools/recompile.sh and to the configure.

Build, from the repo root in a bash shell:

git -c core.longpaths=true submodule update --init --recursive   # paths past Windows' 260 characters
bash tools/apply_runtime_patches.sh            # the web support and our fixes, on the submodules
.venv/Scripts/python -I tools/extract.py "<your Rush 2049 ROM>.z64"   # writes roms/
bash tools/recompile.sh -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl   # the game's code as C
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl \
      -DPATCHES_C_COMPILER=<MIPS clang> -DPATCHES_LD=<ld.lld>
ninja -C build Rush2049Recompiled

With ccache on PATH every compile goes through it, so a new build dir or another checkout of the same code compiles only what changed since the last build on that computer (CMakeLists.txt says how).

tools/recompile.sh builds N64Recomp from the submodule the first time, then translates the game. After a change to us.toml or syms/, run it again before ninja. To change the symbols, edit syms/names.toml and run tools/gen_syms.py, which needs the libultra signatures: git clone https://github.com/shygoo/n64sym ref/n64sym (MIT).

Run build/Rush2049Recompiled.exe from the repo's root. The launcher finds the ROM by itself if it sits in a usual place (the working directory, roms/, Downloads, Desktop, Documents and one level of subfolders), packed in an archive or not, otherwise pick it, or an archive holding it, with Load ROM. It opens no console window and writes its log to rush2049.log in the folder its settings are in (above: beside the exe with a portable.txt), keeping the run before as rush2049.old.log; to watch the log as it plays, run it with --show-console instead.

If it crashes, the log ends with where it crashed: open an issue with rush2049.log attached (or rush2049.old.log, if you have started the game again since) and what you were doing. If it hangs on Linux, end it (Exit Game in Steam, or kill with its process id, not kill -9): the log then ends with what every thread was doing. Send it before starting the game again, or send rush2049.old.log. On Linux the log is written from Steam, from a desktop launcher and from the file manager alike; only started from a terminal does the game write no rush2049.log and print the log there instead. On Windows the same goes for a launcher that keeps the game's output (a frontend with a log of its own): there is no rush2049.log, and the log is the one that launcher shows or saves.

In a browser

The page is at https://n64hub.com/rush-2049/. Play it in Chrome or Edge 113 or newer, on Windows, macOS or ChromeOS. Firefox 141 or newer on Windows runs it too, but draws it slowly on many computers, a laptop's integrated graphics above all, and the page recommends Chrome or Edge when it opens there. Safari hasn't been tried. Open it, click Load ROM and pick your .z64: the page checks it as the desktop launcher does and keeps a copy in the browser's own storage (IndexedDB) for that site, so the next visit starts without asking. Nothing is uploaded; the ROM never leaves your computer. Settings and Controller Pak saves are kept in the same storage, written back every couple of seconds and when you leave the page. Clearing the site's data in the browser removes all of it.

What differs from the desktop build: no mods, no MSAA and no HDR output. The launcher has no Mods or Exit: close the tab to leave. The keyboard works as below, and gamepads the browser knows the layout of (it calls them standard, as it does Xbox and PlayStation pads) use the same bindings, with rumble where the browser supports it (Chrome and Edge). Press a button once the page is open: a browser only shows a page its gamepads after that.

The first time the game starts, the browser builds the shaders the game draws with, a fast one for each effect. In Chrome and Edge it builds them behind the game while the logos and the title play, so at most the game pa