9 ms·
Super Mario 64 has been decompiled
- edude03 7y agoThis is cool but seems to be "just" the output from IDA with the functions renamed in the output? If that's the case I'm wondering why we don't see this sort of thing more often (other than the effort required of course)
- pilif 7y agothe `src` folder seems to contain the reverse-engineered C code. Most of the assembly-only files left look to me like they are just describing data.
- colechristensen 7y ago>It's not an ordinary decompilation generated by IDA. They actually rewrote all the functions from reading MIPS assembly and compiled it with the original compiler, adjusting the code until it produced identical output to a vanilla ROM. Reverse engineering a reproducible build is quite a bit more than "just" output.
- elcomet 7y agoWhat more is needed?
- colechristensen 7y agoA perfect decompiler would just do it, but writing the exact inverse of a compilation tool chain would be... Difficult. You would have to have a different decompiler for each version each tiny little difference. These guys were capable of figuring out and naming what every function did and then rewriting each of them over and over and over to get the original tool chain to output bit for bit the exact same binary as they started with. Something like taking x-rays of an unknown machine and being able to recreate perfect pixel replicas of the engineering drawings or listening to a piece of music and being able to exactly write out the score.
- bluedino 7y agoSounds like a job for a genetic algorithm or machine learning.
- MereInterest 7y agoI'd recommend watching this CppCon talk [1] about compiler optioning. It isn't just that recompilation is hard, or that it is difficult for humans to do. At a fundamental level, the information is not there at all, because the compiler can make very impressive optimizations. Machine learning can deal with weak signals, but it can't deal with no signal. [1] https://www.youtube.com/watch?v=nLv_INgaLq8 https://www.youtube.com/watch?v=nLv_INgaLq8
- squarefoot 7y agoThere goes the old say: "that would be impossible just like attempting to get the original cow by putting together ten thousand hamburgers".
- CamouflagedKiwi 7y agoThey mention in the thread that the binary seemed to have been compiled without optimisation, which means it's a lot easier to translate back to source than most games would be.
- bni 7y agoThere has been similar things done in the past, for example for Dune Legacy (Dune II) or REminiscence (Flashback) Mario 64 is more recent so might be a magnitude more complex. There are also other approaches, like a total re-implementation, not a decompile/re-source. ScummVM engine for Blade Runner, the adventure game from 90's is a recent very impressive example of that
- undershirt 7y agoI can’t believe ScummVM has re-implemented 72 classic game engines[1] from scratch. They also document their basic revere-engineering strategies[2]. [1] https://github.com/scummvm/scummvm/tree/master/engines https://github.com/scummvm/scummvm/tree/master/engines [2] https://wiki.scummvm.org/index.php?title=HOWTO-Reverse_Engineering#Disassembly_Strategies https://wiki.scummvm.org/index.php?title=HOWTO-Reverse_Engin...
- shmerl 7y agoNintendo freak out in 3, 2, 1...
- papermachete 7y agoYeah can't post on 4chan without a VPN, should've used 8ch.
- faissaloo 7y ago/tech/ would love this
- 0815test 7y agoI mean, that's just Nintendo being Nintendo. You know they will freak out over the silliest stuff when it comes to their Mario franchise, it's just a given. Maybe these folks should have decompiled some "orphaned" code/game where we literally have no idea who the copyright owner even is, then at least it would bring the stuff back from obscurity. But Mario 64 is just 'meh'.
- hayez1 7y agoWhat are you talking about? Super Mario 64 is an extremely loved game and is still played. People will find much more interest in this than some obscure game that nobody cares about. People are passionate about this game and there is a good chance of a PC port of the game now (as well as more substantial mods) because of that.
- ekianjo 7y agoFreak out on something that is not widely publicly available? How so?
- m-p-3 7y agoWell the code is out there now, and I'm sure many have a copy.
- 7y ago
- john_alan 7y agoWow. They recreated the source from the IDA output instructions. Holy shit.
- saagarjha 7y agoFrom IDA's decompiled source, presumably, with manual tweaks to make it compile the same.
- comex 7y agoNo, they did it by hand.
- saagarjha 7y ago!!
- rishabhd 7y agoAbsolutely mind boggling.
- Jasper_ 7y agoThe team also had somewhat of an automated decompiler but it's really just a skeleton to get started from. https://github.com/matt-kempster/mips_to_c https://github.com/matt-kempster/mips_to_c
- giancarlostoro 7y agoThe game modding community never ceases to amaze me. I know of a few communities that are Reverse Engineering shockwave just to be able to retrieve original game code, and in some cases create private servers for defunct games. Also theres a cool project archiving all Flash and Shockwave games called BlueMaximas Flashpoint. The people working on preserving these old games are amazing. I do fear the death of some of those awesome NewGrounds games.
- vectorEQ 7y ago
- travbrack 7y agoAnyone know how much manual work was needed to do this? Did they just use a tool to generate the C code? The functions unhelpfully have names like func_802507AC.
- iforgotpassword 7y agoIt's in the third post or so. Apparently Nintendo didn't turn on any compiler optimizations so porting the mips assembly back to c and fiddling around a bit until the original compiler produced identical instructions again was a feasible thing to do.
- simcop2387 7y agoThat makes me wonder how much better we can make it perform by turning on optimizations (and likely fixing undefined behavior in places). There's quite a few locations in the game where the framerate and gameplay suffer.
- flukus 7y agoIt was one of the first games and easily outclassed by later releases so I'm sure there are many optimizations that could be made. I hope we get the same with Waverace one day, nothing since has matched the feel of the wave physics in that one, it would be interesting to see what they did.
- whiddershins 7y agoOne of the “first games”? What on earth do you mean?
- icebadger 7y agoOne of the first games released on the N64 system. https://en.m.wikipedia.org/wiki/Chronology_of_Nintendo_64_games https://en.m.wikipedia.org/wiki/Chronology_of_Nintendo_64_ga...
- soup10 7y agoits cool and all, but i've seen this before with other games and what happens is the people that want to do game development and people that want muck around with old decompiled source code are two different camps of people so I wouldn't expect much
- darkpuma 7y agoThe result is often a classic game running on a modern system without needing to jump through hoops, which is a huge win to people who enjoy playing the game in question. OpenTTD, OpenRCT2, and OpenMW all come to mind, not to mention the many ports of Id games.
- soup10 7y agoAFAIK the n64 emulators don't have any real issues with SM64, this seems more useful for easier rom hacks
- Narishma 7y agoEmulators require much more resources than a native game.
- AnIdiotOnTheNet 7y agoTrue, but in perspective a decent N64 emulator requires less than a modern web browser. Though admittedly that's a really low bar.
- Wowfunhappy 7y agoIt would be cool to get SM64 running at fullspeed on something like an older Rasberry Pi, which I think should be feasible now. I also wonder if you could add stuff like raytracing given the original source. (Obv not on the Pi)
- deleted 7y ago
- lifthrasiir 7y agoIt should be also noted that the inner working of Super Mario 64 is already extremely well known due to numerous TAS attempts, so I found this manual decompilation hardly surprising. A recent video [1] detailing the "one-key" TAS [2] is mind-blowing. [1] https://www.youtube.com/watch?v=wjge1bVobN0 https://www.youtube.com/watch?v=wjge1bVobN0 [2] http://tasvideos.org/3264M.html http://tasvideos.org/3264M.html
- t0astbread 7y agoAlso worth noting here is pannenkoek2012: https://www.youtube.com/user/pannenkoek2012 https://www.youtube.com/user/pannenkoek2012 https://www.youtube.com/user/pannenkeok2012 https://www.youtube.com/user/pannenkeok2012 His explanations are mind-blowing as well and fun to watch :)
- t0astbread 7y agoUpdate: He has a (long!) Wikipedia article: https://en.wikipedia.org/wiki/Pannenkoek2012 https://en.wikipedia.org/wiki/Pannenkoek2012
- roel_v 7y agoThe really mind-blowing thing here is how the real name of a guy with the handle 'pannenkoek2012' can be 'Scott Buchanan'.
- gfaure 7y agoWhy?
- blaser-waffle 7y agoWhy? Everyone loves pancakes
- claudiawerner 7y agoOddly enough, "pannekoek" makes me think of the political philosopher (of whom I'm a fan), though this is likely on account of me not speaking Dutch.
- justanegg 7y agoso a pc port could happen?
- JeanAraujo 7y agoBest day in pannenkoek's life
- nim-ka 7y agoHe used this in one of his videos a few months ago...
- Gene_Parmesan 7y agoHis video on the Rolling Rocks 0.5 A press clear is one of the most informative and entertaining technical videos I've ever watched. I had never heard of the guy before watching that video, but I gleaned from the comments that there was something about it turning into a meme, and turning the guy off from making more commentated vidoes? If so, that's a real shame, because I could watch content from him all day long.
- devit 7y agoSurprising that an unoptimized build could be fast enough to not be noticed.
- favorited 7y agoTheir toolchain might not have been mature enough at that point for the compiler to optimize reliably. Just means they had to optimize it manually.
- Newtonip 7y agoThe SDK used the compiler from the IDO 5.3 package which was provided by SGI for developing in IRIX 5.3 (if you paid the extra for that option). I think by then it would have already been pretty mature.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- sayusasugi 7y agoFrom some brief research, a developer reported they're only 60% of the way there and the audio system hasn't been decompiled yet.
- ekianjo 7y agoNo, 60% is just about renaming the functions.
- holmium 7y agoIn this leak, there's still a fair bit of decomp work to be done on the audio systems. Otherwise, you are right: the majority of the work left is to document the functions, to organize the code so that it's easy to mod and play around with, and to provide high level documentation on the systems/how the decomp was made. You wouldn't want anyone to think that all you have to do to decomp something is to run a binary through IDA, right? Plus, there are more released versions of SM64, and who knows what's in there?
- m-p-3 7y agoThe build is reproducible (provides the same binary output as the original), so the remaining work is to rename the function to make it easier to understand.
- noname120 7y agoInterestingly, there exists other projects that aim to rebuild exact original ROM's. For example, Pokémon Ruby and Pokémon Emerald have been disassembled[1][2] and then slowly converted to C making sure that the hash of the ROM always stays the same. [1] https://github.com/pret/pokeruby https://github.com/pret/pokeruby [2] https://github.com/pret/pokeemerald https://github.com/pret/pokeemerald
- aliswe 7y agoShouldn't this be possible using some AI and/or brute force technique?
- vages 7y agoGiven infinite time and computing power, yes.
- setr 7y agos/and/or You just need one :)
- yellowapple 7y agos/s\/and\/or/s\/and\/or\// Can't forget that trailing slash :)
- aliswe 7y agoWell given a set of known, used optimization techniques the backward operation would be possible to try. If it matches the target binary, would be one step closer to something considered source reconstruction.
- slowhadoken 7y agoEvery link that leads to this file is shady af haha smh