Unlike computer games, which smoothly and continuously evolved along with the hardware that powered them, console games have up until very recently been constrained by a generational style of development. Sure there were games that appeared on multiple platforms, and eventually newer consoles would feature backwards compatibility that allowed them to play select titles from previous generations of hardware. But in many cases, some of the best games ever made were stuck on the console they were designed for.

Now, for those following along as this happened, it wasn’t such a big deal. For gamers, it was simply a given that their favorite games from the Super Nintendo Entertainment System (SNES) wouldn’t play on the Nintendo 64, any more than their Genesis games could run on their Sony PlayStation. As such, it wasn’t uncommon to see several game consoles clustered under the family TV. If you wanted to go back and play those older titles, all you had to do was switch video inputs.

But gaming, and indeed the entertainment world in general, has changed vastly over the last couple of decades. Telling somebody today that the only way they can experience The Legend of Zelda: A Link to the Past is by dragging out some yellowed thirty-odd year old console from the attic is like telling them the only way they can see a movie is by going to the theater.

These days, the expectation is that entertainment comes to you, not the other way around — and it’s an assumption that’s unlikely to change as technology marches on. Just like our TV shows and movies now appear on whatever device is convenient to us at the time, modern gamers don’t want to be limited to their consoles, they also want to play games on their phones and VR headsets.

But that leaves us with a bit of a problem. There are some games which are too significant, either technically or culturally, to just leave in the digital dust. Like any other form of art, there are pieces that deserve to be preserved for future generations to see and experience.

For the select few games that are deemed worth the effort, decompilation promises to offer a sort of digital immortality. As several recent projects have shown, breaking a game down to its original source code can allow it to adapt to new systems and technologies for as long as the community wishes to keep them updated.

Emulation For Most, But Not All

Before we get into the subject of decompilation, we must first address a concept that many readers are likely familiar with already: emulation.

Using a console emulator to play an old game is not entirely unlike running an operating system through a virtual machine, except in the case of the console emulator, there’s the added complication of having to replicate the unique hardware environment that a given game was designed to run on. Given a modern computer, this usually isn’t a problem when it comes to the early consoles. But as you work your way through the console generations, the computational power required to emulate their unique hardware architectures rapidly increases.

Nintendo put emulation to work with their “Mini” consoles.

The situation is often complicated by the fact that some games were painstakingly optimized for their respective console, often making use of little-documented quirks of the hardware. Emulators often employ title-specific routines to try and make these games playable, but they aren’t always 100% successful. Even on games that aren’t particularly taxing, the general rule of emulation is to put performance ahead of accuracy.

Therein lies the key problem with emulation when it comes to preserving games as an artistic medium. While the need for ever-more powerful hardware is a concern, Moore’s Law will keep that largely in check. The bigger issue is accuracy. Simply running a game is one thing, but to run it exactly how it was meant to run when the developers released it is another story entirely.

It’s fairly common for games to look, sound, and even play slightly differently when under emulation than they did when running on real hardware. In many cases, these issues are barely noticeable for the average player. The occasional sound effect playing out of sync, or a slightly shifted color palette isn’t enough to ruin the experience. Other issues, like missing textures or malfunctioning game logic can be bad enough that the game can’t be completed. There are even games, few as they may be, that simply don’t run at all under emulation.

Make no mistake, emulation is usually good enough for most games. Indeed, both Nintendo and Sony have used emulation in various capacities to help bring their extensive back catalog of games to newer generations. But the fact remains that there are some games which deserve, and sometimes even require, a more nuanced approach.

Chasing Perfection

In comparison, when a game is decompiled to the point that the community has the original C code that it was built from, it’s possible to avoid many of the issues that come with emulation. The game can be compiled as a native executable for modern platforms, and it can take advantage of all the hardware and software improvements that come with it. It’s even possible to fix long-standing bugs, and generally present the game in its best form.

For those who’ve dabbled in reverse engineering, you’ll know that decompiling a program back into usable C code isn’t exactly a walk in the park. While there are automated tools that can help get through a lot of the work, there’s still plenty of human intervention required. Even then, the original code for the game would have been written to take advantage of the original console’s unique hardware, so you’ll need to either patch your way around that or develop some kind of compatibility layer to map various calls over to something more modern and platform-agnostic. It’s a process that can easily take years to complete.

Because of this, decompilation efforts tend to be limited to the most critically acclaimed titles. For example, in 2021 we saw the first efforts to fully reverse The Legend of Zelda: Ocarina of Time. Released in 1998 on the N64, it’s often hailed as one of the greatest video games ever made. Although the effort started with Ocarina, by 2024, the lessons learned during that project led to the development of tools which can help decompile and reconstruct other N64 games.

Games as Living Documents

For the most part, an emulated game works the same way it did when it was first released. Of course, the emulator has full control over the virtual environment that the game is running in, so there are a few tricks it can pull. As such, additional features such as cheats and save states are common in most emulators. It’s even possible to swap out the original graphical assets for higher resolution versions, which can greatly improve the look of some early 3D games.

But what if you wanted to take things further? That’s where having the source code makes all the difference. Once you’ve gotten the game running perfectly, you can create a fork that starts adding in new features and quality of life improvements. As an example, the decompilation for Animal Crossing on the GameCube will allow developers to expand the in-game calendar beyond the year 2030 — but it’s a change that will be implemented in a “deluxe” fork of the code so as to preserve how the original game functioned.

At this point you’re beyond preservation, and you’ve turned the game into something that doesn’t just live on, but can actually grow with new generations of players.


From Blog – Hackaday via this RSS feed

all 2 comments

sorted by: hot top controversial new old
[–] 4 points 1 year ago (1 child)

This is great, but many many computer games simply do not grow with changes in hardware over time. That's not a console exclusive problem.

Outdated libraries, relying on features no longer supported by the OS, coding game elements reliant on the lack of speed of old hardware, automatic engine updates breaking old functionality.

The list goes on and on.

  • source
  • hideshow 1 child comment
  • 10 comments in c/games@lemmy.world view that post
    [–] 22 points 1 year ago (7 children)

    Decompilation is definitely the path forward. Not only does it preserve games and allow you to play enhanced native versions, they're totally legal and won't get you into hot water. I played Mario 64 and Ocarina of Time at 60fps and it was glorious.

  • source
  • hideshow 7 child comments
  • [–] 7 points 1 year ago (6 children)

    Wait, what? Distributing decompiled code from a proprietary source is completely legal? Is that actually correct?

    I was under the impression that the source code is copyrighted, as is the compiled build of the game, and that decompiling the game is a violation of the Terms of Service, which would make distributing it still illegal. I'd love to be wrong about this though.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 21 points 1 year ago (2 children)

    The ORIGINAL source code is copyrighted, but decompiling does not give you the original source code. Decomp tools give you generic variable names like unsigned_int_4 and then it’s up to you to decipher what the purpose of the variable even is and give it a relevant name. So it’s virtually impossible you’ll get a character-for-character match to the original.

    Also, decomps have different levels of accuracy. You may get something that is a perfect behavioral match, even though there’s differences in the instructions being run. You may get an instruction-perfect match but not a byte-perfect match between the binaries.

    IANAL but this is what I’ve learned from following decomp projects on YouTube

  • source
  • parent
  • hideshow 2 child comments
  • [–] 12 points 1 year ago (1 child)

    Yes, reverse engineering is totally legal. The big asterisk here is that you can't distribute any assets the company owns, so you need the original game files regardless to play the decompiled version.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 year ago

    This cleared up my confusion, thanks!

    I’m familiar with reveng from a malware and security testing point of view, using tools like IDA, Binja, Ghidra, etc., so I was aware that decompilers are taking the compiled assembly instructions, then recreating Intermediate Language and pseudo-C stuff without debugging info or original function names and stuff, but I was missing the key point of game assets not being distributable.

  • source
  • parent
  • [–] 6 points 1 year ago* (last edited 1 year ago)

    "Legal" is a very strong word here.

    A better statement would be that there hasn't really been a major court case regarding decompiling source for hobby use and most cases where it is used for profit or piracy are no nos for existing reasons. But for education purposes or to develop and interface, it is a grey area. In large part because said education makes you toxic as hell in industry and said interfaces are usually for things that violate the license agreement and TOS because the software didn't provide an interface for a reason.

    And then you run into cases where the act of bypassing protections to get the binaries in the first place put you in further hot water. Sort of like how the (way over simplified) argument that you are legally allowed to have a backup of your video games but the act of making said backup gets REALLY sketchy in a lot of cases.

    I would probably phrase it more as "decompiling source code is not illegal. How you use it might be"


    Its also always worth remembering that law comes from precedent. And it is rarely in anyone's interest for stuff like this to go to trial. So there will be a few landmark cases that cover VERY specific use cases and a LOT of cases of big lawyers saying "Do you really wanna fuck with us?" and getting a C&D and a settlement.

  • source
  • parent
  • [–] 32 points 1 year ago (1 child)

    It would be cool if there was a law mandating that companies release the source code of a product after they stop distributing it, or maybe something like 15 years after its initial release.

    Or just make all software open source ¯\_(ツ)_/¯

  • source
  • hideshow 1 child comment
  • 1 comment in c/reverseengineering@infosec.pub view that post
    [–] 1 point 1 year ago

    I've tried ship of harkinian and 2ship2harkinian for zelda oot and mm and the quality of life options are nice to have, and not having to fight with the janky controls not matching my nostalgia filter is also excellent. If I wanted all the jank though I'm pretty sure it all toggles off.

  • source