• ramirezmike@programming.dev
    link
    fedilink
    English
    arrow-up
    41
    arrow-down
    1
    ·
    10 months ago

    a comment on that site really condescendingly claims this is how he would have handled it and that a script could be written in half a day to do the work.

    my understanding is that an emulator effectively recreates the hardware’s different components in software so that from the game’s “perspective” it’s running on a real machine more or less.

    This process instead decompiles the game code and recompiles for a new target machine.

    I suspect one can’t just pump out a script in an afternoon to do this, but I am curious what is the complexity here?

    • MajorasMaskForever@lemmy.world
      link
      fedilink
      English
      arrow-up
      36
      ·
      10 months ago

      For graphics, the problem to be solved is that the N64 compiled code is expecting that if it puts value X at memory address Y it will draw a particular pixel in a particular way.

      Emulators solve this problem by having a virtual CPU execute the game code (kinda difficult), and then emulator code reads the virtual memory space the game code is interacting with (easy), interprets those values (stupid crazy hard), and replicates the graphical effects using custom code/modern graphics API (kinda difficult).

      This program is decompiling the N64 code (easy), searches for known function calls that interact with the N64 GPU (easy), swaps them with known valid modern graphics API calls (easy), then compiles for local machine (easy). Knowing what function signatures to look for and what to replace them with in the general case is basically downright impossible, but because a lot of N64 games used common code, if you go through the laborious process for one game, you get a bunch extra for free or way less effort.

      As one of my favorite engineering phrases goes: the devil is in the details

    • Khanzarate@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      ·
      10 months ago

      So, you’re pretty much spot on with how emulators work. I also like using claymation to demonstrate it, like this. Your computer bends over backwards to give the game the exact environment it expects.

      What makes recompilation more than a simple script is the rebuilding aspect. I brought up claymation because it’s a great analogy for this, too. An n64 ROM is a complete set of characters, sets, and a script for a claymation movie. It’s I in one studio right now, and that studio is the N64, but you need this to be in your PC studio.

      First, you have to decompile your sets and characters. You take reference photos and rip out every tree in a forest set and roll each tree back into it’s own ball of clay, with its own reference photo each time. Every little clay cobble on a road, characters outfits, hair, limbs, you meticulously separate every piece of clay that Nintendo shaped, ball them up, and pack them. You now have a million little clay balls and reference photos for every one of them. You take these back to your PC studio. Thankfully, with these reference photos, your clay 3D printer (compiler) can return these balls into something very close to their original shapes, except there’s a bunch of little mistakes. One character’s leg is slightly thinner and longer than it should be, which messes up their gait when you re-film this, so you manually tweak the leg to be accurate. The cobbles don’t quite fit the same, they’re a bit smaller, but you have extra clay because of that so you just make more cobblestones. The road doesn’t look exactly like the original, but that’s fine. The trees, again, don’t quite fit right, but you’ve made similar trees in your studio before and you know those will work so you actually just use those as references instead of the originals. You get filming but this one scene just isn’t lit right, and you can’t figure out why, but you eventually figure out the N64 studio opened the blinds on their window to get natural sun in this shot, but your studio doesn’t have a good view of the sun at that angle, so you have to get a good lamp.

      You face a million little hurdles decompiling and recompiling. Its almost literally reinventing the wheel. Almost all the work goes into little details that almost seem unnecessary, but there’s so many that it’s absolutely necessary. I was watching a playthrough of a recompiled majoras mask earlier today, and the Dev of this project found his way there, too, and he said it took a few days to get majoras mask to decompile and recompile, and about a year to fix all those little details that in software become lag or new bugs. So the script guy isn’t really wrong when he said he could do it fast, but he definitely wouldn’t do it right.

    • PineRune@lemmy.world
      link
      fedilink
      English
      arrow-up
      18
      arrow-down
      1
      ·
      10 months ago

      IIRC, the original cartridge had an extra chip in it that emulation hasn’t been able to use. I’m not sure if any progress has been made on this and a few other games that used these.

      • Evilcoleslaw@lemmy.world
        link
        fedilink
        English
        arrow-up
        8
        ·
        edit-2
        10 months ago

        Nah it didn’t have an extra chip – but large portions of the game were written in microcode for the N64’s processor specifically. It’s part of what makes it and Rogue Squadron kind of a pain to emulate – along with using their own audio drivers (MoSYS/MusyX that were later used as the basis for the GameCube sound systems).

        IIRC there was an official Windows port at some point though. Not sure how well it worked or works on modern systems.

        • MightBeAlpharius@lemmy.world
          link
          fedilink
          English
          arrow-up
          5
          ·
          10 months ago

          Wait… Y’all are talking about X-Wing: Rogue Squadron and Star Wars Episode 1: Battle for Naboo, right?

          I owned those windows ports!

          They worked great back in the day - I had such a blast with them that I begged my parents to get me a shitty Logitech joystick! If you want to check them out, it looks like Rogue Squadron is only $10 on Steam; and Battle for Naboo seems to be abandonware, but it seems to be hosted on a lot of “better spread than dead” game sites.

        • PineRune@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          10 months ago

          I’m pretty sure that has been able to be emulated and run through most emulation software now. These Star Wars games had specific code and drivers that, when I looked up why it wouldn’t emulate years ago, had not been cracked open to get the source code to enable people to program it into emulation software.

    • VindictiveJudge@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      10 months ago

      Battle for Naboo actually had an official PC version all the way back in 2001. No idea if it works on modern PCs, though.

      • PineRune@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        10 months ago

        The keyboard controls are very janky. You’d have to do custom button mapping with a controller, and there’s no analog input. At least not without some mods that I’m not sure exist.

  • SeaJ@lemm.eeOP
    link
    fedilink
    English
    arrow-up
    29
    ·
    10 months ago

    I’m wondering how much this will help the handheld scene. N64 emulation is pretty notoriously shitty on many handhelds.

    • Sakychu@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      1
      ·
      10 months ago

      It won’t help emulation but on pc/steamdeck you can natively compile it so that there no need for it anymore. Not sure about smartphone but I’m sure that it should be possible!

      • SeaJ@lemm.eeOP
        link
        fedilink
        English
        arrow-up
        3
        ·
        10 months ago

        Yes, that was kind of my point. N64 emulation on handhelds often sucks. So being able to have games recompiled to be better optimized on something like the Miyoo Mini would be great. While it is cool for the PC because it can allow for enhancements much more easily, just getting games up and running at a minimum is not an issue for any PC made in the last decade or two.

  • yamanii@lemmy.world
    link
    fedilink
    English
    arrow-up
    26
    ·
    10 months ago

    Saw the twitter post yesterday, good thing they waited until it was basically ready to go before showing off, now even a C&D can’t stop it.

    • CallMeButtLove@lemmy.world
      link
      fedilink
      English
      arrow-up
      11
      ·
      10 months ago

      That would be awesome. My guess is yes but it would probably take a lot of work. Can you imagine N64 Smash online multiplayer that actually works?

    • DragonOracleIX@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      10 months ago

      I saw a Ocarina of Time one a while back. There is also some tool that can link randomizers of different games togther.

  • RegalPotoo@lemmy.world
    link
    fedilink
    English
    arrow-up
    19
    ·
    10 months ago

    Will be interesting to see if this is useful for non-PC platforms as well; I’ve got a Myioo Mini Plus (basically an ARM SBC in a GameBoy-esque case designed to run RetroArch) - it’s not really powerful enough to run a N64 emulator, but if I could recompile the games in my PC and run them natively then maybe that’ll work better?

    • Bartsbigbugbag@lemmy.ml
      link
      fedilink
      English
      arrow-up
      6
      ·
      10 months ago

      Idk about this, but the Mario 64 decompile was recompiled to run on my Anbernic 353 at 60fps, runs amazing. So I think it should be at least theoretically possible.

    • 4am@lemm.ee
      link
      fedilink
      English
      arrow-up
      6
      ·
      10 months ago

      Emulating N64 is particular can be a lot of overhead - it’s possible this could help!

      • RegalPotoo@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        10 months ago

        Yeah, I was a little surprised - the MMP can do PS1 emulation no issue, but apparently N64 is too much. I would have thought it would be the other way round

  • werefreeatlast@lemmy.world
    link
    fedilink
    English
    arrow-up
    16
    ·
    10 months ago

    Nintendo is preparing to sue the proper technologies out of existence. Anyway, what did you say the researchers last names were? First names too if you got them. Nintendo would love an address and possible information on their whereabouts around lunch time. It’s all for the benefit of all players out there!

  • I Cast Fist@programming.dev
    link
    fedilink
    English
    arrow-up
    12
    ·
    10 months ago

    Ok, any info on how that’s being done? It sure sounds like Wiseguy figured how to compile the code that was meant for the specific VR4300 (RISC) N64’s CPU for typical x86-64 architecture

    • bruhduh@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      10 months ago

      Apple Rosetta 2 technically recompiles code from x86 to arm too in jit and sometimes aot, also there’s box86/64 open source project, only difference between example I’ve said and OP is recompilation actually saves all results and not just cache, another difficulty is in OS difference, he needs not just binary translate but have something akin to WINE too while he recompiles code

      • I Cast Fist@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 months ago

        If he’s compiling from windows to windows, target OS shouldn’t be a problem. Also, I just had to go one extra click to read Mr-Wiseguy’s github 😅

        He could also, in theory, use Cosmopolitan to generate an APE (Actually Portable Executable) that will run on linux, bsd, windows and mac. I had to find a video where Justine talks about it to understand how and why it works: it’s basically a trick to rewrite the header of the executable, with the real magic being an “optional shebang” that lets both Windows and *Nix run the first bytes.

  • MisterFrog@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    1
    ·
    10 months ago

    Am I the only one who watched the video, and due to nostalgia upscaling my memory, could hardly tell any difference other than frame rate.

    I should go look at the normal game 😅

  • Mighty@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    10 months ago

    so. For dumb people like me (or just for me to be clear), how do I play those games? i watched the video and read the site. there’s a link to the MM gamefiles on GitHub, but the video said you still need the ROMs? or this RT64? I’m old and apparently at some point, you just lose tech savvyness… :( can I get a step-by-step?

    • Psythik@lemmy.world
      link
      fedilink
      English
      arrow-up
      11
      ·
      10 months ago

      Yes you still need the ROMs since these PC ports contain no copywritten code. Like the other person said, you will need to compile the game yourself, but there are tools that automate the process. It’s simply a matter of getting all the files you need in one place, and clicking a few buttons. The hard part is obtaining all the files (well, more tedious than hard, especially if you’re not a programmer or a Linux user).

  • Petter1@lemm.ee
    link
    fedilink
    English
    arrow-up
    6
    ·
    10 months ago

    I need 60fps upscaled Pokémon Stadion with raytracing now 😌where?