SuperMarioWonderRecomp README

The project's README from github.com/BelmanteGu/SuperMarioWonderRecomp. As one markdown file: README.md.

Super Mario Bros. Wonder Recomp

Projeto Belmante
A Projeto Belmante project · youtube.com/@belmante

Static recompilation of Super Mario Bros. Wonder (Nintendo Switch, 1.0.0, title ID 010015100B514000) to native code. No emulator runs: the game's AArch64 machine code becomes C++ compiled for the host, and its system and graphics calls (NVN, Nintendo's own API) are implemented natively on Vulkan (MoltenVK on the Mac).

Part of the SwitchGamesRecomp work (same runtime, see docs/FRAMEWORK.md); this repo follows Wonder alone. Living log: PROGRESS.md.

[!NOTE] No game files are included. This repository holds no game code, assets, keys or firmware, and no build made from them. Everything derived from the game stays in private/ (gitignored). You need your own legally dumped copy of Wonder 1.0.0, plus your own keys and firmware. Instructions on how to obtain them are not provided.

[!IMPORTANT] This project was made with a lot of AI and a lot of study. Most of the code, tooling and documentation was written with AI assistance (Anthropic's Claude), directed, tested and reviewed by a human who spent a great deal of time studying the Switch's CPU, OS and graphics stack (AArch64, NVN, Maxwell shaders, Vulkan) to guide it. If you don't agree with the use of AI or don't trust AI-written code, that is your right; you run the code at your own discretion.

[!IMPORTANT] A note on the history of this repo. The project was developed across several computers, and files were lost when moving between them. Part of the code had to be rewritten from scratch, and some early notes, test scripts and intermediate results no longer exist. If something in PROGRESS.md or the docs refers to a file you cannot find, that is probably why. Bug reports about gaps like this are welcome.

Platforms

Platform Status Graphics
macOS (Apple Silicon) works, the reference platform Vulkan on Metal through MoltenVK
Windows (x86-64) works, tested on NVIDIA (RTX 3050) and Intel GPUs native Vulkan 1.3
Android (arm64) works, tested on a Galaxy S23 native Vulkan 1.3
Linux (x86-64) works since 2026-10-17, tested on Ubuntu 26.04: NVIDIA RTX 3050 laptop GPU, and 60 fps on an Intel UHD integrated GPU (720p) native Vulkan 1.3

Linux support was added on 2026-10-17 by BelmanteGu (Projeto Belmante): the platform layer runtime/src/platform_linux.cpp (SDL3 window, gamepad, keyboard and audio, Vulkan surface through SDL, crash handler) and memguard_linux.cpp, a Linux branch in CMakeLists.txt and tools/wonder_linux.sh. The recompiled code and the translated shaders built on Linux are byte for byte the Mac's. See Linux.

State

gameplay, ultrawide 21:9 on an RTX 3050

The Flower Kingdom intro on Linux, NVIDIA RTX 3050, ultrawide 21:9 (NX_ULTRAWIDE=1, 2560x1080; GIF at 15 fps).

Title Character select
title select
Flower Kingdom intro Opening at the castle
course castle

All four on Linux, RTX 3050, ultrawide 2560x1080. Gameplay gets a wider view of the level; menus stay a centred 16:9 area with the backdrop's edges at the sides (see Ultrawide, frame rate and integrated GPUs).

What works

Open

The details are in the GitHub milestones.

Ultrawide, frame rate and integrated GPUs

Studied, implemented and measured on 2026-10-17 on the Linux port (summary and numbers in docs/nvn/studies/summary-1710.md; the three studies: ultrawide, fps unlock, Intel iGPU).

Flower Kingdom intro, unattended runs, uncapped (median fps in gameplay; Intel UHD ADL-S GT0.5 and RTX 3050 Laptop, same machine):

Configuration Intel RTX 3050
before the 2026-10-17 work (docked 1080p) 26.4 (picture wrong) 29.5
handheld 720p before 35.9 (picture wrong) -
now: handheld 720p, defaults 60.0 (14 of 14 windows at 58+, picture right) 53.2
now: docked 1080p 38.9 30.5
NX_FPS_CAP=30 30.0 flat 30.0 flat
ultrawide 2560x1080, handheld 720p 59.0 (14 of 14 windows at 58+) 52.8

Before the fix (top: Intel, characters and terrain black; bottom: RTX), and after it on the Intel:

Intel vs RTX before the fix Intel after the fix

Windows

Wonder runs on Windows 10/11 with a Vulkan 1.3 GPU (tested on an NVIDIA RTX 3050 and on Intel). The port is described in docs/nvn/WINDOWS-PORT.md and WINDOWS-PLAN.md, the PC quality work in docs/nvn/pc-quality/. dev.ps1 sets up the build environment (Visual Studio Build Tools, clang, CMake, Ninja, Vulkan SDK) and tools/pack_pc_wonder.py packs your own data for the PC. The recompile, shader and build steps are the same as in the macOS section below.

Linux

The complete step-by-step guide (Linux, macOS, Windows, Android, with the expected checks and troubleshooting) is docs/BUILD.md, based on the community guide by ouni666 (#8).

Wonder runs on Linux x86-64 with a Vulkan 1.3 GPU (tested on Ubuntu 26.04, NVIDIA RTX 3050 laptop GPU, driver 595). Nothing needs root: every tool can live under private/third_party/.

Requirements: clang, CMake, Ninja, the Vulkan loader, SDL 3 (the distribution's, or built from source with -DCMAKE_INSTALL_PREFIX=private/third_party/sdl3), the Vulkan headers 1.4.357 (runtime/src/vk_gen.h was generated from them; older distribution headers miss some types), .NET SDK 10 (tarball) and a Python 3 venv with capstone lz4 zstandard fonttools.

  1. Import the XCI with the on-device importer built for the host; --exefs also keeps the raw NSOs the recompiler reads:
    cmake -S android/wonder/importer -B private/build/importer -G Ninja && ninja -C private/build/importer
    private/build/importer/nximport --exefs --out private/wonder prod.keys title.keys MarioWonder.xci
    
  2. Recompile and translate the shaders as in the macOS section (steps 2 and 3).
  3. Button font: cp android/wonder/assets/fonts/shared_5.ttf private/wonder/fonts/.
  4. Build:
    T=$PWD/private/third_party
    CC=clang CXX=clang++ cmake -S . -B private/wonder/build -G Ninja -DNX_GAME=wonder -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_PREFIX_PATH=$T/sdl3 -DNX_VULKAN_INCLUDE=$T/Vulkan-Headers-1.4.357/include
    ninja -C private/wonder/build -j6 wonder
    
  5. Run: tools/wonder_linux.sh [quality|balanced|performance] (uses the discrete GPU; F11 or Alt+Enter for full screen).

Android

The same recompiled code runs on arm64 phones with a native Vulkan 1.3 driver. On a Galaxy S23 (Snapdragon 8 Gen 2) the game runs with drawn touch controls, a present pass rotated to the display (16:9 with bars), a pipeline cache on disk and ADPF performance hints. Progress, the test list and the performance phases are in docs/nvn/ANDROID-PORT.md.

Build and install (macOS or Linux, Android SDK with NDK 28.2):

private/venv/bin/python tools/pack_phone_wonder.py        # your data -> private/wonder/Wonder-data.zip (~4 GB)
CMAKE_BUILD_PARALLEL_LEVEL=4 bash android/build_apk.sh --game wonder   # -> private/wonder/apk/wonder.apk
bash tools/wonder_push_android.sh <adb serial>             # install + data to Internal storage + all-files access
bash tools/wonder_run_android.sh <adb serial> 90 run1      # start, wait, save the log, pull frame dumps

Without a computer, copy the APK and the zip to the phone:

  1. Extract the zip into Internal storage. You get Super Mario Bros. Wonder/.
  2. Install the APK.
  3. Allow "all files access" when the app asks.

The APK contains recompiled game code built from your own dump. It is for you only: never share or publish it.

The APK has its own launcher (android/wonder/, see docs/WONDER-ANDROID-OPTIONS.md): it imports the game on the phone from a folder with your prod.keys and your XCI/NSP, has the options screen and the touch layout editor. LAUNCHER_ONLY=1 bash android/build_apk.sh --game wonder builds it without the game library (the UI and the import work, Play does not).

Launcher, fixes and optimizations (Galaxy S23)

Touch controls:

A Bluetooth or USB controller works too, and the touch controls hide while it is in use.

Build and run (macOS, Apple Silicon)

Requirements: Xcode command line tools, CMake, Ninja, Homebrew sdl3 + vulkan-headers + vulkan-loader + molten-vk, Python 3 venv in private/venv.

  1. Dump. Dump your own cartridge (nxdumptool) and keys (Lockpick_RCM). Extract to private/wonder/exefs and private/wonder/romfs with nstool.
  2. Recompile the CPU code. This takes about 6 minutes and 2.4 GB of memory for main:
    private/venv/bin/python -m recomp private/wonder/exefs/main private/wonder/gen/main --name main --base 0x4000000000
    private/venv/bin/python -m recomp private/wonder/exefs/sdk  private/wonder/gen/sdk  --name sdk  --base 0x4010000000
    
  3. Translate the shaders. Extract the shader containers with tools/maxwell/containers.py, then translate them with the harness in tools/maxwell/spirv_harness. This writes private/wonder/spirv/<hash>.spv. See docs/nvn/TRANSLATOR.md.
  4. Build the button font. It is local only and never committed:
    private/venv/bin/python tools/fonts/make_button_font.py
    
  5. Build. The first build takes about 15 minutes:
    cmake -S . -B private/wonder/build -G Ninja -DNX_GAME=wonder -DCMAKE_BUILD_TYPE=Release
    ninja -C private/wonder/build -j6 wonder
    
  6. Run:
    NX_LOG=private/wonder/nx.log private/wonder/build/wonder
    
    It plays with a gamepad (SDL) or the keyboard.

Useful switches:

Switch What it does
NX_MEM_LIMIT_GB=<n> memory guard, ends the process past this footprint (default 8)
NX_LANGUAGE=<code> the game's language, as the console spells it: es, es-419, en-US, en-GB, fr, fr-CA, de, it, nl, pt, pt-BR, ru, ja, ko, zh-Hans, zh-Hant (es-ES and other ISO names are accepted as aliases). Falls back to <data root>/language.txt, else en-US
NX_HEADLESS=1 no window, for unattended test runs
NX_MUTE=1 no sound
NX_HANDHELD=1 handheld mode, 720p
NX_PIPELINED=0 waits for every submit, as before 60 fps (diagnosis); integrated GPUs pipeline by default
NX_ULTRAWIDE=1 ultrawide: a wider view to the window's shape (=2560x1080 or =21:9 to force one)
NX_FPS_CAP=30 the game's own 30 fps mode, always (steady, lighter)
NX_PAD_BUFFERS=1 pads bound buffers again (if HUD text or characters glitch on a GPU)
NX_DISPLAY_HZ=<hz> experimental: vsync at another rate; the game runs faster or slower, not smoother
NX_ZERO_VS_OUTPUTS=0 keeps unwritten vertex outputs undefined (the fix for black characters on Intel is on by default, not on Apple)
NX_POWER_PROFILE=0/1 Linux: never / always hold the performance power profile while playing (default: on integrated GPUs)

Every debug switch (draw traces, snapshots, bisecting toggles) is listed in docs/nvn/SWITCHES.md.

How it works, and where it is written down

Document What
PROGRESS.md living log, newest first, with screenshots
docs/NVN.md the NVN → Vulkan plan: phases N0-N7, where to cut, ground rules
docs/nvn/WONDER.md facts about the game: modules, RomFS, recompilation numbers, the host GPU
docs/nvn/SHADERS.md, TRANSLATOR.md shader containers, and Maxwell → SPIR-V
docs/nvn/TILING.md block-linear texture layouts
docs/nvn/DEBUG.md, DEBUG-2.md every rendering bug found so far (67 entries): symptom, cause, fix, switch
docs/nvn/GLITCH-PLAN.md, PERF-PLAN.md glitch and performance studies and plans
docs/nvn/ANDROID-PORT.md study for the Android port: gaps, risks, milestones A0-A7

Ground rules for this track:

Repository layout

Path What
recomp/ the AArch64 → C++ recompiler (Python)
runtime/ shared runtime: kernel, IPC, nn::* HLE, memory, platform layers (Windows, macOS, Linux, Android)
runtime/src/nvn/ NVN over Vulkan (Wonder)
games/<game>/ per-game glue (entry, patches, mods)
tools/ extraction, shader and font tools, packaging
android/ Android project and build script
docs/ findings, plans, debug history, screenshots (docs/media/)

Credits

This is a fan project. It is not affiliated with, endorsed by or sponsored by Nintendo. Super Mario Bros. Wonder and Nintendo Switch are trademarks of Nintendo. No game files, game code, assets, keys, firmware or fonts are included, in this repository or in any release. You must provide your own legally obtained copy of the game. The APK or data zip you build from your own dump contains Nintendo's code and data: it is for you only, never share or publish it. The API (NVN) is reverse engineered from binaries; no leaked NVN headers are used.

License

The code in this repository is open source under the MIT License. Third-party components keep their own licenses (see Credits). The license covers this project's code only and grants nothing for Nintendo's game. See CONTRIBUTING.md to report bugs or contribute.

SuperMarioWonderRecomp (BelmanteGu/SuperMarioWonderRecomp)

c++
Searching Database…

Part of the SwitchGamesRecomp work (same runtime, see docs/FRAMEWORK.md); this repo follows Wonder alone. Living log: PROGRESS.md.

Creator
BelmanteGu
Size
87.9 MB
Stars
219
Updated
CommitOct 17
Age
3d
Commits · 90 Days