# DuskOnPS3 **Bringing Twilight Princess natively to the PlayStation 3, based on Dusklight.** > Unofficial, experimental, and very early. **There is no playable build yet.** > No game data is included or will ever be distributed: you bring your own legally obtained disc image. > Not affiliated with or endorsed by Nintendo, Sony, the Dusklight team, the zeldaret project or the > authors of the ports this project learns from. ## About After seeing Twilight Princess ported to the PS Vita and Xbox 360, I started an independent project to bring it natively to the PS3. I'm a software developer, and this project is also an experiment in how far modern AI-assisted development can go on older console hardware. Most of the implementation is written with [Claude Code](https://claude.com/claude-code) (Anthropic's AI coding agent) under human supervision, with code review, debugging and testing by me. **What Claude did so far:** researched and mapped the reference projects listed below (what each one solves and which parts apply to a PS3 port), picked the toolchain, set up this repository, the CMake build and the patch workflow, and wrote the first PS3 patches. I review, test, and decide the direction. ## Goals - Native execution on real PS3 hardware, no emulation. - RSX hardware acceleration. - 720p at 30 FPS. - HEN and CFW support. - DualShock 3 support. - Memory and SPU optimizations. Development is public: progress, technical problems and experimental builds will all be here. ## Status | Milestone | State | | --- | --- | | Toolchain: C++20 on the PPU | ✅ PS3DK, GCC 16.1 (`powerpc64-ps3-elf`): C++20 compiles, 32-bit pointers, big-endian, signed `char` | | M0: every game and JSystem source compiles for the PPU | ✅ 2026-11-27: ~1,400 files, 0 errors, 3 small patches (see below) | | M1: the game runs its loop on a real PS3 (null graphics, log file on the HDD) | ✅ 2026-11-27: game loop running frame after frame on a real console | | M2: Aurora GX → RSX backend (from melee-ps3), title screen | 🚧 next | | M3: audio on an SPU, DualShock 3, saves | ⏳ | | M4: real hardware, performance work towards 30 FPS | ⏳ | ### Milestone 1 notes On a real PS3 (HEN), from the disc image on the internal HDD: Dusklight's start-up, config, Aurora, mods loader, the game loop, the logo scene and every frame's GX work run; the screen pulses between two colours each frame (no RSX renderer yet). What it took, in order of the console runs: - a PS3 platform layer (`platform/ps3`): Aurora glue and window without WebGPU/SDL, display and system dialogs on the RSX, run log and watchdog, the SDL3 calls the desktop code makes answered on PS3 services, no symbol manifest, networking unavailable; - memory: a 160 MiB malloc arena (PS3DK's 64 MiB default cannot hold the 64 MiB MEM1; 180 MiB left too little for thread stacks), 256 KiB default thread stacks instead of 64 KiB; - the audio stream callback paced at 48 kHz so the game's sound engine advances; - **Aurora on a big-endian host** (`patches/aurora/0002`): its `bswap` swapped unconditionally, so every GX FIFO command was written byte-reversed; and the FIFO is processed on the game thread. 244 symbols remain trap stubs, all ImGui/RmlUi developer UI that the game path never reaches. ### Milestone 0 notes - The whole decompiled game, JSystem and the dependencies compile with PS3DK's GCC 16.1 in C++20. Remaining warnings are attributes the PPU compiler ignores (`retain`, `no_sanitize`), `offsetof` on non-standard-layout types and a few from the original code; none about pointer size or byte order. - `patches/dusklight/0001`: big-endian host, byte swaps become no-ops (including the constexpr paths). - `patches/dusklight/0002`: mod metadata records sized by pointer width (from DuskOnVita). - `patches/dusklight/0003`: nine `TARGET_LITTLE_ENDIAN` blocks that only copy a `BE` wrapper now compile on the PS3 too. The other sixteen such blocks really swap bytes and correctly stay off on a big-endian host. Also fixes an upstream slip in `d_a_tag_guard.cpp` (`pnt1` read twice instead of `pnt1`/`pnt2`). - `patches/deps/abseil`: no ELF memory image or `tm_gmtoff` on newlib/LV2, and the Cell timebase frequency (79.8 MHz). - SDL3 headers (3.4.10) are used only so that upstream files naming SDL types compile; no SDL library is linked. Testing happens on real hardware, not in an emulator. ## Why the PS3 is a good fit The GameCube's CPU is a big-endian PowerPC with 32-bit pointers. With PS3DK's default ABI the PS3's PPU is too, so the PS3 is closer to the original hardware than any other platform Dusklight has been ported to. Game data on the disc is already in host byte order, and structures laid over file data keep their original sizes. The hard parts are elsewhere: - **Graphics:** Aurora (Dusklight's GameCube SDK layer) draws through WebGPU/Dawn, which has no PS3 backend. The plan, following the Vita ports, is to keep Aurora's GX command processor and write an RSX backend, building on the GX→RSX work in the PS3 GameCube decomp ports (runtime TEV → RSX fragment program generation). - **Memory:** 256 MB of main RAM and 256 MB of VRAM. The game heaps must be bounded as the Vita port does (desktop Dusklight reserves far more). - **Desktop dependencies:** RmlUi, ImGui, Dawn, SDL, networking and mods are compiled out or replaced. ## Architecture (planned) ``` PS3DK (GCC 16, C++20, ILP32) └─ Dusklight game code + JSystem (decompilation, built as is + small patches in patches/) └─ Aurora: OS, DVD, CARD, PAD, VI + GX command processor (no Dawn/WebGPU) └─ RSX backend (new) ← TEV → fragment program generators from the PS3 GC ports └─ Game audio mixed on an SPU ← PS3 decomp ports └─ PKG for HEN/CFW, disc image on HDD or USB ``` ## Repository layout | Path | Content | | --- | --- | | `cmake/` | PPU toolchain file, dependency targets, Dusklight source lists | | `patches/dusklight`, `patches/aurora`, `patches/borealis` | diffs applied to a mirror of the pinned Dusklight tree, never to the checkout itself | | `patches/deps/` | diffs for third-party sources pinned in `deps.lock` | | `platform/ps3/` | PS3 platform code | | `tools/` | build, mirror/patch and dependency scripts | ## Building (milestone 0) Linux host. Folder layout expected by the scripts: ``` /dusklight TwilitRealm/dusklight at 77705f8, with its aurora/borealis submodules /toolchain/ps3dev PS3DK release tarball ps3dev-ppu.tar.xz, extracted /DuskOnPS3 this repository ``` ```bash git clone https://github.com/TwilitRealm/dusklight && git -C dusklight checkout 77705f8 \ && git -C dusklight submodule update --init extern/aurora extern/borealis mkdir -p toolchain && gh release download v0.29.0 -R FirebirdTA01/PS3DK -p ps3dev-ppu.tar.xz -D toolchain \ && tar -xJf toolchain/ps3dev-ppu.tar.xz -C toolchain cd DuskOnPS3 ./tools/fetch_deps.sh ../work/deps # pinned third-party sources (deps.lock) + patches/deps ./tools/sync_src.sh # mirror Dusklight into ../work/src and apply patches/ ln -sfn ../../work/src/dusklight external/dusklight ./tools/ps3_build.sh build-ps3 # compiles the game libraries (milestone 0) ``` ## Built on melee-ps3 [**Mayo1970/melee-ps3**](https://github.com/Mayo1970/melee-ps3), the native PS3 port of Super Smash Bros. Melee, is the main PS3-side foundation of this project. Its author recycled a GameCube emulator proof of concept into a GX/Gekko layer for the PS3: a GP thread that decodes the GameCube FIFO (CP, XF and BP registers) and an RSX backend behind a small interface (`GpBackend`: draw, EFB copy, TLUT load, present), with TEV → RSX fragment/vertex program generation at run time (`tevgen`, `fpgen`, `vpgen`, `xfgen`), vertex conversion on an SPU, SPU audio, and DualShock 3 / GameCube adapter input. Plan for DuskOnPS3: - **Milestone 2 (graphics):** start from melee-ps3's GP decoder and RSX backend, fed by Aurora's GX FIFO, and extend it for what Twilight Princess needs and Melee does not (indirect texturing, TEV compare, more EFB copy and texture formats). - **Milestone 3 (input, audio):** DualShock 3 mapping from melee-ps3's pad code; Dusklight's DSP mixer moved to an SPU the way melee-ps3 runs its audio. melee-ps3 is GPL-2.0, so DuskOnPS3 is GPL-2.0 too since its code came in (milestone 2); it is credited in NOTICE. Thanks to Mayo1970 for pointing this project at it. ## References These are the projects this port builds on or learns from. Mapping them was the first step. **Game base** - [zeldaret/tp](https://github.com/zeldaret/tp): the Twilight Princess decompilation. - [TwilitRealm/dusklight](https://github.com/TwilitRealm/dusklight): native build of the decompilation. - [encounter/aurora](https://github.com/encounter/aurora): source-level GameCube/Wii compatibility layer. **Other Dusklight ports** - [NathanKneT/DuskOnVita](https://github.com/NathanKneT/DuskOnVita): PS Vita port. The model for this repository's layout, patch workflow and heap bounds; some build files are adapted from it (MIT). - [Yannis100/tp-vita](https://github.com/Yannis100/tp-vita): Vita port keeping Aurora's GX command processor with a vitaGL backend. - [griches/PS5_Dusklight](https://github.com/griches/PS5_Dusklight), [HayatoG/dusklight](https://github.com/HayatoG/dusklight) (Switch). **PS3 ports of decompiled games** - [Mayo1970/melee-ps3](https://github.com/Mayo1970/melee-ps3): Melee (GameCube) on PS3. **The PS3 foundation of this project** (see [Built on melee-ps3](#built-on-melee-ps3)). - [MattyKen619/Pikmin-PS3-Port](https://github.com/MattyKen619/Pikmin-PS3-Port): Pikmin (GameCube) on PS3, full game at 30 FPS on hardware. - [Gadega/ship-of-gadeguion](https://github.com/Gadega/ship-of-gadeguion): Ship of Harkinian (OoT) on PS3. - [rooklz/mkwps3](https://github.com/rooklz/mkwps3): Mario Kart Wii recompiled for PS3. **PS3 toolchain and libraries** - [FirebirdTA01/PS3DK](https://github.com/FirebirdTA01/PS3DK): modern SDK, GCC 16 with C++20 on the PPU. The toolchain used here. - [ps3dev/PSL1GHT](https://github.com/ps3dev/PSL1GHT), [ps3dev/ps3toolchain](https://github.com/ps3dev/ps3toolchain), [ps3dev/ps3libraries](https://github.com/ps3dev/ps3libraries), [02900/ps3-toolchain](https://github.com/02900/ps3-toolchain). - [ricowp81/rsxkit](https://github.com/ricowp81/rsxkit), [ricowp81/spukit](https://github.com/ricowp81/spukit), [ricowp81/Salsa64](https://github.com/ricowp81/Salsa64): RSX and SPU building blocks. - [gzorin/rsxgl](https://github.com/gzorin/rsxgl), [nbe1233/raylib-ps3](https://github.com/nbe1233/raylib-ps3): OpenGL on the RSX (fallback route). - [utkuhalis/ps3-homebrew](https://github.com/utkuhalis/ps3-homebrew), [helworks/helengine-ps3](https://github.com/helworks/helengine-ps3): homebrew written directly against the RSX. **Testing and analysis** - [RPCS3/rpcs3](https://github.com/RPCS3/rpcs3): PS3 emulator (reference; this project tests on real hardware). - [NationalSecurityAgency/ghidra](https://github.com/NationalSecurityAgency/ghidra), [LaurieWired/GhidraMCP](https://github.com/LaurieWired/GhidraMCP), [sp00nznet/ps3recomp](https://github.com/sp00nznet/ps3recomp), [DohmBoy64Bit/ps3-recomp-Agent-SKILL](https://github.com/DohmBoy64Bit/ps3-recomp-Agent-SKILL): PS3 binary analysis and recompilation (the opposite direction; useful for debugging). ## Contributing Anyone interested in PS3 development, reverse engineering, graphics programming or testing on real PS3 hardware is welcome. Open an issue or a pull request. ## License GPL-2.0 (see [LICENSE](LICENSE)), because DuskOnPS3 includes melee-ps3's GPL-2.0 code. Parts that came from MIT-licensed projects keep their notices in [NOTICE](NOTICE) and [LICENSES/](LICENSES). Dusklight and the other projects keep their own licenses. No game assets are included.