Remix.run Logo
▲ FLeXMurphy an hour ago

You can think of these as a kind of a "static emulator" that is executed once. The opcodes are dumped from Platform A into a mixture of C and Assembly (whatever assembly that platform is using) to prepare for Platform B. It is absolute spaghetti with no real meaning to any particular block of code.

The objective of decomp is really "re-targeting". You go ahead and try to bootstrap the game code so that it will open up on another platform (like say, a Win32 Portable Executable file, your standard .exe file). You may have to substitute opcodes that the original processor had that your new processor might not have. Not as common now as it was, more platforms just use x86-64.

There is more to it than this of course, esp. if the compiler on Platform A emitted library code intended for specific peripherals and whatnot, but this is a "quick and dirty" way of getting a game to run. If you think about it, you first have to remove all the code specific to Platform A but find the logical or functional equivalent code for Platform B, and insert it into the correct places.

▲darksim905 an hour ago | parent | next [-]

A nuance that hasn't really made sense to me with these projects, If I recall in some cases when you're creating logical/functional equivalents that have the same compiled results, does that actually equate to the same functionality?

And, I've seen this most done with as you said, targeting since you don't have the source code to actually choose a different target architecture compilation. But is the same process done for automated clean room reverse engineering?

▲FLeXMurphy 43 minutes ago | parent [-]

> A nuance that hasn't really made sense to me with these projects, If I recall in some cases when you're creating logical/functional equivalents that have the same compiled results, does that actually equate to the same functionality?

You're right to be skeptical. What you're talking about is something that every emulation and decompilation project runs into. You have no real "guarantee" if the hardware is different that your code will run flawlessly 1:1. That's when all sorts of glitches or quirks come into play. It will likely be a bit of a slog to get this game to play nicely across PS5<->Xbox<->PC unless they've already done this and know where the skeletons are.

In general, the processor instructions will behave fine. But your library calls and other hardcoded addresses that depend on the OS/kernel fail immediately and those need to be fixed up to make any progress. Getting past a black screen is therefore a real hurdle.

Not sure about clean room reverse engineering. My understanding of "clean room" is that someone hands you a black box of input->output and then you implement it as best as you can. Meaning you never see any of the original code, implementation, or anything like that. In theory you can clean room on same or different platform.

▲derac an hour ago | parent | prev [-]

yeah the code in question is x86_64