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



## jimmyj (Aug 26, 2019)

very interesting, considering the amount of great romhacks we're already getting this could make some even more sophisticated things


----------



## Chary (Aug 26, 2019)

jimmyj said:


> very interesting, considering the amount of great romhacks we're already getting this could make some even more sophisticated things


_Kaze Emanuar intensifies _


----------



## IncredulousP (Aug 26, 2019)

Yahoo! Letsa go!


----------



## RedoLane (Aug 26, 2019)

23 years, man. that's...my birth day number.


----------



## MAXLEMPIRA (Aug 26, 2019)

So... "we can do" now to a port to Switch with HD models and textures? xDD


----------



## eriol33 (Aug 26, 2019)

super mario 64 with modern graphics would be fantastic


----------



## sarkwalvein (Aug 26, 2019)

Source code available.... RTX version of Mario 64?


----------



## Dartz150 (Aug 26, 2019)

I was looking to this weeks ago, so I could port the code to compile it for other systems, but there are still things that are out of my scope, because even though we have the source, is a dificult task


----------



## Foxi4 (Aug 26, 2019)

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.


----------



## PrincessLillie (Aug 26, 2019)

Super Mario 64 3D when?


----------



## chrisrlink (Aug 26, 2019)

I can see this getting ugly REAL fast


----------



## Jiehfeng (Aug 26, 2019)

I can hear the Nintendo executives screaming at the top of their lungs and throwing tantrums everywhere.


----------



## Nevermore (Aug 26, 2019)

Next YouTube Video: "Can you beat Super Mario 64 by recompiling the source code?"


----------



## raxadian (Aug 26, 2019)

jimmyj said:


> 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.


----------



## sonicvssilver22 (Aug 26, 2019)

I'm excited to see what the community will come up with now that they've finished reverse-engineering this game.


----------



## raxadian (Aug 26, 2019)

Nevermore said:


> 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.


----------



## Manana (Aug 26, 2019)

Would this help with porting rom hacks like last impact to underpowered consoles like psp?


----------



## ShadowOne333 (Aug 26, 2019)

I can already see Nintendo fuming their asses out for not being able to do jackshit about this with DMCA's


----------



## Deleted User (Aug 26, 2019)

*WALUIGI'S TACO STAND! GETS BETTER!*


----------



## x65943 (Aug 26, 2019)

raxadian said:


> 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.


Incomplete and buggy?

I played this game nonstop as a kid on the N64 and never experienced any game breaking or even significant bugs

Honestly this game was way more polished than most modern games


----------



## smileyhead (Aug 26, 2019)

Sounds nice, but this doesn't sound very 'official' to me.


----------



## orangy57 (Aug 26, 2019)

mario 64 sourceports when


----------



## Chary (Aug 26, 2019)

smileyhead said:


> Sounds nice, but this doesn't sound very 'official' to me.


The official comes from the decompiling team officially releasing it, rather than the odd leak/potentially stolen work distribution (?) that occurred a month ago.


----------



## emmanu888 (Aug 26, 2019)

First of all, that means the game can be ported to another system right?

But most important of all, does this means that future romhacks could be compatible with original hardware now that the decompiled code is out in the wild?


----------



## diggeloid (Aug 26, 2019)

Foxi4 said:


> It's worth mentioning that this is decompiled source code, 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. 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.



I thought the point of this release was that they went through and actually added sensical names variables and functions, so you can actually work with it. I remember seeing this leaked a few weeks (months?) back in an "incomplete" state, which had some source files that were clearly straight out of a decompiler with meaningless names.


----------



## Foxi4 (Aug 26, 2019)

diggeloid said:


> I thought the point of this release was that they went through and actually added sensical names variables and functions, so you can actually work with it. I remember seeing this leaked a few weeks (months?) back in an "incomplete" state, which had some source files that were clearly straight out of a decompiler with meaningless names.


Oh, by all means, it's more understandable than pure machine code - you can actually look at it and they did add useful commentary. My point was that this isn't a reflection of how the original source files looked like when they were originally made, it's a faithful recreation based on the decompiled binaries that results in an accurate binary when compiled. You still need to be well-versed in the N64's way of doing things before you can work with it though. It's actually really impressive judging by what's hosted on the Github. You can't really "get" the original files out of a decompiler, but you can rearrange and rename things to make them more understandable for someone with experience, which is what this is.


----------



## MSearles (Aug 26, 2019)

Does this mean someone will port this to the switch and I won't have to use any emulator to run it?


----------



## DuoForce (Aug 26, 2019)

This game’s modding scene is about to blow wide open


