fn64
How it works

Two ways in

To run natively, a game needs two things it does not ship with: native code for its own functions, and a runtime for everything those functions call. fn64 provides both. Which route you take depends on what you already have.


Routes

Pick a route

Both routes read the ROM from your disk and end up on the same Rust runtime. They differ in where the game's functions come from.

Route A C lane — N64Recomp

You already use N64Recomp

Keep its generated RecompiledFuncs/*.c. fn64’s build harness prepares and compiles those functions, registers their sections, and links their _recomp calls to the Rust ABI implementation.

Game code
Stays in the N64Recomp C lane.
Validation
A real C caller links the static library and exercises the external ABI.
Game data
Your local ROM still supplies it at runtime.
Crates
fn64-boot-harness, fn64-abi, fn64-runtime
Route B Rust lane — fn64-discover

You do not have a finished decomp

fn64 recompiles the ROM into typed Rust runners. fn64-discover recovers the function and section metadata the recompiler needs, and marks anything it could not prove as unresolved.

Starting point
You can start before the decomp is finished, and see exactly what is still unproven.
Unresolved sites
Listed by name, so you can see what is blocking.
Linking
Generated runners link directly to the Rust execution runtime.
Crates
fn64-discover, fn64-cpu-runtime-codegen, fn64-cpu-runtime, fn64-runtime

Stages

What each stage produces

Five stages, each its own crate. Every stage writes its output to disk, so you can swap or re-run one without rebuilding the rest. Each stage has a colour, and that colour follows it everywhere on this page and the home page.

Discover content-free metadata Recompile native code Execute frame + audio census Present rendered frame Prove graded evidence ARTIFACT ↑ per stage — inspect or re-run any one in isolation
// each stage writes an inspectable artifact and can be re-run on its own
01 Discover

Read a ROM, keep what can be proved, name what is still unresolved. Out: metadata, with no game content in it.

02 Recompile

Turn each MIPS function into a typed Rust runner. Out: native code.

03 Execute

Link the recompiled code against fn64’s runtime. Out: a frame and audio census.

04 Present

Draw graphics and mix audio through swappable backends. Out: a rendered frame.

05 Prove

Check ABI shape, generated code and determinism against runnable tests. Out: test results.


Checks

What you can check yourself

Five things in the repo you can run or read yourself. A fix for a deterministic bug needs one fresh regression run plus the suite it belongs to. A fix for a concurrency or timing bug falls back to repeated runs, twenty by default, and only when nothing stronger closes the interleaving. A green run tells you about the gate it exercised and nothing else.

c_smoke
Link-tests the ABI with a real C caller against the static library.
Instruction oracles
Generated callable bodies diffed against N64Recomp output.
scripts/lane-parity.sh
Compares the C lane against the Rust lane. It currently refuses to treat the legacy C output as the source of truth, because nothing has established that mechanically.
docs/PARITY-METHOD.md
Writes down the blind spot in each of those checks. A differential that cannot be run is not counted as evidence.
docs/ROADMAP.md
Every known gap, by name. Unimplemented behavior traps instead of returning zero.

Rendering

Rendering goes through one boundary

Graphics pass through a backend-neutral layer. The layer decides what gets drawn and the backend behind it only draws. That is what makes the backend swappable.

fn64-render render seam, backend-neutral ordered microcode admission fn64-render-reference deterministic, pure Rust, GPU-free oracle fn64-render-rt64 faithful lane, C++ behind one FFI crate fn64-render-wgpu early fixture, not wired to the shell yet fn64-render-conformance grades the backends
// the seam decides what to draw and the backend draws it. reference is the oracle; RT64 is the fast, hardware-faithful backend.
fn64-render
The boundary itself. It orders microcode admission and inspects completion, and knows nothing about any particular backend.
fn64-render-reference
A deterministic pure-Rust backend with a software rasteriser. Slow, but it needs no GPU and produces the same frame every time.
fn64-render-rt64
An FFI bridge to RT64 for the fast path. All C++ interop is quarantined in this one crate.
fn64-render-wgpu
A pure-Rust wgpu backend, today only the bounded M3.1 headless submission/readback lifecycle fixture: one synthetic 2x2 fill/FullSync packet, not connected to ABI, runtime, shell, VI or general RDP decoding, and no parity or performance claim rests on it yet.
fn64-render-conformance
Replay fixtures decoded in Rust, plus the RT64-versus-Rust parity check the backends are scored against. It fails closed.

The reference backend exists so there is something to compare against. It needs no GPU, no driver and no C++, so cargo test runs without a GPU and produces the same frame every time. There is a cross-backend pixel differential and it works, but it is narrow and runs by hand, because RT64 needs Vulkan, D3D12 or Metal and the CI machines do not have one. Widening it is on the roadmap.


Your content

Your content stays local

Both routes keep game content and title-specific work in your project. This repository holds tooling and runtime code only: no game assets, no ROM bytes, no recompiled game output. You supply the ROM, it is read locally, and everything derived from it stays on your disk and out of git.

The discovery tool only emits metadata, never game assets, so its output is safe to paste into an issue or commit to a public repo.


Licence

MIT OR Apache-2.0, checked at build time

fn64’s own code is MIT OR Apache-2.0. You can ship it, fork it, embed it in a commercial product, and license your own work on top of it however you like.

The dependency tree is permissive throughout, with no copyleft, but it is not MIT-only: winit and cpal are Apache-2.0, so a build that wants a window and audio takes Apache terms. The debug overlay also embeds egui’s default fonts, which carry OFL-1.1 and the Ubuntu Font Licence. Neither is onerous, and both want attribution in anything you distribute.

The runtime is clean-room in the usual sense: it was written from our own debugging notes, public documentation and MIT-licensed source, and nobody working on it read GPL implementation code.

The build checks this. N64Recomp’s generated C includes librecomp/sections.h unconditionally, because it was written for a GPL-3.0 runtime. fn64 ships its own header at that path and puts its include directory first, so the compiler picks up fn64’s version even when the original is installed. Your generated code links against the Rust runtime unchanged, and the GPL implementation is never compiled in.

RT64 is MIT and stays behind an FFI boundary in its own crate, so a port that does not want the C++ dependency can take the reference backend and never link it.