Skip to content

PlayStation 2 MDEBUG (pre-DWARF v1) symbols extraction utility and code function matcher.

License

Notifications You must be signed in to change notification settings

felinis/CodeMatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeMatcher

PlayStation 2 MDEBUG (pre-DWARF v1) symbols extraction utility and code function matcher.

Setup

Follow these steps to setup the PS2 EE compiler in order to run CodeMatcher.

Windows

  1. Download the PS2 EE compiler from: https://archive.org/download/SNSystemsProDGPs2/ProDGPs2usrLocalSceFiles.zip

  2. Extract it to your C:/ drive so that the path looks like: C:/usr/local/sce/....

Linux

  1. Download the PS2 EE compiler from https://archive.org/download/SNSystemsProDGPs2/ProDGPs2usrLocalSceFiles.zip

  2. Extract it and move the /usr dir to ~/.wine/drive_c. It will not work if you move it to your /usr dir.

  3. Install wine with sudo apt-get install wine-stable.

Usage

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.

Compile & compare source tree

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.

Match object file

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.

Dump symbols

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.

How to build

Linux setup

sudo apt install cmake libboost-all-dev

Windows setup

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

Building

Clone the repository and run the following commands

cd CodeMatcher
mkdir build
cd build
cmake ..
cmake --build .

Images

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.

image first_match code_matcher_output

About

PlayStation 2 MDEBUG (pre-DWARF v1) symbols extraction utility and code function matcher.

Resources

License

Stars

Watchers

Forks

Packages

No packages published