# Dolphin (wasm-dolphin) — the GameCube and Wii core

PlayAgain's Nintendo GameCube and Wii core is [Dolphin](https://dolphin-emu.org)
compiled to WebAssembly by the
[wasm-dolphin](https://github.com/Remenby31/wasm-dolphin) fork (its own
PowerPC-to-wasm JIT, a WebGPU renderer, an Audio Worklet), pinned at commit
`50f0c362` and built by PlayAgain from source with PlayAgain's patches
(`source/patches`, applied by `source/apply.sh`).

**Status.** The adapter (`src/emulator/dolphin-adapter.ts`) and the harness
page `/dev/dolphin` boot a disc, show its picture and take GameCube pads. The
console loads it for GameCube and Wii games: pads, a phone as the Wii Remote,
Dolphin's save states (autosave and the States panel, kept in Drive; a state
opens in the core build that made it and in the builds the adapter lists as
compatible), the game's own save beside the state (a GameCube game's saves
as one raw memory card, a Wii title's data files as a zip; put back before
the boot, so it outlives a core update), and fast-forward (Dolphin's own
emulation speed, changed while the game runs), rumble (a GameCube pad's
motor from the core's pad block, a Wii Remote's from its block), a state's
picture, and the game's sound for another screen (`setPcmTap`: a tap worklet,
`pa-pcm-tap-worklet.js`, after the fork's own output gain).

| File | What it is |
|------|------------|
| `frame.html` | The fork's page (`index.html`), loaded in a same-origin frame per game |
| `src/` | The fork's scripts and workers, with PlayAgain's patches (`0102`-`0108` fork parts) |
| `cores/dolphin/dolphin-core-upstream.wasm` | The core, 13,513,326 B, SHA-256 `32a408daf6c536550641ca2fb088311455618efa645c70c5bcd0be08feaa9f65` |
| `cores/dolphin/dolphin-core-upstream.js` | Its Emscripten loader |
| `cores/dolphin/core.lock.json` | The SHA-256 the page checks the core against before running it |
| `source/patches/` | PlayAgain's patch series: `0001`-`0002` the Wii Remote shim, `0101`-`0106` the JIT work (J0, J1), `0107` the region plan from guest RAM (J2), `0108` the game's own save in and out and the speed changed while a game runs |
| `source/apply.sh`, `source/build.sh` | How the patches are applied and the core built (Emscripten 5.0.7, outside the repository) |
| `source/SHA256SUMS` | The served core's two files, which `build.sh` checks its result against |
| `LICENSE.notices.txt` | The notices of the libraries linked into the core |
| `pa-pcm-tap-worklet.js` | PlayAgain's: the game's samples out of the frame's audio context, for a screen elsewhere |

Built on a Mac mini M4 (2026-11-16) by `source/build.sh` from a clean
checkout: the fork's own core first (its hashes match the ones recorded in
the script), then the same tree with the patch series. The bytes are
PlayAgain's build, not the fork's prebuilt core, which is never served.
The core served until 2026-11-16 (`95302e71…`, built 2026-11-10) came from
a working tree that the patch series does not reproduce byte for byte; this
one does. Its states still open (`DOLPHIN_STATE_CORES_READ`).

It is **multi-threaded** with one shared memory (a fixed 1.5 GiB heap), so
the page that runs it must be cross-origin isolated; the console document
and `/cores/**` already are.

## Measured (Mac mini M4, desktop Chrome, 2026-11-15, `?video=wgpu&aot=1`)

Speed in normal play (frame limiter on, dual core), three 120 s windows each:
Wii Sports bowling 100.1 %, Wii Sports tennis 100.1 %, Mario Party 6 Ray of
Fright 100.1 %, Circuit Maximus 99.8 %, Wrasslin' Rapids 100.1 %. Two games,
five scenes: not a claim about other games. Those numbers are the build
served until 2026-11-16. This build (`32a408da`), measured again the same
way on 2026-11-16 (three 120 s windows each, the rig's load gate at 3):
bowling 100.1 %, tennis 100.1 %, Ray of Fright 100.1 %, Circuit Maximus
100.1 %, Wrasslin' Rapids 100.1 % (5th percentile 99.8 to 100). With
fast-forward (`/dev/dolphin`, Mario Party 6's menus, ten 1 s samples each):
200 % at 2×, 300 % at 3×.

## Licence

Dolphin is GPL-2.0-or-later; the whole, with its Apache-2.0-only parts
(mbed TLS, SPIRV-Tools, parts of glslang, the Rust crates
codespan-reporting and spirv), is distributed under the GPL-3.0-or-later
(`LICENSE.gpl3.txt`; the fork's own `LICENSE.gpl2.txt` is kept beside it).
The other libraries' notices are in `LICENSE.notices.txt`.
