A WIP matching decompilation (aiming for logical matching decompilation of individual functions as opposed to raw matching of the entire binary... for now) of The Sims 2 (Bon Voyage update, PowerPC Mac OS X port).
Very barebones, and no function is matching yet. See the bash and python scripts.
Extract a clean ppc executable of the game (see the sha1 file for the hash) from a universal binary of BV's Mac OS X port, dated December 17, 2007, and place it in the root folder as "baserom.ppc".
To generate an asm file, type python3 tools/mach-disasm.py baserom.ppc baserom.sym > asm/sims2.s
.
To generate an asm file that mips_to_c can read, type python3 tools/mach-disasm_m2c-support.py baserom.ppc baserom.sym > asm/sims2.new-syntax.s
.
- A special cross-compiler version of Apple's version of GCC 4.0.1 (https://github.com/ChrisNonyminus/powerpc-darwin-cross/releases/download/initial/powerpc-darwin-cross.new.zip).
- build-essential, probably
- Python 3.6 or higher.
- Python dependencies:
python3 -m pip install --user colorama watchdog python-Levenshtein capstone macholib
- binutils-powerpc-linux-gnu.
- Pick a function from the generated asm file (must not be the mips_to_c-compatible version).
- Extract that function into its own file, to be placed as
tmp/orig.s
. - Create a cpp file and place it as
tmp/code.cpp
. - In a linux shell, type and enter
COMPILER_FLAGS="-O4" FUNCTION=<symbol name of function> COMPILER_PATH=<path to gcc cross-compiler> ./auto_assemble_tmp_code.sh
. - In a seperate text editor, edit and save
tmp/code.cpp
or the generated filetmp/compiler_flags.txt
, while the script loops. (It loops so the code can automatically be compiled every time it's changed.) - View
tmp/diff.txt
. - Repeat steps 5 and 6 until a function is matching.
- asm_differ (https://github.com/simonlindholm/asm-differ)