Super Mario 64 has been decompiled

Ecchi95

Well-Known Member
OP
Member
Joined
Jul 7, 2019
Messages
121
Trophies
0
Age
29
XP
891
Country
United States
It's still incomplete work.


It builds a 100% identical ROM of the game.

Code:
# Super Mario 64

This is a decompilation of Super Mario 64.

It builds the following rom(s):

* sm64.j.z64 `sha1: 8a20a5c83d6ceb0f0506cfc9fa20d8f438cafe51`
* sm64.u.z64 `sha1: 9bef1128717f958171a4afac3ed78ee2bb4e86ce`

To set up the repository, see [INSTALL.md](INSTALL.md).

Don't be lazy. Everything that has been given a name is more than enough to make use of it, even porting it to other systems or PC.
 
Last edited by Ecchi95,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
Is anyone going to talk about the contents besides me? This is the entire code of Super Mario 64 we have here.

I want to see people analyzing it.
To what end?

We have long seen some fairly ridiculous analysis of its mechanics done

For others playing along at home




What the source code will provide us as far as analysis goes I am not sure. I imagine most around here are of the "wake me up when we have a new port of it (better yet a nice HD port), the DS remake features are backported/recreated, there is an interesting mod made with it (while ROM hacking can achieve anything the hardware can do there are certain types of mods that only tend to get seen when source code in involved), we have a fixed up version, it gets adaptation to run one of Rare's efforts...." persuasion. If you are expecting people around here to be going over the code like it is an obfuscation contest and we are trying to tease out secrets then it is probably not going to happen for Mario 64, partially because it is so old and outclassed and partially because it is already pretty well understood -- if the mechanics are already known (and I did see a version of it compare virtual console and n64 hardware flaws in float processing for some kind of wall clip I think it was so I am guessing that speaks to much) then most of it is less source code fun and more use said mechanics to analyse points on the level data which is a different matter really.

That said if you have been looking at the contents, or following the results of those that are, what files are we looking at and what interesting things that might not have been as apparent before have been found as a result?
 

Ecchi95

Well-Known Member
OP
Member
Joined
Jul 7, 2019
Messages
121
Trophies
0
Age
29
XP
891
Country
United States
To what end?

We have long seen some fairly ridiculous analysis of its mechanics done

-stuff-

That said if you have been looking at the contents, or following the results of those that are, what files are we looking at and what interesting things that might not have been as apparent before have been found as a result?
It's the entire code for the finished commercial game. You can reference it for making your own 3D games. You can port it to other platforms.

People should be doing things with it right now.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
It's the entire code for the finished commercial game. You can reference it for making your own 3D games. You can port it to other platforms.

