Hacker News new | ask | show | jobs
by xurukefi 885 days ago
Fascinating work. I know that people did the same for Super Mario 64 [1]. It is still unbelievable to me that they can generate a bit-by-bit identical copy of the original ROM by simply running some old gcc on actual C source code files. IIRC the main insight was that Nintendo did not use any optimization flags which made it possible to create a 100% matching binary. I've never really looked into it, but I guess the did some try and error to figure out the exact gcc version that Nintendo used to make sure that they get 100% identical binary code?

[1] https://github.com/n64decomp/sm64

3 comments

SM64 uses SGI's IRIS Development Option (IDO) compiler. And yes, it's unoptimised.

Paper Mario, however, /does/ use GCC, and it's optimised. Figuring out the compiler version was fairly easy as there's a limited number of options - we know when the game began development, so we looked for releases around that time. The harder parts were figuring out compiler flags (consider all the -f flags affecting code generation; papermario used -fforce-addr) and coming to the terrifying conclusion that the compiler was modified!

The majority of papermario was built with a modified build of GCC 2.8.1 [1] at -O2. The SDK code (libultra, nusystem) was built with GCC 2.7.2 at -O3. The iQue Player version, i.e. the Chinese release, was built with EGCS.

[1] https://github.com/pmret/gcc-papermario

Thanks for the insight. The fact that Paper Mario uses optimizaion flags makes this project even more fascinating. Great work.
There's an amazing video about refactoring Mario 64 to reach 30 FPS and render 6x faster on N64:

https://youtu.be/t_rzYnXEQlE?si=ZWpp7-74cMdbsdba

The changes were much more extensive than just removing the debug flags.

They were also able to get local coop and a 4 player split screen working which were features originally intended for the game but cut for performance reasons.

> I guess the did some try and error to figure out the exact gcc version that Nintendo used

The official SDKs have been leaked for decades, so they probably just looked there.

Did Nintendo's SDK's use GCC back then?

Hopefully they shipped the GPL source with it!

They used IDO, but GCC was an option, I think.