Skip to content

About

Matching decompilation of Battle Stadium D.O.N (PS2, SLPS-25675). No game files included

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Battle Stadium D.O.N decompilation

A matching decompilation of Battle Stadium D.O.N (PlayStation 2, 2006): C source that, compiled with the original toolchain, rebuilds the game's executable byte for byte.

This repository contains no game material. No executable, no disc files, no disassembly, no assets. You need your own copy of the game, and every tool here reads it from your machine.

Target version

Game Battle Stadium D.O.N (バトルスタジアム D.O.N), Japan only
Serial SLPS-25675, SYSTEM.CNF VER = 1.02
Executable SLPS_256.75 (3,973,040 bytes)
SHA-256 994e840123eb5a4cd5d13170a52fdca275dabb0a9f4585665b5d0fc67f9180c1
SHA-1 024eda75fb453d8e644ec4d9a3962bc2249a1110

The fan English patch does not change the executable, so a patched disc works too.

Status

The executable rebuilds identically. 141 / 2,039 functions of the game's own code (6.9%) are in C and match.

Segment Range Compiler Built from
Sony SDK 3.0 0x100000–0x1303C8 EE-GCC asm
Game 0x1303C8–0x255C40 MWCC C where decompiled (src/game/), asm elsewhere
Sony libmtap, CRI cvFs and other libraries 0x255C40–0x285128 EE-GCC asm
RenderWare 3.7 0x285128–0x30C2B0 – asm
CRI middleware, libmpeg 0x30C2B0–0x350090 – asm
C runtime and math 0x350090–0x3902D4 – asm
Data, bss 0x3902D4–0x5A6800 – asm

Only the game's own code is a decompilation target; the libraries are third-party code. The end of the game code is approximate (somewhere in 0x24FE40–0x255C40).

Toolchain

  • Game code: Metrowerks CodeWarrior PS2 mwcps2-3.0.1b145-050209 or 3.0.1b151-050317 (both match every function so far; this project builds with b151), flags -O4,p -sdatathreshold 0. The string MW MIPS C Compiler (2.4.1.01) in the ELF comes from the linker and is the same across many CodeWarrior releases. Other builds were measured against the matched functions: the compiler of Splashdown (2.4-001213) matches 1 of 30.
  • Library code at 0x255C40+: EE-GCC 2.95.3-136, -O2 -G0 (identified, not a target).
  • How each was identified, and every build problem met on the way: NOTES.md.

Setup

macOS (Apple silicon) or Linux x86-64, Python 3.10+.

tools/setup.sh                       # Python env, wibo, MIPS binutils, MWCC PS2 compilers
cp /path/to/your/disc/SLPS_256.75 iso/
tools/split.sh                       # splat: asm/, assets/, src/game.c (all git-ignored)
.venv/bin/python tools/build.py      # prints OK and the SHA-1 when the build matches

How it works

  • don.yaml tells splat how to cut the ELF. Every game function becomes asm/nonmatchings/game/<name>.s.
  • tools/build.py assembles the libraries and data and builds the game segment one function at a time: a function with src/game/<name>.c is compiled with MWCC (aligned and padded to its original size, its jump tables and other .rodata placed where the original data was); the rest is assembled. The pieces are linked in the original order with splat's linker script and the result is compared with your executable.

Contributing

See CONTRIBUTING.md: run the agent loop with your own Claude plan on a shard of the remaining functions, decompile by hand, or document what is matched.

Decompiling a function

  1. Pick a function in asm/nonmatchings/game/.
  2. Write src/game/<name>.c with the same name, including common.h. Plain C only: no asm, no #pragma, no register pinning.
  3. Run tools/build.py. OK means it matches; MISMATCH gives the first differing address.
  4. tools/agent_loop/check.py <name> <file.c> <work_dir> compiles one function and shows a side-by-side diff with the original, without a full build.

Use of AI

Most functions in src/game/ were written by Claude agents (Claude Opus 5.5 and Claude Fable 5.2) running tools/agent_loop/run.py: one headless Claude Code session per function, limited to writing its own C file and running the checker. No function is accepted on the agent's word. The harness checks every one itself, and only a byte-identical full build counts as a match. asm, #pragma and register pinning are rejected, and sessions stop after 30 checks or 12 checks without progress.

Measured so far (results/):

Run Model Functions Matched Cost (API-equivalent)
run1 (50 random) Opus 5.5 42 game functions 39 (93%, after a build fix) $28.60
run2 (all remaining, random order, in progress) Fable 5.2 120 97 (81%) $132.97

Functions decompiled by hand should say so in their commit.

Credits

Built on splat, spimdisasm, wibo, the decompals binutils and the compilers collected by decomp.me. The research of battlestadium-don (memory map, library ranges, function map) made this much faster.

License and legal notice

Code under the MIT license (LICENSE). Battle Stadium D.O.N and its characters belong to their owners; this project is not affiliated with them and does not distribute any of their material. No Sony SDK source, headers or samples are used.

About

Matching decompilation of Battle Stadium D.O.N (PS2, SLPS-25675). No game files included

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages