Hacker News new | ask | show | jobs
by groundzeros2015 74 days ago
I opened a file at random. This looks more like emulating the behavior in compilable C syntax rather than recovering the game's programming

void Em1eWeaponSet(cEm10* em) { Em10Work* w = EM10_WK(em);

    w->mot[41] = 0;
    w->mot[42] = 0;
    …
    w->mot[62] = 0;
    w->mot[63] = ARC(0x26C);
    w->mot[64] = ARC(0x26D);
    w->mot[65] = ARC(0x276);
    w->mot[66] = ARC(0x277);
    w->mot[67] = 0;
    w->mot[68] = 0;
    w->mot[69] = ARC(0x26A);
    w->mot[70] = ARC(0x26B);
    w->mot[71] = ARC(0x270);
    w->mot[72] = ARC(0x271);
    w->mot[73] = ARC(0x272);
    w->mot[74] = ARC(0x273);
    w->mot[75] = ARC(0x274);
    w->mot[76] = ARC(0x275);
    w->mot[77] = 0;
    w->mot[78] = 0;
}
4 comments

There is more normal looking code in other files. It sounds like the original game had animation data (or similar) embedded in the C code.
I just checked a few more. It looks it can sometimes tell the intent of a stack variable and give it a name. But anything working with data looks like above.
Yes, that is how decompilation projects work.

The puzzle is then trying to piece the context back together by probing the game to recover something that approximately resembles what the original code might have looked like.

Eventually you can do things like Dusklight for advanced modding and feature implementation.

Not a surprise. Now the fun works starts: Deriving semantics from psuedo-assembly.
How is this more readable to a human than the binary ?
It’s not.