----------



## CrashOveride (Aug 26, 2019)

MSearles said:


> Does this mean someone will port this to the switch and I won't have to use any emulator to run it?



The matter is someone MAY do it. The codebase relies heavily on libultra and is designed for the N64 and nothing else.


emmanu888 said:


> First of all, that means the game can be ported to another system right?
> 
> But most important of all, does this means that future romhacks could be compatible with original hardware now that the decompiled code is out in the wild?



Many romhacks(recent ones anyway) are console compatible, and Kaze recently got star road to run on console at 20-30 fps.


----------



## UltraSUPRA (Aug 26, 2019)

Super Mario 64 running natively on Windows.

Is it safe to toss Project64 in the trash yet?


----------



## CrashOveride (Aug 26, 2019)

UltraSUPRA said:


> Super Mario 64 running natively on Windows.
> 
> Is it safe to toss Project64 in the trash yet?



1. NOBODY has got it running natively on anything yet.

2. Project64 is fine? as long as you're using a nightly and not 1.6


----------



## Bimmel (Aug 26, 2019)

eriol33 said:


> super mario 64 with modern graphics would be fantastic


Super Mario 64 DS?


----------



## CrashOveride (Aug 26, 2019)

he said "modern graphics" lol


----------



## Bimmel (Aug 26, 2019)

CrashOveride said:


> he said "modern graphics" lol


You mean modern modern? All right!, here we go!


----------



## CrashOveride (Aug 26, 2019)

Nintendo, Hire This Man


----------



## FAST6191 (Aug 26, 2019)

I mentioned in other threads I did a little compare and contrast with some of the bigger and juicier files between the leaked version and this. Not a night and day difference (in the leaked code discussion thread some were claiming far nicer function names, comments everywhere and whatnot but not really) and some odd choices for changes as far as formatting (nothing dealbreaking, just odd) but probably best you move to this if you are doing anything.



Manana said:


> Would this help with porting rom hacks like last impact to underpowered consoles like psp?


In theory it could.

In practice unless and until it gets remade into a form that works with more modern consoles probably not.

There is the halfway house of being able to alter the code to make it more amenable to emulation (especially dynamic recompilation like a lot of "faster" N64 emulators opt for) but I have never really seen that done before (however the N64 would be a reasonable candidate for it). Afraid it has been too long since I looked at N64 emulation so I don't know what percentage of the time this game spends running as dynarec rather than more traditional emulation. Source code is rare for ROM hackers, source code available for proper use even more so, but even then I would normally only expect to really see such mods done to things to make either widescreen hacks work better,  dodge anti piracy, dodge resolution issues (could also apply to those games that change resolution and break signal adapter boxes), work around control limitations (got fewer buttons, sticks, touchscreens in the way... no worries any more where normally control hacking is tedious) and do similar such "small" but still quite tedious to do as a ROM hacker things.


----------



## CrashOveride (Aug 26, 2019)

FAST6191 said:


> I mentioned in other threads I did a little compare and contrast with some of the bigger and juicier files between the leaked version and this. Not a night and day difference (in the leaked code discussion thread some were claiming far nicer function names, comments everywhere and whatnot but not really) and some odd choices for changes as far as formatting (nothing dealbreaking, just odd) but probably best you move to this if you are doing anything.



Personally, I waited until the team released it themselves because I considered it morally repugnant to use the leak. If there wasn't a difference between leak and release I'd still use release. Especially after the annoying drama that unfolded in the last thread.


----------



## Ericthegreat (Aug 26, 2019)

Again from what I've read, this seems to not be a 100% reproduction of Nintendo's code, some spots it seems had to be filled in, and though I'm sure it works, it doesn't mean your seeing exactly how the Nintendo devs did it, which I think for many is the coolest part about this.

Please correct me if I'm wrong.


----------



## CrashOveride (Aug 26, 2019)

A 100% reproduction would be impossible tbh, this is the best we're gonna get unless Ninty releases the sources for their N64 output

(rare pls release n64 sauce codes)


----------



## MAXLEMPIRA (Aug 26, 2019)

I would prefered Zelda OoT(and MM) source code, imagine that on a DS or better... on a Switch xDD


----------



## wolf-snake (Aug 26, 2019)

Bimmel said:


> You mean modern modern? All right!, here we go!



God that actually looks like souless crap.


----------



## _DrBecks_ (Aug 26, 2019)

We need Mario Party decompiled, so we could merge the best minigames of Mario Party 2 and 3 into 1


----------



## Essasetic (Aug 26, 2019)

