Skip to content
scarletnxPublic

About

ARM64 Recompiler

Topics

Resources

Contributing

Stars

130 stars

Watchers

3 watching

Forks

Repository files navigation

ScarletNX

Wimsy, the mascot
Wimsy, the ScarletNX mascot

Discord: https://discord.gg/tRTRXXbyjp (my god why don't we just use IRC like good people?)

A GPLv3 static ARM64 to x86 recompiler with a Nintendo Switch translation layer for Linux, Windows, FreeBSD and Android.

Forked from MZLab's SwitchRecomp. SwitchRecomp is based off Nexium.

Quick start

Each push to main that builds everywhere becomes a nightly in scarletnx/nightly, the newest 30 kept, with each open pull request's builds. The latest: ScarletNX-linux-x86_64.AppImage and ScarletNX-linux-aarch64.AppImage for Linux (chmod +x it first), ScarletNX-windows-x86_64.zip for Windows (run bin\scarletnx.exe) and ScarletNX-android-universal.apk (Android). Games need a Vulkan 1.3 driver.

Keys and games must be dumped from your own console. Started with no arguments, the program opens the launcher. Setup device keys installs your prod.keys. For NSPs, also put title.keys in ~/.switch (%USERPROFILE%\.switch on Windows). Load Switch NSP/XCI/NRO then picks a dump, extracts and recompiles it and starts the game, which the Games tab lists from then on. See Usage for the command line and Folders for where games, saves and settings go.

The shared ARM64 recompiler lives under src/common/. Nintendo Switch Horizon HLE and Maxwell graphics live under src/nx/. The CPU-only Linux AArch64 runtime lives under src/gnuabi/ and builds without the Switch graphics or media dependencies:

cmake -S . -B build/gnuabi -DSNX_BUILD_NX=OFF
cmake --build build/gnuabi
build/gnuabi/scarletnx-gnuabi ./test_aarch64

See Linux ABI execution and QEMU validation for supported syscalls, virtual filesystems, static ELF execution, and current limits. The NX executable also has scarletnx-erista, scarletnx-mariko, and scarletnx-aula aliases.

The recompiler is also a library on its own, libscarletnx-recompiler: a program hands it ARM64 or AArch32 code in memory and runs the result in its own process with its own SVC handler, with no Switch runtime behind it. See The recompiler as a library.

Install the build tools first. On Debian/Ubuntu:

sudo apt update
sudo apt install build-essential git cmake ninja-build clang llvm-dev nasm pkg-config \
  libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev libxss-dev libxtst-dev \
  libasound2-dev libpulse-dev libpipewire-0.3-dev

If your distribution provides libsdl3-dev, install it too. Otherwise CMake builds a pinned SDL3 using the X11 and audio development packages above. SDL2 is not a substitute for SDL3. You also need a Vulkan 1.3 driver to run games. See Build prerequisites for Wayland, other systems, and the SDL3 troubleshooting steps.

Then build:

git clone --depth=1 https://github.com/scarletnx/ScarletNX
cd ScarletNX
cmake --preset default -B build && cmake --build build

For encrypted dumps, put prod.keys (and title.keys, for NSPs) in ~/.switch, or pass them with --keys and --title-keys. Decrypted DNSP/DXCI content needs no keys.

./build/scarletnx "Game.xci"  # extract, recompile, then play (also accepts NSP, DNSP and DXCI)

Run the same command again after an interruption. Completed extraction and recompilation are skipped, but the game always starts anew. To run the steps separately:

./build/scarletnx -x "Game.xci" --name Game  # -> work/Game/{exefs,romfs}
./build/scarletnx -r work/Game Game         # -> games/Game/Game
./build/scarletnx -rx "Game.xci"            # prepare without playing (UNIX)
./build/scarletnx -Hs "Game.xci"            # headless, wait for GDB (UNIX)
cd games/Game && ./Game

For an SDL3 menu, run ./build/scarletnx with no arguments. Select a driver with arrow keys and Enter or hover and click, then choose drag-and-drop or the paginated games/ browser. The GUI shows live driver/game output and combined CPU/RAM usage. See GUI launcher.

The experimental scarletnx-3ds driver and Load 3DS CIA menu entry support decrypted application CIA extraction (scarletnx-3ds -x game.cia) and an independent page-based memory controller. SNX_3DS_AOT=ON additionally enables an experimental extract -> offline AOT -> native run pipeline on native 64-bit Linux, using an explicit ARM11/checked-memory profile without changing shared A57 defaults. Larger images now use bounded chunked static CFG compilation (16 MiB text cap). SuperTux now completes minimal APT startup with real synchronization/thread resources, initializes HID handles and reaches and executes main. It then opens its reconstructed RomFS using NX's shared filesystem backing, executes scalar VFP in gettimeofday, opens its SelfNCCH archive and stopped at FS's archive timestamp request — real timestamp semantics and a minimal Vulkan-only GSP/GPU display path (live SDL3 window + PPM frames) now exist. No first frame, audio or gameplay is claimed. Checked CTR IPC uses a separate SwIPC mode; ARM11 exclusives and serialized native thread scheduling work. Full VFPv2, cache/resume, HLE and devices remain incomplete. The default build still stops after extraction. See the staged 3DS port for limits, build instructions and remaining work.

For more detailed information please see: Build + run. For the Android app (arm64 and x86_64), see Android.

Special thanks

Wimsy, the mascot and the runtime's icon (dist/wimsy.svg) was drawn by Liz.

About

ARM64 Recompiler

Topics

Resources

Contributing

Stars

130 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages