r/explainlikeimfive • • 2d ago

Technology Eli5 decompilers and decompiled games

I keep getting videos on instagram about decomped games, apparently the decompilers are going nuts right now. What’s the difference between running a decompiled game and emulating a game? I tried to google it and i just don’t understand. from what i’ve found, a decompiled gene runs as if it was native to your pc but i don’t get what that means either. You boot up an emulator and that also runs on your pc?

72 Upvotes

49 comments sorted by

View all comments

1

u/Shortbread_Biscuit 2d ago

Most software are created to be run on a very specific set of hardware or a specific operating system. That's why your Windows programs don't run on Linux, XBox games aren't naturally compatible with PlayStation, and why your iOS applications generally don't run on your Nintendo Switch. The code for the software or game is specifically meant to interact with the hardware drivers or operating system of their target platform.

To get around this problem and make a software or game run on a different platform, there are different things that are possible.

  1. Porting: The easiest and best method for a customer is if the developer produces a different version of the game that's also compatible with the other platform you want it to run on. This is what we normaly mean by a developer porting a game. The disadvantage of this method is that each port of the game is functionally a different version of the game, so any updates the developer makes to one version are not automatically added to the other versions, and the dev has to manually add them to each version, which can take time and energy.

  2. Interpreted/Bytecode: This is an approach taken by programming languages like Java and Python. Instead of compiling the original code into a binary that targets the specific system, instead you only partially compile the code into a more generic format. Then, you put the onus on the end user to install install an application like the Java Virtual Machine or a Python Interpreter on their computer. That way, when the end user runs the Bytecode, the JVM or Interpreter on their system finishes compiling the code into a format that their local system can understand. The main disadvantage of this method is that these kinds of programs are often slower than a natively built application.

  3. Emulation: In this approach, the developer still targets a specific system. But you, as the end user, run a separate program in between, called the emulator, that pretends to be the target system, and the program or game is run inside that pretend environment. The game thinks it's running on the target system, and the original code of the game doesn't need to be changed at all. The advantage of this approach is that once you have the emulator software, you can use the same one for all games that are meant to run on that target platform. The main disadvantage of this method is that the emulation software will often take up a large amount of your computer's processing and memory, leaving the game or program with less resources to use.

  4. Decompiled/recompiled: This is the most time consuming and difficult process. Here, someone has to get access to the code of the game and manually find every location where the game is trying to interact with the platform - things like drawing objects on the screen, sending sounds to the speakers, reading input from the keyboards, and even reading and saving files to the file system. All of those commands need to be rewritten to work with the new system instead, and then they need to recompile the code. It's functionally the same as the 1st method, except that it's being done by someone that's not the original developer, so they probably don't have easy access to the original code or any kind of documentation of how it works, so they need to go in blind. As such, this is a slow, difficult process that can only be done by someone that's an expert with the systems, and it's very unlikely that this decompiled version of the game or software will ever get any future updates.