I am actually quite excited to see how developers will use this.

Maybe if someone makes an RTX mod I'll probably get an RTX GPU :^)


----------



## Voyambar (Aug 26, 2019)

The heck? This is shocking news


----------



## Idontknowwhattoputhere (Aug 27, 2019)

Voyambar said:


> The heck? This is shocking news


Suprised you haven't heard about it since its been on the front page for the bulk of the day :shrek:


----------



## Manana (Aug 27, 2019)

raxadian said:


> 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.



Your crazy, wall jumps and movrment in general is way more fullfilling in the original. DS was good for multiplayer, portability, and a few game modes and characters but the core gameplay just feels right on the n64


----------



## Deleted User (Aug 27, 2019)

x65943 said:


> Incomplete and buggy?
> 
> I played this game nonstop as a kid on the N64 and never experienced any game breaking or even significant bugs
> 
> Honestly this game was way more polished than most modern games


catch was/islow down. But most n64 games suffered it


----------



## PrincessLillie (Aug 27, 2019)

MAXLEMPIRA said:


> I would prefered Zelda OoT(and MM) source code, imagine that on a DS


Ocarina of Time 3D and Majora's Mask 3D.


----------



## raxadian (Aug 27, 2019)

Manana said:


> Your crazy, wall jumps and movrment in general is way more fullfilling in the original. DS was good for multiplayer, portability, and a few game modes and characters but the core gameplay just feels right on the n64



Tell that to TV Tropes then.


----------



## pastaconsumer (Aug 27, 2019)

Chary said:


> _Simpleflips intensifies _


Fixed that for you.


----------



## MAXLEMPIRA (Aug 27, 2019)

sks316 said:


> Ocarina of Time 3D and Majora's Mask 3D.


I would like to play it on DS for some reason... and in Switch... it would be totally HD models, textures and visual effects


----------



## TheZander (Aug 27, 2019)

What will people be able to DOOM this into and play?


----------



## Sheimi (Aug 27, 2019)

Maybe we can finally understand how the upward glitch works in Tick Tock Clock


----------



## Ecchi95 (Aug 27, 2019)

MAXLEMPIRA said:


> I would prefered Zelda OoT(and MM) source code, imagine that on a DS or better... on a Switch xDD


You can reference the decompiled code for Super Mario 64, plus the compiled version, and compare the functions to those in other first-party N64 games.

You can then use the same symbols from Super Mario 64 for functions that serve the same purpose.

Games I'm going to do this with:

Super Mario 64 (Disk Version)
Mario Kart 64 (this one most closely resembles Super Mario 64's code base I've found)
F-Zero X
Ocarina of Time (NOT the debug version that everyone uses. I don't want bug fixes or bloat from the debug functions.)
Majora's Mask (NOT the debug version that everyone uses. I don't want bug fixes or bloat from the debug functions.)


----------



## Fusion (Aug 27, 2019)

Since this has the Super Mario 64 engine also, it shouldn't be to hard now to get to work on Zelda Ocarina of Time, Banjo and Kazooie etc. Now those would be great additions/addons for this source as extra's.


----------



## Captain_N (Aug 27, 2019)

so how is this not copyrighted code. not that i care but yall go crazy when one tool is posted with nintendos code in it. this is the entire game.....


----------



## MAXLEMPIRA (Aug 27, 2019)

Ecchi95 said:


> You can reference the decompiled code for Super Mario 64, plus the compiled version, and compare the functions to those in other first-party N64 games.
> 
> You can then use the same symbols from Super Mario 64 for functions that serve the same purpose.
> 
> ...


That's just what I though... I mean. both games were coded for N64 and by Nintendo... so, the code must be similar. Some changes here and there


----------



## uyjulian (Aug 27, 2019)

Ecchi95 said:


> You can reference the decompiled code for Super Mario 64, plus the compiled version, and compare the functions to those in other first-party N64 games.
> 
> You can then use the same symbols from Super Mario 64 for functions that serve the same purpose.
> 
> ...


Guess what else you can use? Diaphora


----------



## chrisrlink (Aug 27, 2019)

ShadowOne333 said:


> I can already see Nintendo fuming their asses out for not being able to do jackshit about this with DMCA's


explain why they cant because Mario's IP is still copyrighted hell NES games are still copyrighted and are still protected by that shitty law (F.U. G.W.)


----------



## MarkDarkness (Aug 27, 2019)

Scene just keeps getting crazier.


----------



## Bimmel (Aug 27, 2019)

wolf-snake said:


> God that actually looks like souless crap.


That's because.. it is soulless crap.


----------



