I’m not a huge N64 person but this seems really cool. I hope this approach starts to get explored with other tricky-to-emulate systems in the future.

I imagine just feeding an Xbox 360 game dump to a program and it spitting out a PC port

  • henfredemars
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    7 months ago

    I could write a single program that contains both the ROM and an emulator. It would not be any more difficult than writing an emulator.

    If you actually want to recompile a game for PC, this is a stretch goal and not the correct way to approach making games work on modern hardware. It’s an unnecessarily difficult approach for the same reason that transpiled code from arm to X86 or back again is not done completely in advance. There’s an important reason that we do it at runtime. You do it at runtime because you have more information available.

    For an academic example, imagine you have a game that has self-modifying code. You have to actually execute the code to get the code that it generates and then runs. Doing this in advance is at least as difficult as running the game and practically speaking more difficult. See: halting problem, partial evaluation.

    Imagine the game is a fighter. Every time the game throws a fist, the emulator has to catch that fist and make sure the game feels and experiences what it expected from the original hardware. If you want to completely recompile, you have to not only catch every fist, but you have to predict every fist that could be thrown in advance and have completely correct accuracy in detecting each possible throw.

    I can see this happening for hardware that we understand super well such as the N64, but it would be trivially easy to create a valid ROM that would work on the real hardware that will break this approach through self modification or explicitly trying to hide your behavior until run Step-by-step. The only way to be faithful broadly is to include the capability to emulate inside your recompiled binary.

    TLDR: Very cool but don’t do this until you’ve written enough emulators to understand the hardware and excruciating detail. It just makes the problem harder. Write a regular emulator first, and then you can consider more aggressive approaches to recompile bringing parts of your emulator with you to maintain correctness. Strictly speaking this is a harder problem that’s not going to help you with tricky platforms.

    EDIT: I took a dive into the code and I can see that they are pulling from projects that do emulate for example the graphics pipeline. Many optimizations have been made because we understand it very well, but you can’t practically and they are not attempting to simply translate the game into a PC compatible version. You still need the logic to handle what the game tries to do. For example, when you’re trying to access graphics hardware that doesn’t exist, you still need software that behaves like the graphics hardware it expects.

    It’s not magic. It’s really cool, and it’s OK to do this with a platform we understand very well, but make no mistake this is no replacement for regular emulation. You still need to write the emulator first.