/cv64

Decompilation of Castlevania for the Nintendo 64

Primary LanguageC

Castlevania Decompilation

Discord Castlevania 64 - Research Spreadsheets TCRF - Castlevania (Nintendo 64)

Acknowledgements

Tools

These tools are instrumental in the decompilation process of Castlevania 64.

People

These people make this project possible and successful.

Getting started

Requirements

  • Your own (legally obtained) copy of Castlevania for the Nintendo 64 (USA v1.0) (sha1: 989A28782ED6B0BC489A1BBBD7BEC355D8F2707E)
  • CMake
  • Git
  • Make/Ninja

Docker

There is a Dockerfile for convenience. If you want to have your development environment on your system, continue to Linux or Windows.

Note

You may need to prefix docker commands with sudo if your user is not part of the docker user group.

You can build the Docker image as follows.

docker build . -t c64

And then, you can interactively spin up a docker container.

docker run --rm -ti -v $(pwd):/c64 c64

Linux (Debian/Ubuntu offshoots)

  • build-essential
  • binutils-mips-linux-gnu
  • python3/pip3 (I recommend managing this through mise)

Windows

  • MinGW

Building

Warning

If the compilation process fails, go to the castlevania.yaml file and set the option dissasemble_all to True, then clean and build again. It should then end up with an error. At this point, change said option back to False, clean and build again and the project should build successfully.

Place a Castlevania 64 (USA v1.0) ROM in the root of the project, and rename it to baserom.z64.

Now, you must configure the CMake project by running the following...

cmake -S . -B build -G "Ninja"

Tip

Or run mise run c if you are already using mise

The above snippet produces a Ninja-based build system under the hood. This seems to be faster than Make, but if you still prefer Make over Ninja, you can run the following...

cmake -S . -B build -G "Unix Makefiles"

Afterwards, to build the project, run the following...

cmake --build build

Tip

Or run mise run b if you are already using mise

Cleaning

Run the following to clean up the build artifacts.

./scripts/clean

Tip

Or run mise run cl if you are already using mise

Context generation

You can generate a ctx.c context file for use with mips2c or decomp.me. This will contain all headers within a given source file

python3 ./tools/m2ctx.py <your_C_file>

Tip

Or run mise run ctx -- <your_C_file> if you are already using mise