## 01y (Aug 27, 2019)

raxadian said:


> 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.



Wait... which games are those?


----------



## Ecchi95 (Aug 27, 2019)

uyjulian said:


> Guess what else you can use? Diaphora


The function signatures are different (because optimizations), so that would fail. I already have a working method and started on it.


----------



## Joom (Aug 27, 2019)

Captain_N said:


> so how is this not copyrighted code. not that i care but yall go crazy when one tool is posted with nintendos code in it. this is the entire game.....


It's not Nintendo's code, technically.


----------



## Stealphie (Aug 27, 2019)

Missingphy said:


> *WALUIGI'S TACO STAND! GETS BETTER!*


YEAH WALUGI TACO STAND 2 WITH MORE TACO TYPES


----------



## FAST6191 (Aug 27, 2019)

Joom said:


> It's not Nintendo's code, technically.


For the purposes of most copyright courts it is.

If the people doing this had played it, observed its behaviour, fed it a bunch of inputs and then recreated the whole thing from observed behaviours (probably also with a different team to those that did the looking just to ensure nobody accidentally saw a disassembly and used it) aka a traditional clean room reverse engineering effort then it would be their own code.

As it stands the people doing this have all but admitted they used disassembly and decompilation* to regenerate the original source code (the whole compiles to 1:1 thing alone attesting to that, especially as this game has unused code like the trampoline stuff I was contemplating in the other thread that has comments generated upon it from this project) it falls under various things from derived works to out and out copying. How much damages Nintendo might be able to recover (or be assigned as I am assuming like most hackers the people here are broke as you like) and what sort of arguments they would make as far as it deprives them of potential revenue I don't actually know and don't know of any similar cases at this point. Historically Nintendo have not cared much either so I am not expecting too much here; we have had functional equivalents in terms of full commented disassemblies of Mario, Pokemon and more for many years now, all of which have been completely unmolested as far as I know, and observing interactions of the law and ROM hacking related fields is one of my things. Though at the same time if you and a few hundred other viewers of this cared to clone the GIT (they even have a nice download all as zip button) in an event of a keep sharing the tapes scenario then that is not a bad plan.
If it comes to pass that someone takes the code, tweaks it such that it compiles with a modern compiler for a modern OS or other embedded device and then we can all have our own custom builds made with a current version of code:blocks, visual studio or something equally easy to use then that might be a different matter and we could be awakening a sleeping giant as it were. Definitely want some Streisand effect in that case.

