A decompilation project for Vagrant Story for PlayStation 1, with a goal of enabling interoperability with modern hardware and fixing bugs in the original game.
This project does not contain any of the original files from the game disk, you must own a copy of the game.
Many thanks to the Chrono Cross Decompilation for much of the sound library code.
Heavily inspired by and indebted to the incredible work of the sotn-decomp team and the PS1/PS2 decompilation Discord server.
Grateful to the authors of Data Crystal’s Vagrant Story page for their excellent work and insights.
Thanks also to the following amazing projects (and their dependencies):
Almost the entirety of the game's menu code and data is decompiled, including all files in MENU and SMALL, with the exceptions of MENU/MCDATA.BIN, MENU/OPMCIMG1.BIN and MENU/OPMCIMG2.BIN, and one function each in MENU9.PRG and MENUF.PRG.
Much of the menu code has been refactored and is readable, and the menu executables are completely relocatable. It should be possible to rewrite the menu code arbitrarily, the method and data addresses in other modules will be relinked appropriately.
Due to the presence of a large number of empty sectors at the start of each directory on the disk, it should also be possible to rebuild the disk without affecting sector-based data loading in BATTLE.PRG, as long as the number of dummy sectors is adjusted accordingly.
- Fork the project
- Install system dependencies and copy disk image (see "Setup" below)
- Run
make -jto perform an initial split & build - Pick a function to decompile, use
make decompmeto create a scratch on decomp.me - Claim and decompile the scratch
- Copy the decompiled code where it belongs
- Optionally use
make permuteif needed - Run
make remake -j, and finallymake formatif the code compiles successfully - Open a PR
The project is mostly self-configuring but requires a minimal amount of setup.
- Make sure the following packages are installed, older versions may also work but this is not tested. This configuration works as-is on Ubuntu 24.04 on WSL; depending on your distro you may need additional packages.
| Package | Minimum Version |
|---|---|
| clang-format | 18.1.3 |
| cmake | 3.28.3 |
| docker-buildx | 29.1.3 |
| g++ | 13.3.0 |
| gcc-mipsel-linux-gnu | 12.4.0 |
| make | 4.3 |
| python3 | 3.12.3 |
| python3-venv | 3.12.3 |
| rustup | 1.26.0 |
- If you do not use your own docker configuration, set docker permissions with
sudo usermod -aG docker $USER, then log out and back in again - Run
rustup default stableif you do not already have a local rust environment set up - Dump your original disk to
disks/SLUS-01040.bin - Run
make -jto finish installation and perform an initial build
A flake is also provided for users on Linux or macOS who prefer a pinned dev shell instead of installing the packages above. With Nix (flakes enabled), run nix develop in the repo to enter a shell with the full toolchain available, then make -j as usual. See flake.nix for details.
make -jshould be all that is needed most of the time. The first execution will configure the remaining dependencies in thetoolsdirectory and extract the files from the disk; from then on it will perform a minimal rebuild.make decompme TARGET=path/to/nonmatchings/source.suploads the target function to a new decomp.me scratch.make permute TARGET=path/to/nonmatchings/source.sinvokes the permuter for the target assembly file.make remake -jwill delete and re-split the targets; this can be necessary if the dependency management has failed to identify everything that needs rebuilding (in which case a bug report is appreciated!), or if the configuration has changed enough to be no longer valid (e.g. orphaned .d files). It's good practice to run this before submitting a pull request to make sure everything still works.make formatformats the source files and symbol addresses for consistency. Please run this before submitting a PR.make cleansimply deletes thebuildandnonmatchingsdirectoriesmake clean-allwill completely reset the project, including dropping any source changes and data files (but not the disk image). Use with caution.