Beyond Emulation: the Massive Effort To Reverse-Engineer N64 Source Code (arstechnica.com) 61
Slashdot reader thereitis shares a report from Ars Technica that "delves into the reversing community's efforts to produce usable C source code from N64 game binaries." Here's an excerpt: Early this week, with little warning, the Internet was graced with a Windows executable containing a fully playable PC port of Super Mario 64. Far from being just a usual emulated ROM, this self-contained program enables features like automatic scaling to any screen resolution, and players are already experimenting with adding simple graphics-card-level reshaders, including ray-tracing, as well. The PC port -- which was released with little buildup and almost no promotion -- wasn't built from scratch in a modern game engine, in the manner of some other now-defunct Super Mario 64 porting projects. And its release has nothing to do with a recent leak of internal Nintendo files dating back to the Gamecube days. Instead, the port seems to be a direct result of a years-long effort to decompile the Super Mario 64 ROM into parsable C code. This kind of reverse-engineering from raw binary to easy-to-read code isn't a simple process, but it's an effort that a growing community of hobbyist decompilers is undertaking to unlock the secrets behind some of their favorite games.
All that work... (Score:1)
Re:All that work... (Score:5, Informative)
A lot of it is automated. Look at what machine code the compiler produces and figure out what C code that relates to. Ghidra can do a decent automated job of it if you want to try it.
Super Mario 64 is helped by the fact that it used a known version of GCC with optimization disabled because at the time it was buggy. A later Japanese release of the game enabled optimisation with a later version of GCC and is proving harder to turn back into C code.
Incredible effort, well done.
Re: (Score:2)
Re: (Score:3, Informative)
Yes, when any company makes a new architecture they usually add support to gcc as a kind of baseline. It's almost the minimum standard now, you have to have gcc support. Makes sense, your new architecture can make use of all the existing tools and workflows people have, and it puts you well on your way to having a decent debugger too in the form of gdb.
Re: (Score:3)
> usually add support to gcc as a kind of baseline. It's almost the minimum standard now
Sure, but his point is about what happened more than a quarter century ago.
Can confirm buggy optimizer - my CS level was the first class doing C++ on gcc at the same time that Nintendo was developing N64. Very frustrating to learn CS on a buggy compiler and too many kids dropped out from frustration.
Re: (Score:2)
The bugs were not GCC per se. The whole game is C and assembler anyway. The optimisation bugs were for the specific CPU in the N64.
Re:All that work... (Score:4, Informative)
gcc has been used on:
* DS games
* PS1 games
* PS2 games (along with SN Systems C++ Compiler)
* PS3 games (along with SN Systems C++ Compiler)
I know because I've shipped games on those platforms. (On the Wii there was Metrowerks CodeWarrior.)
Re: (Score:2)
Re: (Score:2)
(On the Wii there was Metrowerks CodeWarrior.
Which Konami, interestingly, used for their Playstation2 Dance Dance Revolution games. (Thank goodness for incredible amounts of symbol data being left in every PS2 version's executable file, which is how that was learned. Now I just hope someday it can be determined if it uses DWARF 1.0, or 2.0, and if there is a way to extract the other, non-symbol debugging data in a readable form, as it would go a long way in making my effort to reverse engineer PS2 DDR mixes easier. XD)
Re: (Score:2)
Ooooh, I completely forgot that CodeWarrior was available on PS2.
Speaking of old games ...
You should fire up Master of Orion 2 in Borland C. ALL the function names and global variables are exposed! Looks like someone forgot to strip symbols when shipping. Whoopsie-daisy! :-)
Re: (Score:2)
Ghidra can do a decent automated job of it if you want to try it.
Yes its amazing what that can do for a free tool, IDA is even more impressive.
That is long way from producing .c files for a big project like a video game, you can feed back into your favorite compiler though. I do security work so I patch binaries quite often to do things like add instrumentation, bypass checks to see if a debugger is running etc; but that is a long way from just being able to do my own build from sources generated off your binary. Heck even in the world of IL and smali where reflection a
Re: All that work... (Score:2)
Given that HexRays doesn't support MIPS you're definitely not getting better decompilation for this particular problem with it.
Re: (Score:2)
Yeah, I hated it whenever I ran into stuff that had been "optimized" ... got real ugly, real unrecognizable after a while.
But I just happened to run across this: https://github.com/n64decomp/s... [github.com] An N64 decomp (assembly (ugly, don't recognize a line) and C). Are we talking the same stuff?
Re: (Score:2)
That's the one.
Takedown notice in 3-2-1... (Score:4, Insightful)
Re:Takedown notice in 3-2-1... (Score:5, Insightful)
Re: (Score:2)
No one needs to release source code, but if they want it to be widely distributed AND NOT GET SUED then they need to do it before the IP owner notices what they are doing.
Re: (Score:2)
Re: (Score:2)
Important to note that _only_ the reverse-engineered source code is published. You still need an original copy of the game to produce the graphics and sound resources.
Re: (Score:2)
It's legal on the same basis as emulators that re-implement firmware are. For example until a few years ago the Gameboy boot ROM hadn't been dumped so emulators had their own versions created from scratch. Similar to how the PC BIOS was cloned from the specification.
The port is legal. You need the original ROM to extract the game assets, it doesn't come with them. Same as emulators that need ROMs to work.
Re: (Score:1)
Nintendo can not allow whatever they want.
Meanwhile the internet will continue to ignore them and carry on as usual.
The internet's curiosity and nostalgia just doesn't give the slightest shit about what big corporations think.
Re: (Score:2)
They can't do anything about it. There is no copyright infringement here.
The source code was reverse engineered. Some people took the Mario 64 ROM binary and used analysis tools and an identical copy of GCC to the one it was compiled with to reverse engineer the source. There are tools that can do a lot of the work automatically because GCC with no optimisation enabled produces very predictable machine code.
The source doesn't include any of the binary assets like graphics or sound. There is a supplied tool
Re: (Score:2)
I'm pretty sure that's not good enough.
I once worked on a project that had actually legal reverse engineering of a binary. That involved a strict setup where one group of people were allowed to disassemble the ROM in question. Then they wrote a specification document.
A completely different group of people then took that spec and wrote fresh source code implementing the same behavior. These people were not allowed to ever disassemble or debug the original ROM at all. (If they ran into problems, they could wr
Re: (Score:2)
That's what they did though. The binary is a set of instructions describing the operation of the game. They took that description and turned it into brand new C code that performs the same function.
It's been out for a while now, Nintendo have not hit GitHub with a DMCA.
Re: (Score:3)
They did it through a mechanical transformation, not through a wholly new creative effort by humans. That doesn't cut it legally, regardless of whether Nintendo bothers to pursue it or not.
Re: (Score:2)
You've got to be kidding. Of course it is infringement. This is no different than scanning a book, using analysis tools and an identical copy of Word, and 'reverse engineering' the source of the book, then publishing it themselves.
Re: (Score:3)
Re: Takedown notice in 3-2-1... (Score:2)
You can't use the source code to reverse engineer the source code. You can reverse engineer a black box to develop an alternate implementation, but that's not what was done here. This would be more akin to translating a copyrighted work, which is not ok without permission.
Sadly it'll be dead within a few weeks (Score:3, Informative)
While the authors have said they're doing their best to avoid stepping into any illegal areas, we all know full well that any day soon these poor guys will most certainly be getting a nicely worded email from Nintendo's favourite law firm asking them to "Can the project or face the consequences!".
Re: (Score:2)
I don't think you can find a loophole that gets around this being a pretty monumental piece of infringement. I'm going to wager not just copyright infringement, but also trademark infringement as well.
Re: (Score:1)
Re: (Score:2)
Re: (Score:3)
In fact, they have to, otherwise their property can become public domain.
That's not exactly true. Trademarks can be lost if they're not defended, but not patents or copyrights. There doesn't appear to be any trademark issues here.
Re: (Score:2)
No they don't. You're mistaking trademarks with copyright. Copyright may or may not be defended at any time. In fact a company can let copyright infringement slide for years and then suddenly decide to enforce its copyright.
Re: (Score:2)
However, they won't be able to get damages during the time they let it slide.
Citation needed? I thought part of being a copyright holder is deciding what others can/can't do with your work - and it'd be obvious that those cans/can'ts are subject to change over time.
Re: Sadly it'll be dead within a few weeks (Score:1)
Re: (Score:2)
What I don't understand is why people would spend so much time and effort, when they know from the start that what they're working on belongs to someone else. Just...why? Do they not know that Mario is property of Nintendo?
> I speak only from my own experiences in attempting to reverse engineer Konami's Dance Dance Revolution series, but for me doing something like this can have a few reasons behind it. For one, it is a nice challenge. It is also fun seeing what the game engine is capable of, and enabling cool mods, all of which is made a lot easier when the game is put in a form that is much more readable.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
The price of a used N64 cart goes from $1 to $1.50? Oh no!
Re: (Score:3)
Re: (Score:2)
You are the sort of ignorant twat that makes life difficult for the rest of us.
If you had actually bothered to... I don't know... DO SOME FUCKING RESEARCH before going off half-cocked, you'd have seen that the project
...does not include all assets necessary for compiling the ROMs. A prior copy of the game is required to extract the required assets.
For the more soft-headed among us (meaning you, in this context), that means that none of Nintendo's IP is included, and there is nothing whatsoever illegal, unethical, or immoral about this project.
Congratulations. You've now wasted your time, Nintendo's laywers' time, mods' points, and my
I have converted binary - assmbly - C before (Score:1)
But that was a crazy process for a small program. I might have known the C program that I was trying to reconstruct too, I don't remember. But I couldn't imagine the work that would have to go into a program this big.
Until it was slashdotted (Score:1)
Problem with old games on new archecture (Score:3, Interesting)
I have seen a problem with many old games running on new architecture. While they run, the will often lack a degree of the charm from the original version.
For example many of these games were meant to play on a crappy CRT TV. where Pixels were not Square, and there was color bleeding, then putting them on a High def screen say a 3840x2160 resolution things look very blocky, and I havn't found a filter yet, that really emulates the old mode well.
But on the IBM PC CGA-VGA the standard resolution for graphics at 320x200 the Standard Text block took a 8x8 pixels. That means we could in theory run old DOS Games in pure Text mode and still have resolution left over.
Re: (Score:2)
This isn't the game, it's the game engine. And it's an old game engine. I can't see this hurting Nintendo at all, even if they just ignore it. There might even be a way that they could use it to help themselves. Id got some benefits from the available source of their game engine.
Well the rumor is (Score:2)
Re: (Score:1)
Re: (Score:2)
I can't see this hurting Nintendo at all, even if they just ignore it.
Even if Nintendo isn't directly hurt by this now and wanted to just ignore it they can't.
If they don't publicly try to do something to protect their IP they might set a possible president that could cause trouble for them further down the line. What if the next game engine someone tries to reverse engineer is one that Nintendo is still profiting from? As a defense the dev/group doing the RE could point at this N64 project and say "Nintendo didn't have a problem with that so why are they complaining now?".
Re: (Score:2)
If they don't publicly try to do something to protect their IP they might set a possible president that could cause trouble for them further down the line.
Yeah, that's ⦠unsubstantiated. Completely.
Lucasfilm has no problem going after people who use their IP in ways they don't like, same with Capcom, SEGA, VALVe, etc, and they all have varying amounts of permissiveness with regards to what not-for-profit things fans can do - SEGA even has been really amicable towards people who have been reversing the Sonic the Hedgehog series, a community that has existed for over 25 years now!
ALERT! Missed research opportunity here! (Score:1)
Hey assholes, this is what you should be doing with those giant A.I. clusters instead of making motherfucking chat bots.
Easy to read? (Score:1)