Progress
How much of the game is decompiled, and every unit. A function counts only when its source compiles to the original bytes. That source is C, apart from the VU0 routines (file-scope assembly in src/vu0_asm.c and src/vu0_asm2.c) and single hardware instructions inline in C. Numbers come from the project's report, generated 2026-11-16.
- CODE20.19%
- FUNCTIONS70.1%
- FUZZY20.35%
- DATA0.11%
- UNITS142 / 154
Categories 2
Recent commits
- 4e9181dAI.md: session 32 notes2026-11-16
- 95cca53Match sceSifResetIop (0x2ed9a0) and 0x2cb268, reach 20.19%2026-11-16
- 04c6237Match sceSifInitCmd, sceSifInitRpc, 188b88, 2cb108, 29ff70, reach 20.16%2026-11-16
- 231c794AI.md: session 31c notes and open near misses2026-11-15
- bd17c62Match rsound 0x10c168 and 0x10c690, reach 20.08%2026-11-15
- fae32c4Match sound event handler 0x2d3190, reach 20.05%2026-11-15
How the matches were made
Matched functions by origin. Every one compiles to the original bytes; all are C except the libvu0 routines, which are assembly.
- 2,471 hand-written C
- 1,090 generated from instruction patterns
- 825 Ghidra output that already matches
Units
Each rectangle is one unit (a source file of the original game, or a block of code between known files). Its area is the unit's code size; the colour is how much of it is matched. Hover for details, click or press Enter for the full card.
Show as a table
| Unit | Functions | Matched bytes | Matched |
|---|
Milestones
- Identify the compiler doneThe game's code was built with
ee-gcc 2.9-ee-991111-01,-O2 -G8. 4,385 functions now compile byte-identical with it. - Rebuild the executable doneThe whole
.textis split per source file and rebuilt; the result matches the original byte for byte. - Match functions in C in progressEach function is rewritten until it compiles to the same bytes, then switched over to C. Right now 20.19% of the code and 70.1% of the functions are done.
Format tools
Besides the code, the repository contains Python tools that read the game's data from your own disc image. None of the game's files are included.
| Tool | What it does |
|---|---|
fs_tool.py | List and extract the game's archive straight from the ISO |
lzss.py | Decompress .lzs files and archives |
pac_tool.py | Split .pac map packages into chunks |
tex_tool.py | Convert texture sets to PNG |
tmd_tool.py | Convert .tmd models to Wavefront OBJ |
adpcm.py, sq2mid.py | Audio streams to WAV; music sequences to MIDI |
battle_script.py | Battle script opcode reference and viewer |
mov_tool.py, efp_tool.py, msg_tool.py | Animation clips, effect packs, message containers |
pss_demux.py | Split the movie file into video and audio |
Format notes are in the docstring at the top of each tool in tools/.
Setup
You need Python 3, Clang, LLD (ld.lld), the game's compiler ee-gcc 2.9-ee-991111-01 (from decomp.me's compiler archive) and your own Legaia 2: Duel Saga (PAL) disc image.
Linux
git clone https://github.com/WeAreTommyBruh/Legaia2-Decomp.git
mkdir -p ~/tools/ee-gcc2.9-991111-01
curl -L https://github.com/decompme/compilers/releases/download/compilers/ee-gcc2.9-991111-01.tar.xz \
| tar xJ -C ~/tools/ee-gcc2.9-991111-01
The compiler is a 32-bit Linux program. On a 64-bit system install the 32-bit runtime libraries first (Debian/Ubuntu shown):
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386
Then put the disc image in the repository root as SLES_50891.ISO and rebuild the executable:
python3 tools/asm_build.py all # rebuild + byte-identical check; the last line must say MATCH
python3 tools/report.py # report/report.json, the numbers on this page
Windows
Install WSL (wsl --install) with Ubuntu or Debian, then follow the Linux steps.
About
This project is written almost entirely by AI. I check nearly everything myself to make sure there is nothing wrong.
Reverse engineering and matching decompilation take a long time: expect many months, possibly a year. There is no rush, so the project will be finished when it is finished.
The project was made by WeAreTommyBruh.
Legal
This project is not affiliated with or endorsed by the game's original developers or publisher. The character artwork on this page belongs to its respective owners.