Frequently Asked Questions
What is decomp.me?
decomp.me is an interactive web-based platform where users can collaboratively decompile assembly code snippets by writing matching code.
It is an open-source project run by volunteers in their free time.
What do you mean by "matching"?
decomp.me is designed for users who are working on matching decompilation projects, where the goal is to produce high-level code like C or C++ that perfectly replicates the original assembly upon compilation.
This is a time- and labor-intensive process. To produce matching assembly, one usually needs the original compiler, assembler, and flags that were used to produce the original binary. Most importantly, the code has to be written in such a way that the compiler will generate assembly that is identical to what is being compared against. Writing matching code is a skill that takes time to learn, but it can be very rewarding and addictive.
What's a scratch?
A scratch is a workspace for exploring a compiler's codegen, similar to Compiler Explorer. A scratch consists of the target assembly, input source code, and input context code, as well as additional settings and metadata. Most scratches contain a single function - i.e. the function that you are trying to match. Each scratch has a unique link that can be shared with others. Scratches have a "family" of forks, which are copies of the original scratch.
What's the context for?
The context is a separate section of code that usually contains definitions and declarations, such as structs, externs, function declarations, and things of that nature. The context is passed to the compiler along with the code, so it's a good way to organize a scratch's functional code from its definitions and macros.
Context is also given to the decompiler to assist with typing information and more accurate decompilation.
How does decomp.me work?
The code from your scratch is submitted to the decomp.me server where it is compiled, run through objdump, and then compared against the target assembly. As you modify your code in the editor, the changes will be sent to the backend and compiled, so you'll see the results of your change in near real-time. The similarity between the compiled code's assembly and the target assembly is represented by a score, which is displayed in the editor.
The score is calculated by comparing the assembly instructions in the compiled code to the target assembly, and a penalty of different size is applied based on the kind of difference present among assembly instructions. The lower the score, the better!
Where do I start?
Currently, this website is meant to be used as a supplementary tool along with an existing decompilation project. Eventually, we hope to make the website a little more friendly to complete newcomers who aren't involved with any specific project. In the meantime, feel free to explore recent scratches and get a feel for how matching decomp works!
Someone sent me a scratch. What do I do?
Any scratch on the site can be played with. If you save a scratch that you don't own, your scratch will become a "fork" of the original. If you match the scratch, the original scratch will display a banner to notify visitors that the code is matched.
If you want to start your own scratch, you will need the assembly code for the function you are targeting in GNU assembly format.
Can you help me match a scratch?
You are welcome to ask for help in the #general-decompilation channel of our Discord Server.
Can you add a preset for a game I'm working on?
Absolutely we can, either raise a GitHub Issue or drop us a message in our Discord Server.
Can you add a compiler for a game I'm working on?
This is something that you are able to do yourself. The compilers used by decomp.me can be found in our compilers repository. Once the compiler has been added to that repo, it is very simple to add it to decomp.me, see this PR for an example.
Can you add "X" platform, e.g. PlayStation 3?
The platforms that decomp.me supports are driven by the support for those platforms in the underlying tools that make up decomp.me. If these tools support the architecture for the new platform, and you have the compiler available, it is a straightforward process to add it to decomp.me.
How do I report a bug?
If you come across a bug, please reach out to us on our Discord Server and/or raise a GitHub Issue containing the steps necessary to replicate the bug. We will gladly accept bug-squashing PRs if you are able to fix the issue yourself!