*not sure how much decompilation has been tested in court for non scripting languages (thinking stuff like python, java, autoit, C# and the like which have things that trivially spit out source code), as opposed to this sort of thing which takes a more creative toolkit (decompilation efforts for C and C++ attract some of the brightest minds in computer programming and computer science these days) and human effort to make sense of the results. However I don't expect a particular hangup here where it is all suddenly free and clear.

I am also not entirely sure what Nintendo might be able to do with the source code as far as releasing a new version using it if they have lost their old code or find this much better than whatever they have from back in the day (when it comes to public domain books then while the content might be unable to be copyrighted then it is usually held that the font, layout, formatting and such constitutes creative work done so I might not be able to scan a shiny new book of an old story and stick it online). Similarly there is no chance of any company (even if they wanted to wade through the 1990s vintage embedded C for a new console that was unknown and hard to program for) being able to use this to generate a commercial work, compared to most open source stuff where that is eminently possible.


----------



## Deleted User (Aug 27, 2019)

Ecchi95 said:


> unless you're putting effort in yourself, shut up.


Do you get off on being so bitter all the time? It was a simple suggestion, and I'm sure you could have taken it without being such a sourpuss.

All things considered, this is definitely gonna lead to some pretty nice advancements in the future and I'm looking forward to seeing what comes out of it.


----------



## ShadowOne333 (Aug 27, 2019)

chrisrlink said:


> explain why they cant because Mario's IP is still copyrighted hell NES games are still copyrighted and are still protected by that shitty law (F.U. G.W.)





FAST6191 said:


> For the purposes of most copyright courts it is.
> 
> If the people doing this had played it, observed its behaviour, fed it a bunch of inputs and then recreated the whole thing from observed behaviours (probably also with a different team to those that did the looking just to ensure nobody accidentally saw a disassembly and used it) aka a traditional clean room reverse engineering effort then it would be their own code.
> 
> ...


Disassembly counts as reverse engineering, just fyi, and it holds legal grounds in courts, at least in NA as far as I know. So Nintendo can't claim nothing because RE is legal.
This is the same reason why Nintendo hasn't done jackshit to the already widely available Pokemon disassemblies, which vary from Gen 1 to Gen 3 as of this time of writing, and they've been available for years in GitHub of all places.

I don't know in what world a sane human would try to "reverse engineer" something just from observation and tried to recreate it from scratch. That's completely stupid. It's like trying to waste 1 year of your life to recreate Mario's jump from observation 1:1, while you can very much do it by debugging the ROM and see how the game engine does it with disassembly, alongside what routines are tied to it and the exact timing ticks, gravity variables, etc.

Disassembly is the very first step to any kind of RE, and most of the time they go hand by hand.
From here, people adept enough in the MIPS assembly language can work wonders.
And someone adept enough in both MIPS and C++ can start recreating the whole game in C++ from the base MIPS disassembly.

And remember, all of this is LEGAL.
So Nintendo can go fuck themselves with their bullshit DMCAs already and their IP copyright asshole attitude towards everything related to them.

Glad this was done.


----------



## raxadian (Aug 27, 2019)

01y said:


> Wait... which games are those?



Most free and open source collect a ton games in 3D cgi are more or less based on Super Mario 64. Outright clones keep getting killed by Nintendo so they never get too far.


----------



## uludag (Aug 27, 2019)

Bimmel said:


> That's because.. it is soulless crap.


Why do you say so?


----------



## Bimmel (Aug 27, 2019)

uludag said:


> Why do you say so?


Sorry, I forgot the emoticon.

Honestly, I can see the hard work that this project must have been. The reason why "soulless" comes to mind is hard to explain. Everything looks so clean und stiff, not natural at all.

In any case, it's a great proof of what is possible.


----------



## CrashOveride (Aug 27, 2019)

Ecchi95 said:


> That bullshit software won't help.
> 
> The function signatures are different (because optimizations), so that would fail. I already have a working method and started on it, so unless you're putting effort in yourself, shut up.




lol "fuck you because you suggested something nicely, shut up"


----------



## fudgi (Aug 27, 2019)

how were those sophisticated romhacks, with new features, physics etc possible if the source hadnt been altered?


----------



## uyjulian (Aug 27, 2019)

fudgi said:


> how were those sophisticated romhacks, with new features, physics etc possible if the source hadnt been altered?


It's called "code modification"


----------



## FAST6191 (Aug 27, 2019)

ShadowOne333 said:


> Disassembly counts as reverse engineering, just fyi, and it holds legal grounds in courts, at least in NA as far as I know. So Nintendo can't claim nothing because RE is legal.
> This is the same reason why Nintendo hasn't done jackshit to the already widely available Pokemon disassemblies, which vary from Gen 1 to Gen 3 as of this time of writing, and they've been available for years in GitHub of all places.
> 
> I don't know in what world a sane human would try to "reverse engineer" something just from observation and tried to recreate it from scratch. That's completely stupid. It's like trying to waste 1 year of your life to recreate Mario's jump from observation 1:1, while you can very much do it by debugging the ROM and see how the game engine does it with disassembly, alongside what routines are tied to it and the exact timing ticks, gravity variables, etc.
> ...



Disassembly, and reverse engineering as a larger umbrella, might be legal for purposes of interoperability, accessibility, defeating anti piracy that is dead and preventing a work from being used, and all the other "substantial non infringing uses" that allow emulator projects to happen out in the open over decades but firing your decompiler or disassembler over a piece of code and releasing the result (even tarted up a bit) is hard to justify as some kind of fair use any more than me taking bitmaps of every frame of a film and releasing those as a slideshow is legal.
I am not sure why the pokemon stuff has remained so unbothered, however everything I have seen from Nintendo other than the emulator which bundled ROMs has been more from a trademark angle from what I can see, and I don't think the disassembly terribly bothers that.

I agree it would have been a nightmare, one you know you can end trivially with existing tools, to recreate a game even as old as this from observation -- such methods are traditionally saved for things like database formats, document formats, low level protocols and things like that to allow people to operate with them or convert between them. The method described before, generally known as clean room reverse engineering, is the traditional way you generate free and clear info for your projects that you want to interact with someone else's standard, code or similar if the have not provided the code in a manner you care to use.

I am also happy to see such things made, and happy to skirt the edges of laws to have cool things like this. Does not change the technical reality of the law though.



fudgi said:


> how were those sophisticated romhacks, with new features, physics etc possible if the source hadnt been altered?


Source makes things potentially a lot easier, however it is not impossible without it.
I am not sure how much depth is required for a reply like this but in an emulator you can watch for certain things to happen (buttons, standard cheat searches will yield character location, direction and speed, from there you can either watch things watching for the buttons or do something like that and figure out what jump routines are like) and from there figure out what code is fiddling with what. At that point you can do some fairly radical changes. Rinse and repeat for the various hats, walls/obstacles, enemies and the like.

Prior to the N64 (and PS1) most things were written in the assembly language you will likely be getting spat back out at you from the emulator and 16 bit era games still managed a fair bit of complexity. Or if you prefer you can have a read of https://stuff.pypt.lt/ggt80x86a/asm1.htm (it is for the PC but you can see how quickly you find yourself doing useful operations).


----------



## Daniel15 (Aug 27, 2019)

Pretty interersting! Thanks for the link.



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



What does "officially" mean? It's not really official given it's not a Nintendo release, right?


----------



## Ecchi95 (Aug 27, 2019)

CrashOveride said:


> lol "fuck you because you suggested something nicely, shut up"


If I want suggestions, I'll ask for them. If I don't ask for them, I'm happily along with what I'm doing and don't want or need them.


----------



## uyjulian (Aug 27, 2019)

Ecchi95 said:


> I, If it wants the proposal, I :. 'Ll requests them.  If I acquire it'I, t requests them. 'm, It is happy, What I?' m is done. 't, I want them, Or, it is necessary.



Because I proposed it some, You need not waste time.


----------



## VzUh (Aug 27, 2019)

guys, gals, and whatever you are: now is the time to aswer one of the greatest questions ever

_was luigi in mario64?_


----------



## Ecchi95 (Aug 27, 2019)

VzUh said:


> guys, gals, and whatever you are: now is the time to aswer one of the greatest questions ever
> 
> _was luigi in mario64?_


Nintendo already confirmed Luigi was in Super Mario 64 in an Iwata Asks interview. It was 2-player. And pieces of that code are still there.


----------



## VzUh (Aug 27, 2019)

Ecchi95 said:


> Nintendo already confirmed Luigi was in Super Mario 64 in an Iwata Asks interview. It was 2-player. And pieces of that code are still there.


if that's how it is...
#FreeLuigiFromHisCodePrision


----------



## Ecchi95 (Aug 28, 2019)

http://iwataasks.nintendo.com/interviews/#/wiiu/super-mario-3d-world/0/6



> *Iwata
> Regrets?
> 
> Koizumi
> ...


----------



## Pluupy (Aug 28, 2019)

But what about the DS enhanced port stuff?


----------



## Deleted User (Aug 28, 2019)

Pluupy said:


> But what about the DS enhanced port stuff?


Another long journey likely. I mean, I don't know how close sm64ds runs (source code wise) to sm64. I mean sm64ds had a shit ton of improvements from sm64. But if it's a lot different (point that it no longer even looks like the original source code) then well... another decompilation journey.


----------



## Ecchi95 (Aug 28, 2019)

monkeyman4412 said:


> Another long journey likely. I mean, I don't know how close sm64ds runs (source code wise) to sm64. I mean sm64ds had a shit ton of improvements from sm64. But if it's a lot different (point that it no longer even looks like the original source code) then well... another decompilation journey.


The DS version looks more like Ocarina of Time. It uses relocatable binaries for everything like Ocarina of Time.


----------



## Spazzery (Aug 28, 2019)

this is phenomenal! I can't wait to see what amazing things people can do with this! 

Now that I think, a 3DS port would be super awesome!


----------



## evans112682 (Aug 30, 2019)

Goldeneye 007 would be more interesting. Ported to the switch, with some online multiplayer.


----------



## HideoKojima (Aug 31, 2019)

Foxi4 said:


> 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.


Yeah was gonna say that

--------------------- MERGED ---------------------------



_DrBecks_ said:


> We need Mario Party decompiled, so we could merge the best minigames of Mario Party 2 and 3 into 1


And add multi-player too


----------



## Deleted User (Aug 31, 2019)

Shalashaska98 said:


> Yeah was gonna say that
> 
> --------------------- MERGED ---------------------------
> 
> ...


what do you mean by multi-player? Mario party supports local multiplayer. Now if you mean multiplayer like as in wifi or online multiplayer then sure yeah.


----------



## Ecchi95 (Aug 31, 2019)

I'll make a new thread about this and other games when I'm further along.

I'm locating functions from Super Mario 64 in Mario Kart 64 (J) (V1.0) [!]. It's clear that it uses the Super Mario 64 engine, but some things are moved around and I don't know if that's the compiler's doing or Nintendo refactoring.



Spoiler





```
001050 create_thread              //0C000114
001084 Main                       //not called, jumped to (jr $t2)
0010E0 thread1_idle               //not called, passed as $a2 to create_thread
00125C start_sptask               //0C000197
0017EC dispatch_audio_sptask      //0C0002FB
001820 send_display_list          //0C000308
001888 init_render_image          //0C000322
0018C8 end_master_display_list    //0C000332
00191C clear_frame_buffer         //0C000347
0019E0 sm64_80247ED8              //0C000378
001A94 sm64_80247FAC              //0C0003A5
001B14 display_and_vsync          //0C0003C5
001D38 ?                          //0C00044E dma_read?
001E44 setup_game_memory          //0C000491
002AAC ?                          //0C0007AB render_game?
002B50 interrupt_gfx_sptask       //0C0007D4
002B8C receive_new_tasks          //0C0007E3
002CB8 set_vblank_handler         //0C00082E
002CF8 start_gfx_sptask           //0C00083E
002D48 handle_vblank              //0C000852
002E64 handle_dp_complete         //0C000899
002EBC handle_sp_complete         //0C0008AF
002FC4 thread3_main               //not called, passed as $a2 to create_thread
00335C thread5_game_loop          //not called, passed as $a2 to create_thread
0034C4 thread4_sound              //not called, passed as $a2 to create_thread

004130 profiler_log_thread5_time  //0C000D4C
0041C0 profiler_log_thread4_time  //0C000D70
00423C profiler_log_gfx_time      //0C000D8F
0042CC profiler_log_vblank_time   //0C000DB3

0CD440 osCreateThread             //0C033210
0CD830 osStartThread              //0C03330C
0CE45C osSpTaskLoad               //0C033617
0CE5BC osSpTaskStartGo            //0C03366F
0CF100 osPiStartDma               //0C033940

10DCD8 clear_z_buffer             //0C0A8F06
10DE64 my_rdp_init                //0C0A8F69
10E188 my_rsp_init                //0C0A9032
10E1FC ?                          //0C0A904F display_frame_buffer?
111BC4 set_segment_base_addr      //0C0A9EC1
111BE4 get_segment_base_addr      //0C0A9EC9
111C04 segmented_to_virtual       //0C0A9ED1
111C38 move_segment_table_to_dmem //0C0A9EDE
```


----------



## FAST6191 (Aug 31, 2019)

Is that supposed to demonstrate the same engine? Most of those look like basic IO for an early 3d game console such that it would sooner call a common IO library (and both of those were early stage Nintendo in house games)


----------



## Ecchi95 (Aug 31, 2019)

FAST6191 said:


> Is that supposed to demonstrate the same engine? Most of those look like basic IO for an early 3d game console such that it would sooner call a common IO library (and both of those were early stage Nintendo in house games)


The functions that aren't Main, or prefixed with "os" or "thread" are functions that only appear in first-party Nintendo 64 games. They are an engine Nintendo developed. The first game that used it was Super Mario 64, so it's referred to as Super Mario 64's engine.

If you mean more specific things like scripts, I haven't found them yet. But what I've found so far are things that only appear in first-party Nintendo games in that exact form.


----------



## HideoKojima (Sep 1, 2019)

monkeyman4412 said:


> what do you mean by multi-player? Mario party supports local multiplayer. Now if you mean multiplayer like as in wifi or online multiplayer then sure yeah.


I think u quoted the wrong person... Don't do it again or else...


----------



## CrashOveride (Sep 3, 2019)

evans112682 said:


> Goldeneye 007 would be more interesting. Ported to the switch, with some online multiplayer.



The issue was that GoldenEye was compiled with -O2, making the decompilation process a LOT harder


----------



## Ecchi95 (Sep 4, 2019)

I wrote a tool now to plug in the symbols I give it for any N64 ROM. Output for Mario Kart 64 (J) (V1.0) [!]'s thread3_main:


```
Where? 2fc4
002FC4 27BDFFA0
002FCC v1 = 0x8014DC98
002FDC 25CEF780
002FE0 25EF4F80
002FE4 2718A780
002FE8 AC6E0000
002FEC AC6F0004
002FF0 AC780008
002FFC AFBF0034
003000 AFB50030
003004 AFB4002C
003008 AFB30028
00300C AFB20024
003010 AFB10020
003014 AFB0001C
003018 AFA40060
00301C v0 = 0x80344F80
003020 v1 = 0x8036A780
003024 240A0000
003028 240B0000
00302C 240C0000
003030 240D0000
003034 240E0000
003038 240F0000
00303C v0 = 0x80344FA0
003040 24080000
003044 24090000
003048 AC4FFFFC
00304C AC4EFFF8
003050 AC4DFFF4
003054 AC4CFFF0
003058 AC4BFFEC
00305C AC4AFFE8
003060 AC49FFE4
003064 1443FFEF
003068 AC48FFE0

00306C JAL <setup_mesg_queues>

003074 JAL <setup_game_memory>
003084 26108570
003088 2739A720
003090 24180014
003094 AFB80014
003098 a2 = thread4_sound
00309C AFB90010
0030A0 a0 = gSoundThread
0030A4 a1 = 0x4

0030A8 JAL <create_thread>
0030AC a3 = 0x0

0030B0 JAL <osStartThread>
0030B4 a0 = gSoundThread
0030C0 261063C0
0030C4 25088570
0030CC 2409000A
0030D0 AFA90014
0030D4 a2 = thread5_game_loop
0030D8 AFA80010
0030DC a0 = gGameLoopThread
0030E0 a1 = 0x5

0030E4 JAL <create_thread>
0030E8 a3 = 0x0

0030EC JAL <osStartThread>
0030F0 a0 = gGameLoopThread
0030F8 2610C9A8
0030FC s5 = MESG_START_GFX_SPTASK
003100 s4 = MESG_VI_VBLANK
003104 s3 = MESG_DP_COMPLETE
003108 s2 = MESG_SP_COMPLETE
00310C 27B10054
003110 a0 = gIntrMesgQueue
003114 a1 = 0xFFFFFFF4

003118 JAL <osRecvMesg>
00311C a2 = 0x1
003120 v0 = sp54
003124 (v0)
       case s2: //00315C
00312C (v0)
       case s3: //00316C
003134 (v0)
       case s4: //00314C
00313C (v0)
       case s5: //00317C
003144 break;   //003114
003148 a0 = gIntrMesgQueue

00314C JAL <handle_vblank>
003154 break;   //003114
003158 a0 = gIntrMesgQueue

00315C JAL <handle_sp_complete>
003164 break;   //003114
003168 a0 = gIntrMesgQueue

00316C JAL <handle_dp_complete>
003174 break;   //003114
003178 a0 = gIntrMesgQueue

00317C JAL <start_gfx_sptask>
003184 break;   //003114
003188 a0 = gIntrMesgQueue
003190 ra = sp34
003194 s0 = sp1c
003198 s1 = sp20
00319C s2 = sp24
0031A0 s3 = sp28
0031A4 s4 = sp2c
0031A8 s5 = sp30
0031AC 03E00008
0031B0 27BD0060
Press any key to continue . . .
```



Mario Kart 64 sets up the game memory on Thread 3 instead of Thread 5 like Super Mario 64.

I found Super Mario 64's orbit_from_positions (envfx_snow) function in Mario Kart 64, which goes unused: (all thanks to stumbling upon the atan2s function originally from Mario 64's math_util)


