Resident Evil 4 (GameCube) – complete byte-identical decompilation to C/C++
Thread
Unofficial Hacker News client; not affiliated with Y Combinator.
Resident Evil 4 (GameCube) – complete byte-identical decompilation to C/C++
Unofficial Hacker News client; not affiliated with Y Combinator.
wk_end · · focus · HN ↗
Made using the leaked debug build and its symbols, which shows how meaningful the work the game preservation community that acquires and distributes these things is.
OTOH this is pretty off-putting:
> Where the compiler needed a particular source shape to reproduce a register choice or a schedule and no natural spelling was found, the construct is marked with a // COMPILER-DIFF: comment (644 of them: dead tests, empty asm("") launders and anchors, register T x asm("rN") pins, padding statements).
To me the value of a decomp isn't reproducing the original bytes per se (we already have the original bytes after all) - it's about reconstructing the understanding of the original game as represented by human-readable source code; getting byte-for-byte is just an indication that you've gotten it right. Needing to add a bunch of slop to force the compiler to match the original output is actually just an indication that you've gotten it wrong - and it's a demonstration of the danger of Goodhart's law, especially as it applies to AI.
Pannoniae · · focus · HN ↗
mitxela · · focus · HN ↗
Pannoniae · · focus · HN ↗
"get the order of local variables in this function right, otherwise the register allocation doesn't match. Oh and there's 150 local variables just in this function, good luck trying them all"
"Find out the translation unit boundaries exactly (assume there's no pdb otherwise this is trivial) and after doing so, figure out the order they were compiled in, otherwise it won't match"
"brute force the compilation flags for the project and if you're done, also bruteforce it for the CRT or any other middleware which usually came prebuilt so it doesn't match the main game"
Should I continue;)
mitxela · · focus · HN ↗
Pannoniae · · focus · HN ↗
So these are mostly problems with more advanced compilers yk
dezgeg · · focus · HN ↗
On the other hand, I have heard even old MSVC is a nightmare. Various things are affected by hash table ordering (so the names of variables matter in some situations), stuff like order of #includes mattering, etc.
Pannoniae · · focus · HN ↗