Super Mario Galaxy running natively on Linux ARM handhelds through PortMaster. No emulator: the game code is Petari, SMGCommunity's decompilation, and this repo is everything underneath it: graphics, audio, input, disc and saves.
You need your own copy of the game: USA revision 0 (RMGE01) or Europe
(RMGP01), as an RVZ or WIA image. The European disc should work but hasn't
been tested on a real dump yet. The first launch turns the image into game
files on the device. Install steps and controls are in the
package README.
This is an unofficial fan project, not affiliated with Nintendo.
Playable on Allwinner H700, Rockchip RK3326 and RK3566 handhelds under muOS, KNULLI, spruce, AmberELEC and ROCKNIX. Game logic runs at 60 Hz. When a scene is too heavy to draw every frame, it draws every second, third or fourth frame instead and the game keeps its speed. The original 640x456 framebuffer is shown at 4:3, or in the game's widescreen mode on wide displays.
third_party/petari: the pinned decompilation. It's never edited.patches/petari: the patch series applied to a generated copy at build time.third_party/starlet: Starlet, the GameCube and Wii layer. It draws the game (GX command core and OpenGL ES renderer) and reads the disc. Use-DGALAXY_STARLET_DIR=/pathto build against another checkout.third_party/sbc-port-overlay: the in-game menu and performance overlay.src/graphics,src/platform,src/compat,src/assets,src/setup: the port's services. They build against the Wii SDK, JSystem and nw4r headers only.src/game: port code that needs Galaxy's own classes (fatal screen, HOME menu, file loading, collision, star pointer, audio resources).src/application: the executable.
The source_layers test fails if a service layer includes game code. More
detail for contributors: compatibility layer,
platform services,
assets and graphics and
updating Petari.
You need CMake 3.24+, Ninja, Python 3.9+, Git and a C++17 compiler.
git submodule update --init --recursive
cmake -S . -B build/host -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build/host
ctest --test-dir build/host --output-on-failureThe build checks the Petari revision and applies patches/petari to a
generated tree, so the submodule stays untouched. Nothing is downloaded during
configure.
The cross build needs an aarch64 sysroot with SDL2 and GLES 3 headers, Clang and LLD. Release builds use LTO, which needs LLD from the same LLVM release as Clang. With a different linker CMake warns and links without LTO.
cmake -S . -B build/aarch64 -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=cmake/aarch64-linux.cmake \
-DGALAXY_SYSROOT=/path/to/aarch64/sysroot -DGALAXY_CLANG=clang -DGALAXY_CLANGXX=clang++ \
-DGALAXY_LLD=/path/to/ld.lld \
-DGALAXY_GLES=ON -DGALAXY_SDL_AUDIO=ON -DGALAXY_SDL_INPUT=ON
cmake --build build/aarch64 --target galaxy galaxy-setup
tools/package-portmaster.sh build/aarch64 build/portmasterbuild/portmaster/smg.zip installs like any PortMaster release, and
build/portmaster/smg is the same folder in the layout PortMaster's repo uses.
galaxy is the game. galaxy-setup extracts the disc into gamedata/ and
embedded/ and checks every file against
tools/assets/RMGE01-rev0-gamedata.sha1.
Release packages are built with a Clang profile:
-DGALAXY_PROFILE_USE=/path/to/galaxy.profdata takes one from an
instrumented (-fprofile-generate) run of the same sources.
The package ships packaging/ports/smg/smg/programs.list, the shader programs
built on first launch. Every install records the programs it builds in
smg/shadercache/programs.list. To add programs from players' lists:
build/host/galaxy_merge_program_lists packaging/ports/smg/smg/programs.list programs.list...It skips entries this build can't plan and keeps the existing order.
See CONTRIBUTING.md.
GPL-3.0, see LICENSE. Petari is CC0-1.0, Starlet is GPL-3.0, sbc-port-overlay is MIT, and Starlet's Zstandard decoder is BSD. Details are in THIRD_PARTY_NOTICES.md.