Super Mario 64's source code has been decompiled and officially released

supermario64.png

After having been decompiled back in July, the source code for Super Mario 64 has been completely reverse-engineered, and is now publicly available. Available on GitHub is a full decompilation of the beloved 3D platformer, Super Mario 64. The decompilation works for the NTSC-U and NTSC-J builds of the game, with (E) ROM support coming soon. To keep things legal, you will need to provide your own copy of the game, in order to compile the data, with the exact process being detailed, below. If you've ever wanted to see some of the magic that went into creating such an iconic game, you can now finally see into all of the finer details.

Linux
  1. For each version (jp/us/eu) that you want to build a ROM for, put an existing ROM at ./baserom.<version>.z64 for asset extraction.

  2. Install the following packages:
Debian / Ubuntu

  • git
  • binutils-mips-linux-gnu / mips64-elf (>= 2.27)
  • python3 (>= 3.7)
  • build-essential
  • pkg-config
  • zlib1g-dev
  • libaudiofile-dev
Arch Linux

  1. Install qemu-irix
3.a Options: 1. Clone https://github.com/n64decomp/qemu-irix to somewhere and follow its install instructions in the README. 2. Optionally, grab the prebuilt qemu-irix from the Releases section. 3. (Arch) Use AUR package qemu-irix-git

3.b (For options 1 or 2), copy executable qemu-irix from irix-linux-user to somewhere convenient with a relatively short path.

mkdir -p /opt/qemu-irix/bin
cp irix-linux-user/qemu-irix /opt/qemu-irix/bin

3.c Define QEMU_IRIX environment variable in your ~/.bashrc to point to this qemu-irix executable.

export QEMU_IRIX=/opt/qemu-irix/bin/qemu-irix

  1. Run make to build the ROM (defaults to us version). Make sure your path to the repo is not too long or else this process will error, as the emulated IDO compiler cannot handle paths longer than 255 characters. Build examples:
make VERSION=jp -j4 # build (J) version instead with 4 jobs
make VERSION=eu COMPARE=0 # non-matching EU version still WIP

Windows
For Windows, install WSL and a distro of your choice and follow the Linux guide.

:arrow: Source
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
28,409
Trophies
2
Location
Gaming Grotto
XP
25,862
Country
Poland
It's worth mentioning that this is source code from a decompiled binary, it's missing all of the original commentary and it's "written" as a machine would understand it, not necessarily as a programmer would code it, though the team has clearly made great strides in making it readable for the average Joe. This can make even simple functions quite difficult to wrap your head around, so it will take an experienced group of coders to make any significant use of this. What this does for average users is shedding a better light on the internal workings of the game, which is interesting in and out of itself. Very good, and an almost impossible task to achieve given the complexity of the average video game binary.
 

raxadian

Well-Known Member
Member
Joined
Nov 10, 2018
Messages
3,193
Trophies
1
Age
38
XP
2,956
Country
Argentina
very interesting, considering the amount of great romhacks we're already getting this could make some even more sophisticated things

People have created new levels for Super Mario Odyssey that work right into the Switch and there are open source games that are as close as they can get to Super Mario 64 without being eaten by Nintendo scary shark lawyers.

What this will do that will be truly great is making even easier to make your own Nintendo 64 game rom.
 

raxadian

Well-Known Member
Member
Joined
Nov 10, 2018
Messages
3,193
Trophies
1
Age
38
XP
2,956
Country
Argentina
Next YouTube Video: "Can you beat Super Mario 64 by recompiling the source code?"

The game was released incomplete and buggy as hell to compete with Crash Bandicot. The DS port is actually better and you can actually beat it without using the touchscreen on the levels.

In fact while is nicer to play the game on a big screen, I beat the DS game three times from zero, while the Nintendo 64 version was just played until I beat Bowser and I didn't even care to get all the Stars.
 
  • Like
Reactions: Ryccardo and cvskid
General chit-chat
Help Users
  • No one is chatting at the moment.
    Ophelia_Later @ Ophelia_Later: good night