Skip to content
ProducdevityPublic

About

GameCube and Wii SDK layer for native decompilation and recompilation ports on Linux ARM handhelds. Translates GX to OpenGL ES 3.1 and covers disc, memory card, audio, input and OS services.

Topics

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Repository files navigation

Starlet

Starlet is a source-level GameCube and Wii compatibility layer for decompilation ports to Linux ARM handhelds: OpenGL ES 3.1 on Mali-class GPUs, the firmware's SDL2, and about 1 GB of RAM.

It holds the GX graphics stack that the Super Mario Galaxy Linux ARM port runs on, and the disc handling and SDL services its ports share:

  • starlet::gx (starlet_gx) decodes the GX command stream (BP, CP and XF registers, display lists, vertex arrays) and models GX vertex processing, transforms, TEV, textures, rasterization, pixel operations and EFB copies. C++17, no other dependencies.
  • starlet::gx_gles (starlet_gx_gles) draws that model with OpenGL ES 3.1.
  • starlet::disc (starlet_disc) reads GameCube and Wii disc images (ISO/GCM, and WIA and RVZ stored or with Zstandard), parses the FST and runs the first-launch setup that extracts a supported disc into a port's gamedata/. C++17, with the pinned Zstandard decoder in third_party/zstd.
  • starlet::card (starlet_card) keeps memory cards as Dolphin GCI folders and serves them as the SDK's CARD calls (source ports) or as formatted card images (EXI card models). C++17, no other dependencies. starlet::card_sdk binds the SDK's CARD functions on starlet::os.
  • SDK-level services for decompilation ports (Linux; include/starlet/sdk/ declares the SDK types and calls they implement, and a port asserts its decompilation's layouts match): starlet::os (guest threads, interrupts, alarms, time, game memory, crash reports), starlet::dvd (the DVD calls over installed discs), starlet::pad, starlet::ar (ARAM), starlet::gx_fifo (the write-gather pipe, FIFO, draw sync and VI over the GX renderer), starlet::ai (audio DMA), starlet::ax (the AX voice library mixed natively), starlet::card_sdk (the CARD calls over starlet::card). include/starlet/compat/ holds the big-endian field types and Gekko intrinsic replacements their ports compile against.
  • starlet::host (starlet_host) plays audio through the firmware's SDL2, reads its game controllers into a port's GameCube layout, and turns the frontend's SIGTERM into a prompt exit with the saves flushed. C++17 and SDL2.

A port feeds the command stream to a Decoder and gives it a MemoryReader for the memory the commands refer to; docs/GX-model.md describes that contract. docs/Discs-and-memory-cards.md describes the disc formats, their limits and the setup flow, and the card folders, images and CARD calls; docs/Host-services.md the audio, controller and quit contracts. The other pages in docs/ cover the GLES renderer, the OS and GX FIFO services and the other SDK services.

Layout

include/starlet/gx/       public headers
include/starlet/gx/gles/  OpenGL ES renderer headers
include/starlet/disc/     disc image, FST and setup headers
include/starlet/card/     memory card headers
include/starlet/host/     audio, controller and quit headers
src/gx/                   GX model
src/gx/gles/              OpenGL ES renderer
src/disc/                 disc images and setup
src/card/                 memory cards
src/host/                 SDL audio, controllers and quit
tests/gx/                 host tests
tests/disc/               disc host tests
tests/card/               memory card tests
tests/host/               audio, controller and quit tests
docs/                     subsystem pages, mirrored to the GitHub wiki
third_party/zstd/         Zstandard v1.5.6 (submodule)

Building

git submodule update --init third_party/zstd
cmake -S . -B build -G Ninja
cmake --build build
ctest --test-dir build

The renderer builds when OpenGL ES 3.1 headers are found (STARLET_GLES_INCLUDE_DIR); its tests run against a recording GL fake. A device build sets -DSTARLET_GLES=ON, which also links the target's libGLESv2. starlet::host builds when SDL2 is found (STARLET_SDL2_INCLUDE_DIR, STARLET_SDL2_LIBRARY); -DSTARLET_HOST=OFF leaves it out.

-DSTARLET_GX_TRACE=ON builds the GX trace recorder into a port; tools/replay-all.sh replays recorded traces against a checkout. See docs/Replay-traces.md.

Using Starlet in a port

set(STARLET_GLES ON)
add_subdirectory(path/to/starlet)
target_link_libraries(port PRIVATE starlet::gx_gles starlet::card starlet::host)
target_link_libraries(port-setup PRIVATE starlet::disc)

starlet::disc links Zstandard statically, so the setup tool runs on firmware without libzstd. A port's setup describes its supported discs in a starlet::disc::Game (title, game IDs, revisions, main.dol SHA-1s, optional manifests) and calls install(); port-specific outputs, such as assets carved from main.dol, go in the setup hook.

starlet::host gives a port its SDL services:

  • AudioOutput::open_pull for an AI DMA model that the device's clock drives, open_push and write() for one that produces on its own clock;
  • Controllers and to_gamecube() with the port's GameCubeMapping (face layout, Z and trigger sources, threshold, stick dead zones) for PAD or the SI model; a Wii port maps the Gamepad itself;
  • install_quit_signals(), poll_events(), quit_requested(), on_quit(), exit_now() and exit_after_quit(): the port flushes its saves and exits within 1 s of SIGTERM.

An embedding project builds Starlet's tests only with STARLET_TESTS set.

Aurora projects: see docs/Aurora-integration.md.

Contributing

See CONTRIBUTING.md.

License

Starlet is licensed under the GNU General Public License, version 3. See LICENSE.

About

GameCube and Wii SDK layer for native decompilation and recompilation ports on Linux ARM handhelds. Translates GX to OpenGL ES 3.1 and covers disc, memory card, audio, input and OS services.

Topics

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages