Live data from Hacker News

Super Mario 64 has been decompiled

github.com

121–130 of 180 posts

Re: Super Mario 64 has been decompiled

#121

I don't know much about reverse engineering field, but more than 70% code is assembly. Is extracting assembly still considered decompiled?

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

Re: Super Mario 64 has been decompiled

#123
post #9

One 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 "…

I wonder if Nintendo shared source code with 2nd parties, like Rareware. I know they provided design consultation on Banjo-Kazooie, but perhaps they also provided source code?

Re: Super Mario 64 has been decompiled

#124
post #68

Earlier quoted context omitted.

IRIX [1] was the version of SVR4 UNIX which ran on SGI [2] computers. QEMU [3] is an emulator used to run programs for one machine on another. N64 [4] is the Nintendo 64 games console. SGI Indy [5] was a desktop SGI workstation from 1993. [1] https://en.wikipedia.org/wiki/IRIX [2] https://en.wikipedia.org/wiki/Silicon_Graphics [3] https://www.qemu.org/ [4] https://en.wikipedia.org/wiki/Nintendo_64 [5] https://en.wiki…

I love how you use 3 acronyms to describe the first acronym. It's acronyms all the way down!

SVR4: UNIX System V Release 4 https://en.m.wikipedia.org/wiki/UNIX_System_V

UNIX: Actually Unix. Not an acronym. https://en.m.wikipedia.org/wiki/Unix

Re: Super Mario 64 has been decompiled

#125

Earlier quoted context omitted.

I was just dealing with this today. QEMU was too slow on my MacBook Air though. Do you have a link to a comprehensive guide on doing this by chance? I was thinking tomorrow I’d just launch an arm instance in AWS and figure it out but I have a dual Xeon workstation at work (windows) that I might try as well.

I don't have a guide that documents everything I did, but the process is described in pretty good detail here: https://wiki.debian.org/RaspberryPi/qemu-user-static You can skip the first part about creating the image, since presumably you already have one. So the process for me is something like: apt-get install qemu qemu-user-static binfmt-support cp /usr/bin/qemu-arm-static ~/rpi_mnt/usr/bin systemd-nspawn -D ~/rpi…

BTW, with Debian buster and later, you won't have to copy the qemu-arm-static binary around, since the Linux kernel will now use the file from outside the chroot/container.

Re: Super Mario 64 has been decompiled

#127
post #68

Earlier quoted context omitted.

I honestly love coming to HN to see posts like this and comments like yours. It is always so neat to see the other sides of software engineering. You listed 4 acronyms and I have no idea what any of them are or how they fit into this story but all I want to do is deep dive into each one. It is also awesome to see people so interested in things that I've never even encountered before.

IRIX [1] was the version of SVR4 UNIX which ran on SGI [2] computers. QEMU [3] is an emulator used to run programs for one machine on another. N64 [4] is the Nintendo 64 games console. SGI Indy [5] was a desktop SGI workstation from 1993. [1] https://en.wikipedia.org/wiki/IRIX [2] https://en.wikipedia.org/wiki/Silicon_Graphics [3] https://www.qemu.org/ [4] https://en.wikipedia.org/wiki/Nintendo_64 [5] https://en.wiki…

> QEMU [3] is an emulator used to run programs for one machine on another.

More specifically one processor architecture to another. E.g. running on your desktop (usually an x86 based architecture) a Linux Operating System designed and compiled for a Raspberry Pi (ARM based architecture) and it's incompatible architecture. In this case they're running software designed for the same processor that the Nintendo 64 was targeting which so happens to also have ran a Unix OS known as IRIX.

Re: Super Mario 64 has been decompiled

#128
post #4

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

I wonder if it'll ever be upstreamed.

Re: Super Mario 64 has been decompiled

#129
post #35

Earlier quoted context omitted.

the 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?

QEMU is thought of as a hardware emulator, but supports "userland" emulation where the processor ISA is emulated but syscalls and memory are translated to the host OS.

The ISA is virtualized (and much faster) if you have KVM installed and your processor supports VTx extensions.

Re: Super Mario 64 has been decompiled

#130
post #118
post #4

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

I wrote to SGI in high school asking for some info on their computers and they sent back a stack of beautifully printed, full-color brochures. The Indy had a webcam, which was very rare in those days. Also included was a brochure on the Indigo workstation, which Industrial Light and Magic used for Jurassic Park, etc. Nintendo is a little mysterious when it comes to what their actual tooling was, but I remember Donkey…

Those brochures are probably worth real money on eBay if you still have them, a PowerSeries brochure just sold for $200!

By the time the Indy came out, the Indigo2 had replaced the Indigo, and I suspect a midrange Indy was a good match for a midrange Indigo1 (at much lower cost). Nintendo made an N64 dev board for the Indy, essentially an N64 on a GIO board, complete with an adapter card to connect controllers.

Post reply on HN