Luke Street b5d3b8c059 Another round of GCC fixes (#3115)
* Fix remaining <string> -> <cstring> for GCC compilation (#3114 follow-up)

MWerks' <string> header transitively includes C string functions
(memcpy, strlen, strcmp, etc.), but GCC/Clang's <string> is the C++
std::string header. These files all use C string functions and should
include <cstring> instead.

* Use std::isnan instead of isnan for GCC compilation

GCC's <cmath> places isnan in the std namespace. Using the unqualified
isnan fails to compile with GCC/Clang.

* Fix cCcD_Src types: s32 -> u32 for bitmask fields

cCcD_SrcObjCommonBase::mSPrm, cCcD_SrcObjTg::mType, and
cCcD_SrcObjAt::mType are used as bitmasks (SetType/SetSPrm take u32,
MskType/MskSPrm use u32, values like 0xFFFFFFFF are common in
aggregate inits). Change from s32 to u32 to match usage.

Also fix AT_TYPE_WOLF_ATTACK/AT_TYPE_UNK to use unsigned literals,
and remove now-unnecessary (s32) casts on hex literals in collision
source data.

* Mark dummy() functions as static to avoid multiple definition errors

These decomp artifact functions have the same name and signature across
TUs, causing linker errors when building as a single binary.
2026-02-28 13:35:07 -08:00
2024-06-10 00:34:52 -07:00
2026-02-28 13:35:07 -08:00
2024-10-10 08:29:58 -06:00
2024-10-10 08:29:58 -06:00
2024-11-13 13:50:44 -08:00
2026-02-20 02:53:27 -08:00
2024-10-10 08:29:58 -06:00
2023-07-25 17:22:44 -04:00

The Legend of Zelda: Twilight Princess

Build Status Discord Badge GZ2E01 GZ2P01 GZ2J01 ShieldD

A work-in-progress decompilation of The Legend of Zelda: Twilight Princess.

The code for the GameCube releases is completely matching. However, not every Translation Unit (TU) has been linked yet. Work is continuing by aligning the Debug version and getting the Wii versions to match. All versions are built from the same codebase using conditional compilation.

Important

This repository does not contain any game assets or assembly whatsoever. An existing copy of the game is required.

This project itself is not, and will not, produce a port, to PC or any other platform. It is a decompilation of the original game code, which can be compiled back into a binary identical to the original.

A visual

The project can target the following supported versions:

  • GZ2E01: GameCube - North America
  • GZ2P01: GameCube - Europe/Australia
  • GZ2J01: GameCube - Japan
  • RZDE01_00: Wii - North America (Rev 0)
  • RZDE01_02: Wii - North America (Rev 2)
  • RZDP01: Wii - Europe/Australia
  • RZDJ01: Wii - Japan
  • DZDE01: Wii - North America (Kiosk Demo)
  • Shield: Nvidia Shield - China
  • ShieldD: Nvidia Shield - China (Debug Version)

More information about the project can be found here: https://zsrtp.link

Dependencies

You will need the following dependencies:

  • git
  • ninja
  • python3
  • clang-format (optional)

Windows

On Windows, it's highly recommended to use native tooling. WSL or msys2 are not required.
When running under WSL, objdiff is unable to get filesystem notifications for automatic rebuilds.

  • Install Python and add it to %PATH%.
  • Download ninja and add it to %PATH%.
    • Quick install via pip: pip install ninja

macOS

  • Install ninja:

    brew install ninja
    

wibo, a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.

Linux

wibo, a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.

Building

  • Clone the repository:

    git clone https://github.com/zeldaret/tp.git
    
  • Copy your game's disc image to orig/GZ2E01.

    • Supported formats: ISO (GCM), RVZ, WIA, WBFS, CISO, NFS, GCZ, TGC.
    • After the initial build, the disc image can be deleted to save space.
  • Configure:

    python configure.py
    

    To use a version other than GZ2E01 (GCN USA), specify it with --version.

  • Build:

    ninja
    

Diffing

Once the initial build succeeds, an objdiff.json should exist in the project root.

Download the latest release from encounter/objdiff. Under project settings, set Project directory. The configuration should be loaded automatically.

Select an object from the left sidebar to begin diffing. Changes to the project will rebuild automatically: changes to source files, headers, configure.py, splits.txt or symbols.txt.

objdiff application window

Contributing

If you've got all the requirements set up and want to learn how to contribute to the decompilation effort, join our Discord server and check out our contribution guide.

S
Description
No description provided
Readme 370 MiB
Languages
C++ 53.6%
C 45.4%
Python 0.4%
POV-Ray SDL 0.3%
Pawn 0.3%