14 ms·
Super Mario 64 has been decompiled
- deleted 7y ago[deleted]
- bla3 7y agoNintendo will request a takedown the second they see this, no?
- derefr 7y agoWhat for? There's no copyrighted material in this repo.
- bri3d 7y agoThe copyright status of explicitly decompiled source is still unproven in the US, as far as I know. SAS vs World Programming seems to indicate that decompilation followed by reimplementation over a wall is probably not infringing, but I don't think a case has been tried around the direct output of a decompiler (i.e. OpenRCT, this SM64, etc.).
- lostgame 7y agoThe models and sounds aren't copyrighted? Because they are totally within the GitHub, there...
- kelnos 7y agoI didn't look through the repo, but given that the linked README talks about needing an original version of the ROM in order to extract assets, I would guess they're not in there?
- mhh__ 7y agoObviously IANAL, but my understanding was that conversion and translation is deemed to be under the same copyright as the source.
- temac 7y agoThere is pretty-much only copyrighted material in this repo. Copyright is not purely literal, especially when it's copyright of computer code...
- willis936 7y agopokered and its derivatives have been on github for many years. As long as it stays to a small scope Nintendo seems content to let these small projects be. That could change at any second though. Clone while you can.
- bri3d 7y agoAs an amusing side-effect, the team working on this effort also implemented IRIX userland support for QEMU since the original N64 toolchain ran on IRIX on the SGI Indy, and they need the original compilers to verify functional equivalence of their source: https://github.com/n64decomp/qemu-irix https://github.com/n64decomp/qemu-irix .
- WalterGR 7y agothe team working on this effort also implemented IRIX userland support for QEMU What does this mean? I think of QEMU as emulating hardware... What exactly is being emulated here?
- tw04 7y agoIt means they managed to get irix running in qemu. Presumably on an x86 cpu. Notable because the sgi indigo had a MIPS R3000A CPU. https://en.m.wikipedia.org/wiki/SGI_Indigo https://en.m.wikipedia.org/wiki/SGI_Indigo
- Frenchgeek 7y agoThere is some alpha generic mips support for qemu ( https://www.linux-mips.org/wiki/QEMU https://www.linux-mips.org/wiki/QEMU ), so it could be a set of patches to run IRIX on Qemu's generic MIPS machine emulator...
- messe 7y ago> It means they managed to get irix running in qemu. Presumably on an x86 cpu. Not quite. It means that they got qemu to emulate IRIX's syscall layer on linux. So you can run, lets say, a MIPS IRIX binary on x86 linux without having to emulate the entire machine.
- bri3d 7y agoNo - qemu supports "userland" emulation where the processor ISA is emulated but syscalls and memory are translated to the host OS. The IRIX kernel and OS doesn't run in this scenario.
- tempsolution 7y agoStill amazes me that people actually spend time on such things :D. Decompiling 100 year old software whose source code most likely didn't look much different from what the decompiler spits out. What's the point?
- derefr 7y ago> What's the point? Mods! Much easier to modify source code than a compiled binary.
- umvi 7y agoYou get all sort of interesting things to come out of it too... like an MMO version of Mario 64
- PhasmaFelis 7y agoSame as any other impractical-but-fun project that gets featured on HN. It's weird to me that people keep being surprised.
- tempsolution 7y agoIt's more an indicator that apparently either not many meaningful things happen (which I doubt) or somehow people use this a some retro-wanking where they imagine "Uh yeah back in high school I was also working on stuff like this, those were the days". What I am saying is that it doesn't surprise me people do these projects, what surprises me is that enough people care about them for it to make the front page of HN.
- saagarjha 7y agoOn the contrary, I feel like these kinds of projects are exactly what should be making the front page of Hacker News.
- PhasmaFelis 7y agoIt's an indicator that different people are interested in different things. I'm not sure why you're determined to spin this into a personal failing.
- derefr 7y agoOne thing I've always been curious about: is there any sort of clear continuity of architecture or design patterns between the games in the Super Mario series? Yes, they're probably all from-scratch rewrites of the engine, but could each successive engine be said to be a "descendant" of a previous one, on a design level? One thing I know (and can be seen in this repo) is that SM64 emulates a version of the NES/SNES "Object Attribute Memory", as a pure-software ring-buffer. (I'd love to know whether that carries on to later titles like Galaxy, 3D World, NSMB(U), Mario Maker, etc.)
- sieabahlpark 7y agoThere is probably an amount of code that is copies over to the new project that isn't game-specific.
- canjobear 7y agoZelda OoT was based on the Mario 64 engine
- Relys 7y agoThat makes a lot of sense as it's not like they had a lot of 3D engines for the N64 during launch lol. Wonder if Pilot Wings (for example) also shares similar rendering pipeline.
- Jasper_ 7y agoPilotWings 64 was made by a separate company (Paradigm), who used a very different structure for their games which feels a lot more "western" to me (the UltraVision 64 "engine" has a large structured data chunk which it reads a lot of stuff from; most Nintendo 64 games don't really have that sort of structure)
- bluedino 7y agoKnow anything about Turok?
- codesushi42 7y agoIt would be great if this could be done for games where the source code was lost. Like Panzer Dragoon Saga.
- mburns 7y agoThis decompile was done without the original source code, just the released game, which is effectively the same as being ‘lost’.
- codesushi42 7y agoI meant where the source code does not exist anymore, anywhere. Nintendo still has the source to SM64.
- mburns 7y agoMaybe I misunderstood you. I’m saying this same decompile process could indeed be done to any released game where the source code is lost, because that is effectively what happened in this case.
- filoleg 7y agoI think you misunderstood what the parent was saying. On the technical level, you are correct in that in both scenarios the end result would be the same, as you are going from compiled code to decompiled code. What I believe the parent is saying, is that applying this to Panzer Dragoon accomplishes more (on the human level), because devs of that game don't have the original source code anymore, while Super Mario 64 devs do.
- jolmg 7y agoMaybe the confusion could have been avoided if instead of: > It would be great if this could be done... codesushi42 would have said (emphasis mine): > It would be great if this would be done... Not that I think it was incorrect as it was, just a little ambiguous, I guess.
- DiseasedBadger 7y ago"For Windows, install WSL and a distro of your choice and follow the Linux guide." I love these instructions! Also, I'd love to see this converted to a native executable. I wish Nintendo would actually allow that, although I'm sure they wouldn't.
- zsrxx 7y agoA native executable? It's not like the Nintendo 64 was using DirectX
- Zelizz 7y agoYou'd need to emulate/simulate/shim all the graphics calls and state changes, but that shouldn't have any bearing on the actual code architecture. In fact, given that Dolphin uses a JIT, you could argue that this already happens to some degree when you're playing Gamecube games, having the source just allows ahead-of-time compilation.
- sigotirandolas 7y agoIf I remember correctly, some time ago I saw a video from someone who managed to build a substantial part of SM64 as a native executable and was able to verify that tool-assisted runs ran perfectly on in it (hence it being accurate). The video displayed the game as a wireframe and had no audio, since those parts are surely tied to the N64 hardware. I can not figure out the right keywords to find it again, but you may be able to if you are interested. EDIT: Even though I can't find the video anywhere (I promise it existed!), from https://warosu.org/vr/thread/5644072 https://warosu.org/vr/thread/5644072 "To answer your questions, yes: This is a full source code which can be recompiled with modern toolchains (gcc: ive done this already) and even target other platforms (PC) with quite a bit of work. There already exists some proof of concept wireframe stuff."
- alexhaber 7y agohttps://www.youtube.com/watch?v=7VbTe7U-bo4 https://www.youtube.com/watch?v=7VbTe7U-bo4
- dooglius 7y agoPrevious discussion: https://news.ycombinator.com/item?id=20418577 https://news.ycombinator.com/item?id=20418577
- Mathnerd314 7y agoThis is the "official" release, where someone from the team that was working on the decompilation is making it public rather than just a random person on the Discord. But not much has changed, I guess it's hard to make progress in a month.
- ortusdux 7y agoI am looking forward to the mods that this will enable. I highly recommend trying mario 64 on dolphin EMU at 1080P with a texture pack. A HD mod that added a few more polygons would really round out the experience.
- saagarjha 7y ago> I highly recommend trying mario 64 on dolphin EMU Wrong console?
- JimiofEden 7y agoThere was a virtual console release for Mario 64, so it's still applicable
- saagarjha 7y agoWould this help improve the Virtual Console release?
- chrisstanchak 7y agoIt would only help if the virtual console release is emulated.
- Wowfunhappy 7y agoAs silly as it may seem to use an emulator to run another emulator, Dolphin makes it quite easy to create and load custom textures, so it's a solid choice in this instance.
- edoceo 7y agoMupen64 for N64, with a python GUI. Was playing last night, best Mario ever.
- urda 7y agoIs a raspberry pi a good-enough platform to run N64 1080P games on?
- deleted 7y ago[deleted]
- crtlaltdel 7y agolol i love seeing all the replies to comments on this that start with "No."
- deleted 7y ago[deleted]
- person_of_color 7y agoSo how do people do this? Manual inspection?
- aeneasmackenzie 7y agoThey got the original compiler running and made source that compiles to the same ROM.
- person_of_color 7y agoHow does that work? They still manually reversed the disassembly right?
- ryan-allen 7y agoThey wrote it in assembly, nuts!
- o-__-o 7y agoBinary executables are machine code. One step from machine code is assembly. It’s easy to translate machine code to ASM (because you are just reversing the op code and adding data structures) from there it gets hard because compilers do all sorts of tricks to create performant assembly and throws away hints about code structure (e.g a simple overloaded function may become an ASM routine with 30 parameters depending on how it’s called. Or vice versa.. it’s like trying to recreate HD video from mpeg-1, entropy has been thrown away). So decompiled code is usually left in assembly. Sometimes an effort is made to create the C equivalent but that’s a maddening effort. More than likely SM64 was written in c with some critical performance parts in ASM (like mode7 and some of the OAM stuff other threads talk about).
- lame88 7y agoWhat an awesome project. I would love to mess with random stuff like whirlpool strength and see what it does to the game. Efforts like this to make the decompiler output intelligible e.g. meaningful variable names make this much more approachable for a technical person like me without much of the niche platform-specific reverse engineering skills. In fact there are countless games I'd love to dive into like this.
- thanatropism 7y agoTrain a ML system on a range of parameters (whirlpool strength) until you have a decent port of the game to a neural network and/or tree-based algo. Then try to optimize the game based on people’s enjoyment.
- im3w1l 7y agoI think it would be much easier to use change the parameters directly in the original program. Just have to use a gradient-free optimizer.
- thanatropism 7y agoYours is a better technical approach to the vague dream I had described. Am I being downvoted because I don't have an optimal solution to some problem?
- euske 7y agoThis is cool and illegal. What makes me envy of the West (or countries other than Japan in general) is that this kind of attempt is somewhat condoned and praised, while in Japan there would be a vocal outcry and finger-pointing campaign (with some media exposure) to the point where the author would be forced to shut down the project. It's a blessing that people can pursue things like this, and it's a huge shame that Japan is such an anal when it comes to a marginally illegal activity in an open space. (I'm sure some people do it underground though.)
- therealx 7y agoIt's only because of time. If this were done on a newer platform/game or a game not as beloved, it would be closer to what you said.
- sdrothrock 7y ago> It's a blessing that people can pursue things like this, and it's a huge shame that Japan is such an anal when it comes to a marginally illegal activity in an open space. I've noticed spillover effects into Japanese gamers as well -- people being suspicious of or derisive about mods, even when they're perfectly legal and the game has built-in mod support (looking at you Monster Hunter World). My (Japanese) girlfriend is on the very conservative side of the spectrum there and absolutely hates it when I bring up any kind of modding, and so do her friends -- the culture of "authorial intent is king" is very strangely strong for a culture that also appreciates and enjoys doujin.
- triodan 7y agoDoujin works are made with the awareness that they are parodies of the original work. It does not alter the body of the original work in any way and, as the term itself means, self-published. It is made without any direct affilation in regards to the original work.
- hocksoff 7y agoYour use of the term “open space” is interesting. The Comic Market could probably be considered a closed space but 600,000 annual attendants at a convention that glorifies and commercializes copyright infringement (to a good extent) suggests that there’s spaces in Japan for this sort of thing.
- kbumsik 7y agoI don't know much about reverse engineering field, but more than 70% code is assembly. Is extracting assembly still considered decompiled?
- ehsankia 7y agoThe real effort here is cleaning up the assembly, and as you mention it's nowhere close to being done, but it keeps getting posted every once in a while. Here's another post from a month ago: https://www.reddit.com/r/programming/comments/cbvl6l/super_mario_64_was_fully_decompiled_c_source/ https://www.reddit.com/r/programming/comments/cbvl6l/super_m...
- holmium 7y agoOutside of a few audio and PAL routines (see asm/non_matchings), everything that was written in C has been decompiled back into C. There are a few routines written in ASM, like the boot code and some of the SDK code. Most of the other "assembly" files are for data, like the level scripts. It's not assembly of machine code. You could try to put those into C, but you're not gaining much--assuming that it's even something that can be represented in C without a bunch of fancy compiler specific tricks. You'd be better off creating a DSL or a custom program suite, which is probably what Nintendo was doing 25 years ago.
- mrpippy 7y agoOnce the inevitable native ports start appearing, I’d love to see an OpenGL 1 graphical backend so it can run natively on IRIX
- segmondy 7y agoIt's amazing the level of effort and work that has gone into this and here I'm trying to finish a 100 line side project. :-]
- WilliamEdward 7y agoYou can get a lot more done with a team of people who are also getting paid.
- breakingcups 7y agoWho was funding this decompilation? Was it from the speedrunning community?
- JohnSmith13345 7y agopannenkoek2012 would probably find more glitches, assuming this doesn’t get taken down by Nintendo given their aggressive stance on copyright
- vSanjo 7y agoAlways a little humbling to remember the developers are just like you and I. https://github.com/n64decomp/sm64/blob/master/src/game/camera.h#L379 https://github.com/n64decomp/sm64/blob/master/src/game/camer... https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691bf0f09201cfeeeb1d9f1/src/game/level_select_menu.c#L111 https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691b... https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691bf0f09201cfeeeb1d9f1/src/game/behaviors/spiny.inc.c#L59 https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691b... https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691bf0f09201cfeeeb1d9f1/src/game/debug.c#L181 https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691b... https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691bf0f09201cfeeeb1d9f1/src/game/mario_misc.c#L33 https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691b...
- laurent123456 7y agoIt's interesting there are bits of code that don't have a purpose, and may have been there to support a second player. For example here: > This is evidence of a removed second player, likely Luigi. > This variable lies in memory just after the gMarioObject and > has the same type of shadow that Mario does. The `isLuigi` > variable is never 1 in the game. Note that since this was a > switch-case, not an if-statement, the programmers possibly > intended there to be even more than 2 characters. https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691bf0f09201cfeeeb1d9f1/src/game/shadow.c#L530 https://github.com/n64decomp/sm64/blob/4b46247686fd0e1ee691b... And more results when searching for "luigi": https://github.com/n64decomp/sm64/search?q=luigi&unscoped_q=luigi https://github.com/n64decomp/sm64/search?q=luigi&unscoped_q=...
- Wowfunhappy 7y agoI vaguely recall reading that the multiple characters in SM64DS were a feature that was cut from the original game. Am I hallucinating or did Nintendo say that somewhere? (The additional characters in the DS remake were horribly unbalanced, so I wonder if the earlier implementation would have been better...)
- diveanon 7y agoIs there a usb compatible n64 controller? Part of what makes this game such a watershed moment for 3d gaming is how the controller was designed to maximize it's potential. To this day Mario 64 is one of the best games ever made.
- andimm 7y ago8bitdo once hat an N64 controller, but seems like it's not available anymore, maybe you find a used one somewhere. Also there are "Controller Converter" N64->USB available on i.e. Amazon and iNNEXT has an Retro 64-Bit N64 Controller on Amazon as well. Don't know if any of these will work for you, at least the iNNEXT is mentioned in the retropie wiki[0]. [0] https://retropie.org.uk/docs/Nintendo-64/ https://retropie.org.uk/docs/Nintendo-64/