Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

N64Recomp/N64Recomp

Developer Tools

Recompiles N64 binaries into portable C code for native ports, patches, and fast standalone execution.

8,390
473
C++
MIT
3 years old

What it does

N64: Recompiled takes an N64 binary plus symbol and metadata information and statically recompiles it into C source that can be built for any platform. Each input function becomes a named C function, with instructions translated literally (for example, addiu becomes an ADD32 expression). Calls, tail-call jumps, and branch delay slots are handled during translation, and jump-table patterns can be turned into switch statements. The output is C, not an N64 emulator; a runtime supplies memory, macro implementations, and overlay function lookup. See How it Works.

The tool targets developers building native ports, standalone tools, or fast simulations of N64 code, and it can also handle statically linked and relocatable overlays. For relocatable overlays it emits relocation macros that the runtime resolves at load time; TLB-mapping relocations are listed as planned work. RSP microcode recompilation is supported, though RSP overlays are not yet. The README points to the N64ModernRuntime as the companion runtime and to Zelda 64: Recompiled as a working example.

Build and run

The recompiler is configured with a TOML file passed as the first argument. That file specifies input and output paths and can optionally stub functions, skip functions, or patch individual instructions. The required metadata currently comes from an ELF file, so you need a disassembly or decompilation setup for the target binary first; a custom metadata format is planned. The README says full option documentation is not available, but links an example TOML.

Build requirements are CMake 3.20+ and a C++20 compiler. Clone with submodules, then configure and build with CMake:

git clone --recurse-submodules https://github.com/N64Recomp/N64Recomp.git
cd N64Recomp
mkdir build && cd build
cmake ..
cmake --build .

After building, invoke the recompiler with your configuration file as the first argument. The resulting C files need a compatible runtime to compile and run; the README does not document a standalone command that produces a finished game executable from a raw ROM alone.

A single-file output mode emits every function into one C file, intended for compiling patched functions and letting the linker prefer them over the original object code; the README links a patch configuration and Makefile from Zelda 64: Recompiled as examples.

Constraints

You need an ELF with symbol and relocation metadata, which in practice means a disassembly or decompilation of the target. Output is C that expects runtime-provided macros and function lookup; without such a runtime it will not run. RSP overlays and TLB relocation support are not implemented. Modern MIPS GCC output may trip the recompiler because of optimizations, while older MIPS compilers and modern Clang targeting MIPS have been tested. Building requires recursive submodule initialization. The project is MIT-licensed.

HotRepo's take

N64: Recompiled appears in one HotRepo-tracked Hacker News thread from May 2024, with a short comment pointing to an earlier larger discussion (27 points, 6 days earlier) rather than adding technical commentary. There are no GitHub daily-rank snapshots or star-curve samples in the provided HotRepo record, so the 8,390-star, 473-fork totals describe cumulative interest only and cannot support a trend claim. The technical value is in the C output and runtime interface rather than a one-click ROM converter, which is the main thing to keep in mind when evaluating whether the tool fits a porting or patching workflow.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

N64: Recompiled
▲ 3 · 1 comment · May 25, 2024

You might also like

  1. vercel-labs/scriptcCompiles a subset of TypeScript and JavaScript into standalone native executables or WebAssembly, without requiring Node.js at runtime.TypeScript6,474
  2. adriadam10/mkw-recompStatically recompiles Mario Kart World into a native Linux/Windows PC program using your own game dump.C104