mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-10 17:16:47 -04:00
ca7d126a13
* Bluetooth Wii Remote support: the game reads a real Wii Remote through KPAD Enable SDL3's HIDAPI Wii driver and hand a paired Wii Remote (bare or with Nunchuk) to the game as a real Wii Remote: WPADProbe reports CORE/FREESTYLE and KPADRead fills KPADStatus[0] from SDL every frame (buttons, accelerometer in KPAD's g frame, Nunchuk stick and accelerometer), while the GameCube pad view of that port reports no controller. The game's own motion code then handles wheelies, tricks and Wii Wheel steering. Classic Controllers and Wii U Pro Controllers keep going through the GameCube pad path with a default button table picked by name. SDL's Wii driver drops a remote on a failed Bluetooth read or when the Nunchuk is plugged or unplugged and never re-adds it, so the runtime keeps rescanning (Dolphin style) while no Wii controller is present by toggling the driver hint off and, a few frames later, on again; a dropped remote is back within 1-2 s. Settings live in the F10 overlay under Wii Remotes (Bluetooth) and in Config.toml (wii_remotes, wii_continuous_scan). * Fix Wii U Pro / Classic Controller ZL and ZR not registering SDL's Wii driver reports ZL/ZR as the LEFT_TRIGGER/RIGHT_TRIGGER analog axes, never as digital shoulder buttons. Binding them to LEFT_SHOULDER/RIGHT_SHOULDER meant they never fired and also disabled aurora's own analog-trigger fallback (a button table entry for PAD_TRIGGER_L/R marks the trigger as "handled", even when the bound digital button never actually presses). Leaving them unbound lets the default axis mapping drive them like every other analog-trigger pad. Reported by an end-to-end tester connecting a real Classic Controller to a Wii Remote. * Wii Remotes menu: live raw D-pad/ZL/ZR readout for Classic Controller / Wii U Pro Diagnostic aid for a reported issue where the Classic Controller's D-pad does not do anything in-game (no wheelies). Shows what SDL itself sees so a driver-level problem (nothing lights up) can be told apart from a mapping problem (it lights up but the game does not react). * Fix Classic Controller D-pad input * Address CodeRabbit review on PR #73 - PADRead: hide KPAD-served ports even while input is blocked so the port error state does not flip when the overlay opens/closes. - WPADProbe: run the Wii Remote rescan state machine before probing so a reconnect probe before the next PADRead can see the remote. - EnsureSensors: only cache the gamepad id once every accelerometer enabled, so a failed activation is retried. - ConfigureSdlHints: reset the in-flight rescan bookkeeping. - Settings overlay: disable "Rescan now" while Wii Remotes are turned off. * Bluetooth Wii Remote: fix wheel steering, native Classic Controller, extension hot-swap Accelerometer - The SDL -> KPAD conversion negated the wrong axis: SDL's z is the remote's +Y (towards the user), so KPAD acc is (-wiiX, -wiiZ, +wiiY). Fixes mirrored Wii Wheel steering. - Drop reports whose accelerometer bytes arrive zeroed (+-5.12 g on every axis, a few times a minute over Bluetooth) and repeat the last good sample; they read as a full-lock steer plus a 9 g shake. - One-button zero-point calibration in the overlay (remote flat, buttons up), stored in Config.toml as wii_accel_offset_x/y/z. SDL's read of the remote's factory calibration times out over Bluetooth and falls back to a nominal zero point, which left a per-axis bias of up to ~0.3 g on the tested remote. - Live accelerometer readout and an optional per-frame CSV trace (wii_accel_trace = true) for debugging. Classic Controller through KPAD/WPAD - WPADProbe reports WPAD_DEV_CLASSIC; KPADRead fills ex_status.cl and KPADGetUnifiedWpadStatus the raw WPADCLStatus (WPAD_CL_BUTTON_* bits, sticks in the SDK's signed -512..511 range, triggers), so the game shows the Classic layout and icons and no button mapping is involved. Ports served through KPAD are hidden from PADRead; only the Wii U Pro Controller stays a GameCube pad. Extension hot-swap - SDL's Wii driver destroys the joystick on an extension change but keeps the HID handle open, and HIDAPI never re-creates a joystick for such a device. Patch the vendored SDL at configure time (AuroraSDL3Patches.cmake, wired into AuroraSDL3Provider.cmake for both the downloaded tarball and a pre-provided FETCHCONTENT_SOURCE_DIR_SDL) so the joystick is rebuilt in place with the new extension type, without touching the Bluetooth handle. - Keep a vanished remote's channel alive with neutral input for up to 3 s while SDL re-creates the joystick, so the game never sees a disconnection. The driver-hint rescan stays as a fallback for real drops, starting 3 s after the loss, and also runs from the overlay's per-frame Draw. Log rescans. Mappings / overlay - Do not apply the shared positional [controller] bindings to Wii pads: that override is what made a Classic Controller's A/B and X/Y look swapped. - Raw D-pad fallback also for the Wii U Pro Controller; overlay readouts read joystick buttons directly (SDL's generated HIDAPI mapping expects a hat). - Overlay: Classic Controller readout, accelerometer readout and calibration. - README: Bluetooth Wii Remote section and known limitations. * Review pass on the Wii Remote input path - EffectiveKind: stop bridging an extension swap once a different controller has taken the port, and note that everything touching the scanner state runs on the guest thread. - KPADGetUnifiedWpadStatus: fill every requested entry (the SDK returns `count` recent samples), capped at KPAD's 16 read buffers. - IsKpadKind gets internal linkage; the calibration accessors get their comments; clarify why Draw() also runs Poll(). * Drop the dead Classic-Controller-as-GameCube-pad matching A Wii Remote with a Classic Controller is served through KPAD and its port is hidden from PADRead, so the name matches that once gave it a GameCube button table and the raw D-pad fallback could never take effect any more. Both now match only the Wii U Pro Controller, and the default table is renamed accordingly (g_defaultButtonsWiiUPro). --------- Co-authored-by: LOL <andresguerra2k26@gmail.com> Co-authored-by: Nick <89667145+Nick1232345@users.noreply.github.com>
237 lines
11 KiB
Markdown
237 lines
11 KiB
Markdown
|
|
# WiiCompiled
|
|
|
|
A native PC port of Mario Kart Wii, made with static recompilation.
|
|
|
|
There's no emulator in the loop, no interpreter, no JIT, no PowerPC
|
|
anywhere at runtime.
|
|
|
|
> [!IMPORTANT]
|
|
> There is no Nintendo code, no assets and no game data anywhere in this project or its releases.
|
|
> You need your own legally dumped copy of the PAL version of the game. Setup only ships the
|
|
> toolchain, the translation runs on your machine against your disc image, and nothing ever gets
|
|
> uploaded.
|
|
|
|
[What is a github, I just want to play](https://github.com/TeamWheelWizard/WheelWizard/releases/latest)
|
|
|
|
---
|
|
|
|
## What it does
|
|
|
|
**Unlocked framerate with interpolation.**
|
|
The original game is hard-locked to 60 fps. The runtime can generate interpolated frames in between, so on a
|
|
120/144 Hz monitor things genuinely look smoother.
|
|
|
|
> [!WARNING]
|
|
> Interpolation is experimental right now and will show artifacts in specific scenarios.
|
|
|
|
**Any aspect ratio you want.**
|
|
Drag the window bigger, wider, whatever, the camera adjusts
|
|
live.
|
|
|
|
**Native rendering via aurora.**
|
|
The graphics layer is built on
|
|
[aurora](https://github.com/encounter/aurora). Aurora is a source-level GameCube & Wii compatibility layer.
|
|
|
|
**High internal resolution.**
|
|
Play at several times the console's resolution.
|
|
|
|
**Music ducking.**
|
|
Start playing something else, Spotify, a YouTube video, and
|
|
the game automatically mutes its own music until the other audio stops. Optional, if you'd
|
|
rather it didn't. All audio that shows in your display media controls on your windows pc fall under this.
|
|
|
|
**An in-game settings bar.**
|
|
Press **F10** while the game window has focus:
|
|
- Internal resolution
|
|
- FPS counter
|
|
- Controller assignment for all four ports
|
|
- Full per-controller button mapping
|
|
- Volume, instant mute, and the music ducking toggle
|
|
|
|
Everything you change is saved to `Config.toml` on the spot and restored next launch.
|
|
|
|
**Real controller support.**
|
|
Controllers are fed to the game as a GameCube controller.
|
|
Mappings are positional (`south`, `east`, `west`, `north`) rather than Xbox-labelled, so the
|
|
same config makes sense on Xbox, PlayStation, Nintendo and generic SDL pads alike, and extra
|
|
inputs like paddles, touchpads and share buttons show up when the hardware reports them.
|
|
The official Wii U / Switch GameCube adapter (WUP-028) works too; as with Dolphin, on Windows the
|
|
adapter must be switched to the WinUSB driver once (Zadig).
|
|
|
|
**Real Wii Remotes over Bluetooth.**
|
|
Pair a Wii Remote with Windows (Settings > Bluetooth > Add device, press 1+2 or SYNC, leave the
|
|
PIN empty) and the game reads it as an actual Wii Remote through KPAD: Wii Remote icons and
|
|
prompts, Wii Wheel tilt steering, wheelies and tricks all come from the game's own motion code.
|
|
Nunchuk and Classic Controller are real Wii extensions too: the game gets the Nunchuk's stick,
|
|
C/Z and accelerometer, and the Classic Controller through `KPADGetUnifiedWpadStatus` with its own
|
|
layout and icons, so its buttons do what the game says they do and no mapping is involved. Plug an
|
|
extension in or pull it out mid-game and the game switches control scheme like on the console
|
|
(the runtime patches SDL's Wii driver, which otherwise loses the remote for good on an extension
|
|
change). Only the Wii U Pro Controller, which has no Wii-era equivalent, is fed to the game as a
|
|
GameCube pad with Nintendo's layout. If a remote drops out or was switched on after launch, the
|
|
runtime keeps rescanning Bluetooth until it comes back (F10 > Controller settings > Wii Remotes). SDL's read of
|
|
the remote's factory accelerometer calibration often times out over Bluetooth (`console.log`
|
|
then says "Using fallback accelerometer calibration") and it falls back to a nominal zero point,
|
|
so the same menu has a one-button calibration (remote flat, buttons up) that removes the small
|
|
tilt offset some remotes show.
|
|
|
|
Known limitations of the Wii Remote path:
|
|
- No IR pointer yet: menus are navigated with the D-pad and A (the game treats the remote as
|
|
pointing away from the screen).
|
|
- Battery level is not reported to the game and the remote's speaker is not implemented.
|
|
- Only the Wii Remote's own accelerometer is calibrated; the Nunchuk's uses SDL's fixed zero point.
|
|
- The Classic Controller's L/R triggers reach the game as digital (full pull on click): SDL does not
|
|
expose their analog travel.
|
|
- Turn the Wii Remote support off in that menu if you use a Mayflash DolphinBar, which already
|
|
presents the remote as a regular gamepad.
|
|
|
|
## Requirements
|
|
|
|
- Windows 10 or 11, 64-bit
|
|
- GPU: GTX 1650 / RX 6400 / Arc A310 or higher
|
|
- CPU: Intel Core i5-8400 / AMD Ryzen 5 2600 (4c/6c, ~3.5GHz+) or higher
|
|
- About 20 GB of free disk space during installation (Final game size ~5 GB)
|
|
- macOS 14 (Sonoma) or later on Apple Silicon
|
|
- On macOS, Apple Xcode Command Line Tools (Setup opens Apple's installer when they are missing)
|
|
- A clean, unmodified **PAL `RMCP01`** disc image of Mario Kart Wii, dumped by you. ISO, GCM,
|
|
GCZ, CISO, WBFS, WIA and RVZ are accepted.
|
|
|
|
> [!NOTE]
|
|
> GPU/CPU minimums are set by driver support and D3D12/Vulkan feature requirements, not by the game's actual demands.
|
|
|
|
Only the clean PAL revision will work. Anything else (other
|
|
regions, patched executables) is rejected outright.
|
|
|
|
> [!NOTE]
|
|
> Nobody here will tell you where to get the game. Dumping your own disc is on you, and links to
|
|
> game files won't be provided or tolerated.
|
|
|
|
## Installing
|
|
|
|
For an easy experience, use [Wheel Wizard](https://github.com/TeamWheelWizard/WheelWizard). Pick your clean PAL `RMCP01`
|
|
image under Settings, turn on **WiiCompiled (beta)**, and hit install from the Home page.
|
|
Wheel Wizard downloads the setup tool from this repo and walks you through install, updates and
|
|
launching. The backend itself is deliberately command-line only, Wheel Wizard is a wrapper around it.
|
|
|
|
|
|
> [!CAUTION]
|
|
> Only take builds from this repository's
|
|
> [Releases](https://github.com/patchzyy/Wiicompiled/releases) page. If someone's sharing an
|
|
> installer through Discord or some random download site, don't touch it!!
|
|
|
|
## A note on related projects
|
|
|
|
WiiCompiled, Wheel Wizard, Retro rewind and other related projects are developed
|
|
**independently** and each has its **own** contribution rules and all have their own
|
|
rules. What applies here does not automatically apply there,
|
|
and vice versa. Check each project's own CONTRIBUTING and README files.
|
|
|
|
## Retro Rewind
|
|
|
|
[Retro Rewind](https://wiki.tockdom.com/wiki/Retro_Rewind), ZPL's Mario Kart Wii mod distribution,
|
|
can be built as its **own static profile**: instead of applying `Code.pul` as runtime patches,
|
|
the Kamek/Pulsar code is statically translated together with the base game into a separate native
|
|
executable.
|
|
|
|
Wheel Wizard drives this too.
|
|
|
|
## Building from source
|
|
|
|
Owning the game is still required even if you compile everything yourself.
|
|
|
|
You'll need: .NET 8 SDK, CMake, Ninja, and LLVM/Clang (the shipped build uses LLVM-MinGW targeting
|
|
`x86-64-v3`).
|
|
|
|
Build the translator:
|
|
|
|
```powershell
|
|
dotnet build translator/Translator.sln -c Release
|
|
```
|
|
|
|
The default test suite needs no binaries and no host C++ compiler, so you can hack on the
|
|
translator without any game data around.
|
|
|
|
For everything beyond that, feeding in your own `main.dol`/`StaticR.rel`, running the
|
|
translation, generating the manifest and build graph, and compiling. see [`translator/README.md`](translator/README.md).
|
|
|
|
## FAQ
|
|
|
|
**Is this an emulator?**
|
|
No. Everything is compiled to native code before you ever press play. At runtime there's nothing
|
|
emulating a Wii CPU or GPU.
|
|
|
|
**Do you provide the game?**
|
|
No. Don't ask. Nothing in this repo or any release contains Nintendo code or assets.
|
|
|
|
**Why does setup take so long?**
|
|
Because we **don't** ship the translated binary, most other recomp projects do, but we
|
|
don't want to risk it right now, setup has to run a static recompiler over the whole game
|
|
and then throw a C++ compiler at the result. It's a **one-time cost** on your machine.
|
|
|
|
**Which game version works?**
|
|
Clean PAL `RMCP01`. Other regions and modified executables are **rejected**. Translating
|
|
them against the wrong manifest would give you a subtly broken game that's miserable to debug for us.
|
|
|
|
**Can I recompile other GameCube/Wii games with it?**
|
|
The translator itself handles DOLs and RELs generically, see
|
|
`projects/examples/generic-dol.yml`. The catch is that a *playable* port also needs a runtime:
|
|
audio, input, GX, everything the game touches.
|
|
|
|
**The game crashed / stopped with an error.**
|
|
Errors are deliberately loud instead of quietly swallowed. Send a report along with the run log
|
|
from `%LOCALAPPDATA%\WiiCompiled\Logs`.
|
|
|
|
**Will you fix original bugs?**
|
|
Not in the base game, behavior identical to real hardware is the goal. Only report things where this port differs
|
|
from the original game. As for Retro Rewind, some base-game behavior **is** patched, so if it differs from the
|
|
base game, that's normal. If Retro Rewind behavior differs between Dolphin/Wii and WiiCompiled, open an issue on GitHub.
|
|
|
|
**How accurate are the physics?**
|
|
100% - this is proven by in-game ghosts. Since ghosts are replay files based on inputs rather
|
|
than tracked positions, matching ghosts prove the physics match across Dolphin/Wii/WiiCompiled.
|
|
|
|
**Is it done?**
|
|
Not fully. The game is in a state where everything should be playable and the physics do match
|
|
100% with the original game, but compatibility, rendering, networking and performance are all
|
|
actively being worked on. If you do find an issue, we strongly encourage you to open one on
|
|
GitHub so we can take a look at it.
|
|
|
|
## AI usage
|
|
AI coding tools were used during development of this project.
|
|
All translated output is verified against real hardware behavior and most importantly, physics accuracy is proven synced across Wii, Dolphin, and WiiCompiled (see FAQ).
|
|
|
|
## Credits
|
|
|
|
- **[aurora](https://github.com/encounter/aurora)** - the GX rendering/windowing backend this
|
|
project's whole graphics layer sits on. MIT licensed.
|
|
- **[Dawn](https://dawn.googlesource.com/dawn)** - Google's WebGPU implementation, powering
|
|
aurora's Direct3D, Vulkan and OpenGL backends.
|
|
- **[Dolphin Emulator](https://github.com/dolphin-emu/dolphin)** - an invaluable reference for Wii
|
|
hardware behavior during development, plus the source of the free DSP coefficient ROM and the
|
|
unmodified default WiiConnect24 bootstrap tree bundled with the runtime.
|
|
- **[Retro Rewind](https://wiki.tockdom.com/wiki/Retro_Rewind)** by ZPL and team - the mod
|
|
distribution this project supports.
|
|
- **[Wheel Wizard](https://github.com/TeamWheelWizard/WheelWizard)** - the mod manager this
|
|
project integrates with as a launch backend.
|
|
- Everyone in the static recompilation community.
|
|
|
|
Bundled third-party components and their licenses live in
|
|
[`THIRD-PARTY-NOTICES.md`](THIRD-PARTY-NOTICES.md).
|
|
|
|
|
|
## License
|
|
|
|
WiiCompiled is free software: you can redistribute it and/or modify it under the terms of the
|
|
[GNU General Public License, version 3](LICENSE) as published by the Free Software Foundation.
|
|
|
|
WiiCompiled is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
|
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
Any mkwii distribution making use of WiiCompiled must be licensed under GPL v3.0.
|
|
|
|
Not affiliated with, endorsed by, or associated with Nintendo. Mario Kart Wii is a trademark of
|
|
Nintendo. No Nintendo intellectual property is contained in, distributed with, or obtainable
|
|
through this project.
|