PlayStation 2 MDEBUG (pre-DWARF v1) symbols extraction utility and code function matcher.
Follow these steps to setup the PS2 EE compiler in order to run CodeMatcher.
-
Download the PS2 EE compiler from: https://archive.org/download/SNSystemsProDGPs2/ProDGPs2usrLocalSceFiles.zip
-
Extract it to your
C:/
drive so that the path looks like:C:/usr/local/sce/...
.
-
Download the PS2 EE compiler from https://archive.org/download/SNSystemsProDGPs2/ProDGPs2usrLocalSceFiles.zip
-
Extract it and move the
/usr
dir to~/.wine/drive_c
. It will not work if you move it to your/usr
dir. -
Install
wine
withsudo apt-get install wine-stable
.
Prepare the ELF of the PS2 game you would like to code match, and your decompiled source code or object files to match against. Then you can use one of the following modes of operation.
CodeMatcher <elf_file> --compile <source_tree_path>
CodeMatcher will invoke the PS2 EE compiler on your source tree and match it with the corresponding functions in the ELF file. It will show you which functions match and which ones don't.
CodeMatcher <elf_file> --match <object_file>
CodeMatcher will match the object file with the corresponding functions in the ELF file. It will show you which functions match and which ones don't.
CodeMatcher <elf_file> --dump
CodeMatcher <elf_file> --dump > output.txt
CodeMatcher will dump the symbols from the ELF file to stdout, or to the specified file.
sudo apt install cmake libboost-all-dev
It is recommended to use a package manager like Chocolatey to install the required packages, otherwise you will have to build Boost yourself.
choco install cmake boost
Clone the repository and run the following commands
cd CodeMatcher
mkdir build
cd build
cmake ..
cmake --build .
These examples show the code matching process for the game "Sly Cooper and the Thievius Raccoonus", whose prototype contains STABS/MDEBUG debug symbols. I got a few functions matching, but there is still a lot of work to do.