Super Mario Bros Wonder Is Playing on Windows as Rebuilt Native Code

A laptop with an RTX 3050 is running Super Mario Bros. Wonder as a Windows program, and a clip from a developer called Belmante is the clearest look yet at how far that work has come. World 1-1 plays at close to 60 frames a second. Menus, character select, the opening cutscene, and the world map all line up with an earlier Mac build of the same project. Sound comes through the game’s own audio path, routed on Windows through XAudio2.
The 2023 Flower Kingdom game port to native PC software is already well along, even before the game has begun. ARM64 instructions from the console version are meticulously recompiled ahead of time to function as ordinary machine code. The equation has no intermediate emulators, translators, or interpreters. The identical C++ code that ran on a Mac is now being rebuilt on Windows using clang-cl.
Graphically, things are a little more tricky. The game talks with the Switch using Nintendo’s NVN graphics interface, which is also being updated to be compatible. Instead of NVN providing the graphics, a custom layer intercepts the requests and retargets them to the Windows PC as Vulkan draws; on the Windows laptop, this layer only communicates with the NVIDIA driver. There’s no fancy MoltenVK in the chain here, unlike on the Mac.

As it turned out, switching the game to a non-Apple machine revealed a few bugs that had been lurking on the Mac. Wonder, the game, stores key art and model textures in ASTC format, which is not supported by most desktop NVIDIA GPUs. And this resulted in a serious problem: the driver simply crashed when asked to make those images. So, a special decoder has been implemented that takes the ASTC and decodes it on the CPU during upload time, which was written out of the Khronos specification and double-checked against a second independent decoder for good measure.

Plus, Metal had been adding barriers between render runs on its own, but NVIDIA overlapped those passes, resulting in enormous holes in the heads-up display until he placed barriers as well, which worked at no obvious cost. Another big issue that needed to be solved was upload ring overflows, which resulted in characters being painted black and green. To fix the stutter that happens when new objects appear on the screen, he implemented an on-disk pipeline cache and multithreaded ASTC decoding.

The next item on the to-do list is to get the game to operate on the Intel UHD 770, an integrated chip comparable to the Switch’s Tegra X1, and that’s basically just a sanity check for how light the port can be. For the time being, the repository remains secret, but there are plans to make the recompiler code, the NVN-to-Vulkan layer, and NVN notes available to the general public at some point. Keeping track of notes and processes is part of the build process, which includes employing an AI tool called FlowForge. Each bug receives a write-up that summarizes what was wrong, why it was wrong, what we did to solve it, and how we discovered the problem.
[Source]
Super Mario Bros Wonder Is Playing on Windows as Rebuilt Native Code
#Super #Mario #Bros #Playing #Windows #Rebuilt #Native #Code