This is an example repo of showing how to do what I refer to as precomp, which is using an in-progress decomp project as a source of symbols for traditional binary hacking.
The process involves taking the elf file generated from an in-progress decomp and using it in conjunction with ld to be able to write assembly and C (and C++ for the especially brave) that references symbols from the decomp. It also allows you to write jump hooks that reference offsets from decomp symbols/segments, allowing you to specify instructions to overwrite without needing to deal with converting between RAM and ROM addresses. Using ld also ensures that source files are linked against the correct RAM address.
This example is that of a hack for "Rocket: Robot On Wheels" that adds a simple sound test to the game. Press left or right on the D-Pad to swap between sounds, press up to play the selected sound and press down to stop a currently running sound.
This repo targets the modern N64 SDK by CrashOveride95 (https://crashoveride95.github.io/n64hbrew/modernsdk/startoff.html) but can easily be modified to use the regular mips-linux-gnu if you prefer by changing CROSS
in the makefile and setting up the right flags for gcc.
To build this, you will need to build the corresponding decomp (https://github.com/RocketRet/Rocket-Robot-On-Wheels). Place the elf file generated by that project into a folder named elf
in the root of this project, then run make
.