118 pointsby garrettjoecox8 days ago11 comments
  • OuterValea day ago
    This is one of the most impressive things I've seen in a while. It isn't traditional emulation, and it isn't a decompilation.

    It is a static recompilation of the Xbox 360 version. It required a ton of low-level re-handling of things from the 360's Xenon CPU and Xenos GPU.

    Not only is it the game running natively on PC, it has also been modded to support all manner of tweaks and enhancements that are manageable in-game, and mod support.

    Really impressive stuff.

    Release trailer: https://www.youtube.com/watch?v=TJreGbVPDx0

    • perching_aixa day ago
      > It isn't traditional emulation, and it isn't a decompilation. It is a static recompilation of the Xbox 360 version.

      And all its real benefits come from the countless manual changes made to it, such as rewriting the rendering code. This is because at its core, especially for now, there's no meaningful technological difference between what the tool they used does vs what an emulator does.

      Applications on the X360 were barred from self-modifying, so an emulator can/will statically (ahead-of-time) recompile the executable before jumping to it. Whether this is actually what Xenia (the x360 emu) does or if they JIT / hybrid it to get rid of the lengthy precomp, idk, but RPCS3 (the ps3 emu) where this exact same situation also applies does do this, even via LLVM, so there really is 0 difference. (On the PS3 though, there's also SPU code, which can and does self modify, so that needs JITing).

  • Borealida day ago
    This is conceptually similar to Ship of Harkinian ( https://www.shipofharkinian.com/ ). If someone cares enough about a particular game to put this level of tailored work into it, wonderful.

    There is a down side, though: because emulators handle a much wider variety of games, they get better feature sharing for things like save states, shaders, controller bindings, etc. With libretro things even go a step beyond that and different systems' games can all share the same launcher UI and the same support for things like RetroAchievements!

    So a recompiled version is better from a performance standpoint, and might have more game-specific quality of life features, but it also means more development time is devoted to that particular game.

  • aquova8 days ago
    As a fan of the game, I just built it and got it working for myself. It's really impressive and is running great on my machine. I realize (with dread) that the game is about 17 years old now, but I eagerly awaited it release back in the day, and it was one of first games that I still think of as "modern". Rewatching the opening movie, I'm not sure you could easily distinguish it from a modern CGI cutscene.
  • LorenDB8 days ago
    Similar Sonic projects include SA2 Redux[0] and Project 06[1].

    [0]: https://gamejolt.com/games/SA2R/939490

    [1]: https://youtube.com/c/ChaosX (best link as there is no official website)

  • robbiet480a day ago
    It's already available on macOS too, runs pretty well https://github.com/squidbus/UnleashedRecomp/actions/runs/136...
  • heavensteetha day ago
    Every time MattKC uploads[0], his video's subject matter appears on HN a few hours later. I'm beginning to think it's not a coincidence :)

    [0]: https://www.youtube.com/watch?v=lMGu6Ng_3yA

    • OuterValea day ago
      In this case the post was made a few days ago, but didn't get the traction it arguably deserved so was given a second chance.
      • LorenDBa day ago
        I'm not sure why this post was bumped. It was on the front page for quite a while on the day of posting.
  • remix2000a day ago
    Compared to the og recompiler <https://github.com/rexdex/recompiler>, this is super basic and only matches patterns specific to a single compiler rather than devising a CFG as one would expect with such a tool. I wasn't able to analyze, let alone "recompile" even the basic "dolphin" demo.
  • no_time7 days ago
    Am I understanding right that this is basically an ahead of time xbox360 emulator?

    Absolutely fascinating.

    • dharmab2 days ago
      It's not emulation. It's recompiled to the target device's native machine code. It also required a lot of additional low-level, per game programming to make stuff like graphics and sound work correctly.
      • phire2 days ago
        Traditional emulators also recompile games to the target device's native machine code. It just happens dynamically at runtime, hence the name "dynamic recompiler" or "Just In Time recompiler".

        This is just a static recompiler or ahead of time recompiler, except instead of directly targeting machine code, it's targeting C/C++ as a type of portable assembly. It basically just looks like a bunch of macros implementing the behaviour of powerpc instructions.

        The recompiled result will preform nowhere near as good as a proper manual decompilation project, it's still baking in a huge number of quirks from PowerPC and the compiler they originally used, and will have noticeably worse performance. But, performance will usually be good enough, and it's easy to manually replace any bad code-gen that shows up as a bottleneck in profiles.

        And while they did replace a bunch of graphics/audio code, they are still directly emulating a bunch of the original Xbox 360 Kernel and hardware.

        • alt227a day ago
          As I understand it, standard emulation is not dynamic recompiling or jit, it is emulating and converting system calls in realtime. So the game calls a system function unique to the original platform, the emulator sees that call and makes a similar one (or multiple) in the language of the emulating system, and then returns the correct response back to the original call from the game.

          I dont think it is compiling anything here.

          • perching_aixa day ago
            Your understanding is incorrect. Applications (games) written for older gaming consoles all had to ship some native code, and were even typically entirely native code. These consoles were also typically not x86 or x86-64 based, so for a PC-targeting emulator to run applications written for these platforms, they do need to have recompiler or interpreter facilities.

            They also do not necessarily need to hook and replicate syscalls, provided the user provides a dump of the system software (they just run the system software and make it load the game - the original syscall codes are then ran).

            This extends even to the graphics hardware side once programmable shaders became a thing.

            • alt227a day ago
              Thanks for the explanation
      • bri3d2 days ago
        It’s a weird in between, IMO. I don’t think it’s fair to say it’s not emulation, because in most places the original architecture’s state is maintained and functions are hooked through macros like PPC_FUNC - the original source code is not fully ported to the host platform, but relies on a set of compile and runtime tricks which, well, emulate the properties of the guest. But yes, it’s not traditional emulation and things are gradually ported to be more “native” over time.
        • zapzupnz2 days ago
          Sounds a bit like WINE
          • bri3d2 days ago
            No. Way lower level. WINE runs native code and replaces library and system calls. This turns native code into C++ macros and then recompiles those into code. This is like a JIT with C++ as the IR. On the other hand WINE is not an emulator ;)
  • a day ago
    undefined
  • DeathArrowa day ago
    It's the first time I hear about static recompilation. I didn't know you can recompile something to run on a different architecture and OS.
    • a day ago
      undefined
  • a day ago
    undefined