```
Where? 1264c4
1264C4 27BDFFD0
1264C8 AFBF0014
1264CC AFA60038
1264D0 AFA7003C
1264D4 C4860000
1264D8 C4A40000
1264DC C48A0004
1264E0 C4A80004
1264E4 46062001
1264E8 C4860008
1264EC C4A40008
1264F0 460A4081
1264F4 46000402
1264F8 E7A0002C
1264FC 46062381
126500 E7A20028
126504 460E7482
126508 E7AE0024
12650C E7B0001C
126510 46021202
126514 E7B20018
126518 46088280

12651C JAL <sqrtf>
126520 46125300
126524 C7B0001C
126528 C7B20018
12652C t6 = sp38
126530 46128300

126534 JAL <sqrtf>
126538 E5C00000
12653C C7AC0028

126540 JAL <atan2s>
126544 46000386
126548 t7 = sp3c
12654C A5E20000
126550 C7AE0024

126554 JAL <atan2s>
126558 C7AC002C
12655C t8 = sp40
126560 A7020000
126564 ra = sp14
126568 27BD0030
12656C 03E00008
Press any key to continue . . .
```


----------



## TastifulBurger (Oct 14, 2019)

_DrBecks_ said:


> We need Mario Party decompiled, so we could merge the best minigames of Mario Party 2 and 3 into 1


I'm more for a playable Waluigi and Disney in MP1 + MP2, like Knuckles in _Sonic the Hedgehog 2 & Knuckles._


----------



## Stealphie (Oct 14, 2019)

evans112682 said:


> Goldeneye 007 would be more interesting. Ported to the switch, with some online multiplayer.


like the remake on wii, which had good online


----------

