Sonic Advance 2 (USA)
This is a work in progress matching decompilation of Sonic Advance 2
It so far builds the following ROM:
- sa2.gba
sha1: 7bcd6a07af7c894746fa28073fe0c0e34408022d
Current state
- Assembly code extracted, disassembled, and somewhat categorised
- All libraries decompiled to C or referenced from
agbcc - Initialisation of game state, main task logic, save game logic, nearly all UI, Multiplayer code, Special Stage
- All songs have been extracted, and documented as matching MIDI files
- ⚠️ The build is not yet shiftable, meaning all significant code modifications will cause the rom to crash
Setting up the repository
Provide assets
You must have a copy of the Sonic Advance 2 (USA) ROM named baserom.gba in the repository directory.
Dev container
If you use vscode then consider using the provided Dev Container which skips the requirement for any setup.
Install build requirements (without dev container)
On Linux systems
sudo apt install binutils-arm-none-eabi gcc-arm-none-eabi libpng-dev
On MacOS and Windows install devkitARM
Install agbcc into the repo
Clone the agbcc repo into another folder
Inside the agbcc repo and run ./build.sh and then install the compiler in this repo ./install.sh path/to/sa2
Build the rom
On Linux and MacOS, run make in the root of the repo to build.
On Windows you can build using make in the MSYS environment provided with devkitARM.
This command will also build all the required tooling in the tools directory.
The tools directory contains a bunch of tooling (built by pret) which is used to build assets and create a matching rom.
If the rom built successfully you will see this output
sa2.gba: OK
Code formatting
All C code in this repo is formatted with clang-format-13. If using the Dev Container this is installed automatically.
To format code run make format
Notes
- The Kirby & The Amazing Mirror decompilation uses a very similar codebase, as it was written by the same dev team (Dimps)
- https://decomp.me is a great resource for helping to create matching functions
ldscript.txttells the linker the order which files should be linked- For more info, see the FAQs section of TMC
Credits
- Special thanks to @normmatt for the initial repo setup and sounds decompilation
- Shout out to @froggestspirit for the drive to set this project up
- Pokemon Reverse Engineering Team for their help with the project, and tooling for GBA decompilations
- Kermalis for their tool which was used to dump the game midis
- 琪姬 for their exellent work documenting all the quirks of matching midis