# Xenosaga Episode III — Complete Decompilation

**10,317 functions. Zero gaps.** This package is a complete, annotated C
decompilation of every executable in *Xenosaga Episode III: Also sprach
Zarathustra* (SLUS-21389, USA) — the main executable and all three overlay
binaries, produced from an original retail disc.

| Binary | What it is | Functions |
|---|---|---:|
| `SLUS_213.89` | Main executable — engine, field, menus, AV middleware | 8,626 |
| `OV01.OVL` | Credits / menu loader overlay | 21 |
| `OV02.OVL` | Battle system overlay (the big one) | 1,301 |
| `OV04.OVL` | Bonus/debug overlay — cheat codes, photo mode, stage challenges | 369 |

Every function decompiles end-to-end: there are **no truncated bodies**
anywhere in this release (earlier efforts stalled at 62%, then 97.9% — see
*How it was made* below). 223 functions carry their original names recovered
from error strings; ~900 are annotated with every string literal they
reference; ~60 of the original source files (`.euc.c`) are identified by name.

## What's in the package

```
decompiled/
├── README.md            full technical documentation + notable findings
├── slus/                main executable
│   ├── functions/       one .c file per function (annotated)
│   ├── all.c            everything concatenated, address order
│   ├── symbol_map.txt   address → name → size
│   ├── strings.txt      every string + where it's referenced
│   └── vutext.s         the VU1 rendering microcode, disassembled
├── ov01/  ov02/  ov04/  the three overlays, same layout
├── symbol_map.txt       merged map across all four binaries
└── pipeline/            every script used to produce this, reusable
                         for any PS2 EE ELF
```

Companion docs in this folder:

- **[FUN-FACTS.md](FUN-FACTS.md)** — the weird and wonderful things the code revealed
- **[HOW-THE-CODE-WORKS.md](HOW-THE-CODE-WORKS.md)** — engine architecture tour
- **[FILETYPE-INDEX.md](FILETYPE-INDEX.md)** — every file format on the disc
- **[GOALS.md](GOALS.md)** — why this exists and where it's going

## How it was made

Ghidra 12.0.4 with the
[ghidra-emotionengine-reloaded](https://github.com/chaoticgd/ghidra-emotionengine-reloaded)
extension (R5900 MMI + VU0-macro instruction support), plus two pieces of
original tooling:

1. **Cross-module sibling mapping** — the overlays bank-switch into a shared
   memory window and call back into the main executable constantly. Analyzed
   in isolation, those calls point into unmapped memory and the decompiler
   gives up (this was the cause of *every* residual truncation — 210 of
   them). Each binary is therefore re-imported with its sibling's code mapped
   into the program before analysis, so cross-module flow resolves natively.
   This also *discovered ~140 functions* earlier passes missed.
2. **A standalone VU disassembler** (derived from PCSX2's debugger, GPL-3.0)
   for the 8 KB of VU1 microcode the game stages inside the executable.

The full pipeline — download-to-decompile — is in `pipeline/` and documented
in the package README. It is generic: point it at any PS2 EE ELF.

## Provenance & legal

Produced from a legally owned retail disc using the open-source
[Xenosaga3PythonExtractor](https://github.com/LinuxJessi/Xenosaga3PythonExtractor).
This package contains **no game assets, no ROM, no playable code** — it is
machine-generated analysis output (pseudo-C, symbol tables, string indexes)
shared for study, preservation, and fan-research purposes, in the same spirit
as the community's long history of Xenosaga tooling. Don't sell it; don't
pass it off as Namco's source code (it isn't — the original source remains
lost to time and EUC-JP encoding).

*Godsibb.net — June 2026*