People should be doing things with it right now.
I got that. However we have far newer 3d engines available for free, and under even better licenses and nicer to work with code (this is first pass attempt at embedded C doing early stage 3d... it is not pretty code you can't help but play with, and with all the limitations discussed in the videos above, as well as related ones, it is not a stellar engine either). Ports are nice but not what many around here spend their time doing* -- you would do far better showcasing hacks, mods, fixes and tweaks, or cool speedrun type things.

*to say nothing of again it being early stage 3d with people doing embedded C that might not normally have used it on, on new hardware and attempting to show off a bit in the process. I imagine it is pretty far from anything I can compile with either one of the homebrew/ROM hacker compilers/assemblers or a common modern C compiler for the PC. A few months from now I imagine there will be a version more amenable to modern compilers but that is a few months from now. If I have to go through the utter ball ache of finding and installing a vintage compiler for the N64 (is it the sort of thing that installs fine on an otherwise vanilla X64 version of Windows 10 or is this a Windows 95 VM job?) I am going to need something to justify it.

Examples of things that might be nice or might catch someone around here's attention.
Most of us probably play N64 games on emulators and don't use one of the N64 pads to do it. Do you have a line on what we need to look at to create version with nicely remapped controls? Or maybe even some kind of macro or extra controls? (take hat off, easy triple jump for those that might not be able to play it otherwise, change some things from gesture control to something else). I don't much care for speedruns but others do so maybe a speed buildup option that does not take untold hours.
The camera, as with most early 3d games, sucks. Do you have some idea where the code might be so we can fine tune some variables to get it to behave better (perhaps more like the Rare efforts from later in the N64 life).
Hard mode is fun. Perhaps a line on what we might need to do to stop the water regen health thing (from a practical perspective then we could probably find what flag the ice world water uses but if I am looking at code), or maybe a no coin life refill mode, double damage perhaps, double enemy boss health.
We could probably level hack a way to a boss rush but a code approach also works. What might we care to look at as part of such a thing?
While there are some codes to show some debug information where is it so we can contemplate adding some more?
From a ROM hacker perspective then music modification is annoying. What have you got here that might allow volume tweaks or mods. Or on the flip side is it likely to be something nice to look at (ignoring licensing concerns for a moment) for a PC side music player for it?
Some kind of challenge mode as well similar to the endless enemies? Could we start on that? Do we have enemy spawn options or would we have to create such a thing, and possibly sort the 255 coins bug while we are at it?
This stuff

is bloody hilarious. Do you reckon we could find a way to also make homing mushrooms poison mushrooms (possibly even wipe health down to all but 1 as well as losing a life from the life counter)?
 

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,373
Trophies
2
Location
In my house
XP
4,818
Country
Mexico
Nice, I wish I could have spare time to invest it to make a 3DS port with all the new mechanics introduced in the DS version, I have ideas that could make it completely possible.

For me that is the only port worth the time besides an HD port, because you know, you can have the DS version with proper analog direction control and... motherfucking 3D.

Now thinking of it makes me exited for something like it, I will see if I can give it a shot and start the snowball to roll, maybe many others want to join and help.
 

Ryccardo

Penguin accelerator
Member
Joined
Feb 13, 2015
Messages
7,696
Trophies
1
Age
28
Location
Imola
XP
6,922
Country
Italy
What the source code will provide us as far as analysis goes I am not sure. [...] If you are expecting people around here to be going over the code like it is an obfuscation contest and we are trying to tease out secrets then it is probably not going to happen for Mario 64, partially because it is so old and outclassed and partially because it is already pretty well understood [...]
I personally wouldn't say that so quickly - while correlation may not be causation, the Pokemon Red disassembly (started in 2010 but peaking in 2012-2015) enjoyed a symbiotic relationship with a respectable number of new discoveries some of them rather significant, as well as making heads or tails of things that were known to exist but not really understood; and while for every Pannenkoek and Pannenkeok there may be four reputable youtubers making solid edutainment videos about obscure Pokemon mechanics, it's never a bad thing to allow more people to independently verify and understand something - or to give them a better chance at changing that game rule they don't like :)
 
  • Like
Reactions: :-infern:

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
I personally wouldn't say that so quickly - while correlation may not be causation, the Pokemon Red disassembly (started in 2010 but peaking in 2012-2015) enjoyed a symbiotic relationship with a respectable number of new discoveries some of them rather significant, as well as making heads or tails of things that were known to exist but not really understood; and while for every Pannenkoek and Pannenkeok there may be four reputable youtubers making solid edutainment videos about obscure Pokemon mechanics, it's never a bad thing to allow more people to independently verify and understand something - or to give them a better chance at changing that game rule they don't like :)
Is the arbitrary execution a particularly significant thing? That would be about the height of ROP (or at least in its meteoric rise) and there was a bit of a fad for making exploits in random old things/games at that point in the world at large.

Granted most of my knowledge of pokemon glitches like that is more from a history of pokemon speedrunning video I once watched, and many of those still seemed accidental, so I will take your word on that one. That said the line quoted is more a response to the OP almost chastising us for not all having a copy and poking around it like it was some amazing bombshell dropped upon the world, or perhaps like those times when the ability to unpack ROMs or unpack tweaked new ROMs becomes a thing. I am always happy to see this sort of thing appear/be generated, and I imagine most around here would react positively to such developments, but as far as waves of excitement then what this will give us that ROM hacking has not/will not, and what would be better served starting from scratch/porting assets, is a different matter.
 

Ryccardo

Penguin accelerator
Member
Joined
Feb 13, 2015
Messages
7,696
Trophies
1
Age
28
Location
Imola
XP
6,922
Country
Italy
Is the arbitrary execution a particularly significant thing?
Well, it certainly became a symbol of "the new age of research" - the one based more on trying to understand the code, rather than just trying to understand observations! (Obviously it hasn't been an overnight change, and it existed to some degree beforehand, but you get the idea) :)

The knowledge that certain items (like the mentioned ones) did something weird depending on current state was long known, but few practical applications or technical details were understood 10 years ago compared to today - even more importantly in my opinion, plenty of smaller things that are documented in some form can also be better understood with access to the technical reference (like the vertical-stripe crash? opcode FF infinite loop; Missingno crashing Yellow and corrupting the hall of fame in Red/Blue? non-picture data being interpreted as an oversized compressed bitmap, and it happens that the first bank of SRAM is used as general memory expansion followed by the hall of fame; ...)

Even the non-abnormal parts benefit from it - it used to be believed that having glitch items named as badges, floor numbers, or Safari Zone rock/bait were coincidences caused by accidentally meaningful undefined string pointers, but it turned out a deliberate attempt to recycle existing item menu code (oh, I said "non-abnormal"? never mind, it's Game Freak, the same company which multiple times has failed writing simple math functions)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
I would be careful reading too much into pokemon as a state of the world at large there. If doing the whole ROM hacking thing then pokemon sits rather aside from the rest of the ROM hacking world. On the one hand there are loads of tools that allow things to be edited from top to bottom (ones that maybe only 5 other non PC/non open source games have anything close to), and I also see many new hackers learning the rudiments of assembly, but at the same time the level of understanding of concepts at large is lower than most general forms of ROM hacking. Of the things you mentioned there as examples I reckon I could find something as far back as the Amiga and possibly commodore64 covering those, certainly in general ROM hacking of many many years back -- go have a look at something like the feature history of fceux (things like function mapping/discovery*, all the Lua stuff, the serious big boy debugging stuff) or the no$ series of debug emulators and realise most of those were in response to requests or common (at least on the PC) debug options rather than a particularly ambitious dev cooking up new things for people to use.

*I forget the name of it offhand but it works sort of like a cheat search where you do everything you want in the game but the thing you want, and then once all that is done you do the thing you want to look at and it will say these new functions were called.

As far as pokemon itself is concerned then I saw some fairly advanced stuff done to finally dispel the up and b myth, and while things had not quite reached the levels of https://www.dragonflycave.com/mechanics/gen-i-capturing then they were not especially lacking.

On the flip side some might say all I wrote above is irrelevant and the pokemon disassembly did lead to advancements in code so...

On a different note entirely then for those not used to such things then I highly encourage you to have a scan through stuff discussing the princess maker source code (DS game accidentally left source in it), https://gbatemp.net/threads/japanese-programming-madness.320192/ , https://www.pagetable.com/?p=28 and that diablo link from earlier. Disassembly is subtly different to much of that, and getting this sort of result is more of a modern phenomenon for C family stuff (C#, visual basic and java not so much), but at the same time is not so far removed.
 

Ecchi95

Well-Known Member
OP
Member
Joined
Jul 7, 2019
Messages
121
Trophies
0
Age
29
XP
891
Country
United States
Nice, I wish I could have spare time to invest it to make a 3DS port with all the new mechanics introduced in the DS version, I have ideas that could make it completely possible.

For me that is the only port worth the time besides an HD port, because you know, you can have the DS version with proper analog direction control and... motherfucking 3D.

Now thinking of it makes me exited for something like it, I will see if I can give it a shot and start the snowball to roll, maybe many others want to join and help.
You should start a thread in 3DS - Homebrew Development and Emulators! I can help with understanding code, but not with 3DS testing.
 

nim-ka

Member
Newcomer
Joined
Sep 5, 2018
Messages
21
Trophies
0
Age
25
XP
92
Country
United States
People *are* analyzing SM64 through this. People *are* doing things with this. The SM64 Randomizer is one great example, not to mention all the glitches found with it. Just because you can't see it doesn't mean it doesn't exist
 
  • Like
Reactions: cearp

Ecchi95

Well-Known Member
OP
Member
Joined
Jul 7, 2019
Messages
121
Trophies
0
Age
29
XP
891
Country
United States
People *are* analyzing SM64 through this. People *are* doing things with this. The SM64 Randomizer is one great example, not to mention all the glitches found with it. Just because you can't see it doesn't mean it doesn't exist
The Randomizer author is one of the people who was already privy to it before it leaked.

I'm talking about the "common people" looking at it, and in public.
 

nim-ka

Member
Newcomer
Joined
Sep 5, 2018
Messages
21
Trophies
0
Age
25
XP
92
Country
United States
The people who are really interested in it have already seeked out the community. Why not just be patient and wait until the full release, which will come with things like simple level editing, a fully documented codebase, etc.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
The people who are really interested in it have already seeked out the community. Why not just be patient and wait until the full release, which will come with things like simple level editing, a fully documented codebase, etc.
I don't necessarily disagree (I am certainly expecting the bulk of anything here to come from said really interested crowd) but across this console hacking, emulator writing and ROM hacking lark we have had a few examples of random people of enough baseline skills rock up to niche things before and drop something interesting. As baseline skills here with this have changed from needs obscure MIPS family CPU assembly skills to "solid C coding skills" (a far more common skillset), maybe with a "saw/played/enjoyed Mario 64 back in the day", then I can see spreading it a bit further than those that might naturally seek it out.
 

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
4,323
Trophies
1
XP
4,464
Country
Canada
People *are* analyzing SM64 through this. People *are* doing things with this. The SM64 Randomizer is one great example, not to mention all the glitches found with it. Just because you can't see it doesn't mean it doesn't exist
A lot of that was done long before this source code was released.
 

nim-ka

Member
Newcomer
Joined
Sep 5, 2018
Messages
21
Trophies
0
Age
25
XP
92
Country
United States
As baseline skills here with this have changed from needs obscure MIPS family CPU assembly skills to "solid C coding skills" (a far more common skillset), maybe with a "saw/played/enjoyed Mario 64 back in the day", then I can see spreading it a bit further than those that might naturally seek it out.
It's really a lot more complicated to use this than it looks. The old version that was leaked isn't very well suited to modding

A lot of that was done long before this source code was released.
1- my message was in the present tense, not the past
2- all the top SM64 analysts have been using this code for about a year now
 
  • Like
Reactions: uyjulian

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
It's really a lot more complicated to use this than it looks. The old version that was leaked isn't very well suited to modding

I am not a great C coder but I did have a quick shuffle through the files. Clearly 90s era embedded device C but no outrageous spaghetti, nothing much in the way of obfuscation, functions and variables named reasonably well for a lot of things, some comments where things are maybe not the clearest,... all things that source releases and the other things that led to the contents of https://osgameclones.com/ have happily handled, or handled worse than, in the past. I would say more or less anybody that will be able to handle it in a few months will be able to make good headway with things now, and probably not be too turned off by it* to come back in said few months if it is not as shiny as they might like or they might like some more commentary/analysis of the project as a whole done first.

*for ROM hacking and early stages coding environments on consoles we occasionally see bright new people come in, be faced with the initial hurdle and drop out where they might have made it 6-12 months later when such challenges are not quite as immediate. While I probably would not be too shocked to see some "just graduated java school but they did teach us some C18" types balk at the code then anybody else likely still able to do C at something like professional level (never mind the more hardcore legacy/K&R C set) will do OK here.


On a different note scrolled down a bit and "377 people currently viewing this thread". Bit more than I normally see for this sort of thing. Did it get picked up somewhere?
 

nim-ka

Member
Newcomer
Joined
Sep 5, 2018
Messages
21
Trophies
0
Age
25
XP
92
Country
United States
I am not a great C coder but I did have a quick shuffle through the files. Clearly 90s era embedded device C but no outrageous spaghetti, nothing much in the way of obfuscation, functions and variables named reasonably well for a lot of things, some comments where things are maybe not the clearest,... all things that source releases and the other things that led to the contents of https://osgameclones.com/ have happily handled, or handled worse than, in the past. I would say more or less anybody that will be able to handle it in a few months will be able to make good headway with things now, and probably not be too turned off by it* to come back in said few months if it is not as shiny as they might like or they might like some more commentary/analysis of the project as a whole done first.
As someone who has been working with this codebase for quite a while now, it is really a lot more complicated than it looks until you get used to it. Most people's interests are in stuff like adding levels and items and models etc., which cannot be easily done with what was leaked

On a different note scrolled down a bit and "377 people currently viewing this thread". Bit more than I normally see for this sort of thing. Did it get picked up somewhere?
The thread was crossposted to multiple subreddits
 

PhyChris

Well-Known Member
Member
Joined
May 6, 2009
Messages
369
Trophies
1
XP
2,104
Country
Canada
If its incomplete but builds a 1/1 rom copy then the important subroutine labels are all thats needed for some huge romhacking power.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: I see your mop and raise you George's mop lol