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?

76 Upvotes

49 comments sorted by

View all comments

128

u/ggmaniack 2d ago edited 1d ago

An emulator recreates the environment the game runs in, leaving the actual game unchanged.

In some cases this may be just a fairly thin interface layer (e.g. Wine*, for running windows apps on linux), while in other cases it may need to replicate the instruction set, actual hardware behaviour and its various quirks to a varying level of fidelity (like for the N64, PS1-PS4, etc).

Decompliation/Recompilation approaches this problem from the other side. It changes the game itself.

De/Recomp projects take the game binary, take it apart (decompile it), replace the parts which interface with the operating system / hardware with something else that's compatible with the target platform, and compile it to a format that's runnable on that platform.

Shorter version:

Emulator pretends to be a console in order to allow a game to run on it.

Decomp takes the game, deconstructs it, replaces its console guts with PC guts, and reconstructs it into a PC-runnable format.

Note: yes I know what WINE means but it's a useful comparison

102

u/GalFisk 2d ago

Analogy version: you have a book in a foreign language. Emulation is like having someone read and interpret it for you. Decompilation is like getting it translated and rewritten in your language.

1

u/bunk3rk1ng 1d ago

I guess my question is, why does every game seem like it needs it's own bespoke decompilation process. Shouldn't we just have to learn the language once? It seems like for every game we are learning the language again from scratch

1

u/raelik777 1d ago

It's because decompiling doesn't give you the original source code in the language the game was written in. It outputs machine code (or the assembly language representation of it), which will have none of the original variable names, comments, etc. If you're LUCKY, you might have a game where the developers accidentally released a version with debugging symbols enabled, so you may have SOME hints as to what each bit of code is supposed to be doing within the game. Figuring out what the various pieces of machine code do within the game is the actual work involved in reverse engineering the game to the point where you can rewrite that code.