Articles

Super Mario 64 Has Been Completely Decompiled, Source Code Available

Super Mario 64 Has Been Completely Decompiled, Source Code Available

When you think about it for a minute, Super Mario 64 has to be one of the best understand games in the world. From videos by folk like pannenkoek to speedruns and mods, it seems virtually everything about the game has been documented online at this point. Heck, with a few videos and wiki reads alone, you could probably learn enough about the game to pass a course in N64 era assembly coding!

But there has always been further the community could go. Because while the mods and videos are impressive, up until now no one really knew how the game was coded on a deeper level. They knew the assembly side of it and how that functioned, but not how things were coded or laid out before the game was compiled for the system. It was a bit of a black box really, albeit one people forced open with insane perservance.

However, that’s now all changed. Why? Because as the story title suggests, the entire game has now been entirely decompiled, and the source code posted online for anyone to see. Here’s a topic about it courtesy of GBATemp.

As well as the ID (5644072) for a Warosu archive of a 4chan thread about the project which should be looked up for more details.

Mario 64 Decompiled Files

Some of the contents of the decompiled game files

It’s certainly an impressive project, we’ll say that much. Plus one confirmed accurate by how anyone who runs the code ends up with a byte by byte identical ROM of the title.

However, it also kinda made us wonder something. Namely, how did this all work?

How in god’s name could anyone literally reverse engineer a 20+ year old Nintendo 64 game without any access to the original source?

Well from what we’ve heard on the grapevine, it’s all because Nintendo made an… interesting decision when assembling the game. Basically, they didn’t turn on the optimisation flags usually used to reduce the size of the source code and obfuscate its structure in order to save a few bytes or cycles.

Instead, they just compiled straight from the original code to the assembly run on the N64.

This meant the team behind this project could just read the assembly code, then rewrite the functions and test with the original system compiler/toolchain until they ended up with a perfect copy of the original game.

Now, of course that didn’t mean it was easy per se. Oh no, when you look at the amount of work required to recreate the original game’s development setup on a modern PC, it rather boggles the mind. They emulated the original workstation’s OS (an old version of IRIX) in order to run a 90s era N64 SDK/devkit identical to the one the original game’s programmers used to build the game in the first place.

And apparently the best minds in the Mario 64 community were involved in it too. It’s not exactly stated publically at this point who’s helming the project, but word has it that the likes of Kaze Emanuar and Pannenkoek2012 are involved in this thing, along with a fair few longtime members of the TAS community.

It’s also only about 65% complete too. That’s because while most of the code has been disassembled, some function and variable names haven’t been cleared up as much as they could be.

So that’s the status of the project, the team behind it and how it was done.

But what about the uses for it? What could a decompiled version of Mario 64 bring to the table?

Well a couple of things really. It’ll make the significantly easier to understand for modders, since they’ll know what the original code was for a piece of behaviour and how Nintendo intended it to function rather than having to figure out the assembly code for it.

And it’ll also make native versions of the game easier to create too. Hence people should (in theory) be able to create versions of this game for modern computer operating systems and devices, rather than having to run emulators to play it. That’s quite a performance boost right there, especially given how ‘expensive’ emulation is computationally speaking.

Plus it’s provided people a few chances to spot and fix some of Nintendo’s own mistakes, making the game run better now than it ever did back in the game. For instance, you know how the game wasn’t optimised properly?

Yeah, apparently that hurts its in game performance too. Running the compiler again with the right flags active apparently sped it up a fair bit tooo, and removed virtually all lag present in the original game in the process.

Pretty cool really. It’s like the community’s gotten so advanced now, they’re literally building a better Super Mario 64 than the developers did!

So if you’re interested, give the topics linked a read, and maybe go look for the source code yourself. There’s certainly some interesting stuff to learn here, and it all provides a fascinating bit of insight into how both Super Mario 64 and Nintendo 64 development as a whole worked back in the 90s.

Source:

Super Mario 64 Has Been Decompiled (GBATemp)

1 Comment

  1. Is tooo spelled right? No, that’s spelled wrong. But that’s not what you’re supposed to say, so you’re not supposed to say that. That’s a bad way to get views and, um… other things. But just don’t… Don’t use that one, okay? Oh, yeah? What are you doing? Bye, CM30. Bye.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment