The SM64 decompilation project is a fully hand-decompiled C source reconstruction of Super Mario 64. The codebase reproduces byte-for-byte matching ROMs for all five official releases of the game: Japan, North America, Europe, Shindou, and iQue Player. Naming and documentation of source code structures are ongoing. The project is the foundation for ports, mods, and research into how the original game works.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/n64decomp/sm64/llms.txt
Use this file to discover all available pages before exploring further.
What you can do with it
- Read and modify the original game logic in C
- Build a matching ROM from any of the five supported versions
- Apply patches or enhancements via the
enhancements/directory - Port the engine to non-N64 targets by disabling
TARGET_N64 - Study the rendering, physics, audio, and object systems as they were shipped
Supported ROM versions
Each version of the game has a unique SHA1 hash. When you build, the output is compared against the original ROM to confirm a match.| Version | Description | Output file | SHA1 |
|---|---|---|---|
us | 1996 North America (default) | sm64.us.z64 | 9bef1128717f958171a4afac3ed78ee2bb4e86ce |
jp | 1996 Japan | sm64.jp.z64 | 8a20a5c83d6ceb0f0506cfc9fa20d8f438cafe51 |
eu | 1997 PAL Europe | sm64.eu.z64 | 4ac5721683d0e0b6bbb561b58a71740845dceea9 |
sh | 1997 Japan Shindou (Rumble Pak) | sm64.sh.z64 | 3f319ae697533a255a1003d09202379d78d5a2e0 |
cn | 2003 iQue Player (China) | sm64.cn.z64 | 2e1db2780985a1f068077dc0444b685f39cd90ec |
Prerequisites
The build system requires the following packages:- binutils-mips — MIPS cross-assembler and linker (e.g.
binutils-mips-linux-gnuon Debian/Ubuntu,mips64-elf-binutilson Arch AUR,mips64-linux-gnu-on RHEL/Fedora) - python3 — version 3.6 or later, used by asset extraction scripts
- pkgconf — package configuration tool used by the Makefile
- build-essential — standard C compiler toolchain (gcc, make, etc.)
The repository does not include game assets. You must supply a legally obtained original ROM named
baserom.<VERSION>.z64 and place it in the project root before building. The build system extracts assets from this file automatically.Build steps (Linux / Ubuntu)
Clone the repository
Clone from within a Linux shell. Keep the full path under 255 characters — longer paths cause build failures.
Place your baserom
Copy your original ROM into the project root, named to match the version you want to build:Supported version names:
us, jp, eu, sh, cn.Build variables
The Makefile exposes several variables you can set on the command line:| Variable | Default | Options | Description |
|---|---|---|---|
VERSION | us | jp, us, eu, sh, cn | Which ROM version to build |
GRUCODE | version-dependent | f3d_old, f3d_new, f3dex, f3dex2, f3dzex | RSP graphics microcode to use |
COMPARE | 1 | 0, 1 | Whether to compare the output ROM against the known SHA1 hash |
NON_MATCHING | — | — | Use functionally equivalent C where exact assembly match is not yet achieved |
CROSS | — | e.g. mips64-elf- | Cross-compiler prefix override |
macOS
Install Homebrew and the required packages, then usegmake instead of make (the macOS-bundled make is too old):
Docker
If you prefer not to install dependencies directly, you can build using Docker:build/ directory inside the mounted folder.