Decompilation of The Legend of Zelda: Majora's Mask
Go to file
Maide 7ea2474b71
En_Kujiya (#757)
* En_Kujiya

* En_Kujiya

* PR
2022-03-29 21:21:56 +01:00
.github CONTRIBUTING.md (#157) 2021-05-20 21:06:30 -04:00
assets En_Test (#756) 2022-03-29 21:14:29 +01:00
docs Update Readme (#765) 2022-03-29 16:19:59 +01:00
include Obj_Pzlblock (#755) 2022-03-29 21:05:33 +01:00
src En_Kujiya (#757) 2022-03-29 21:21:56 +01:00
tools En_Test (#756) 2022-03-29 21:14:29 +01:00
.clang-format Adds clang-format script to MM 2020-07-24 19:57:54 -04:00
.clang-tidy Adds clang-format script to MM 2020-07-24 19:57:54 -04:00
.gitattributes Fixes IDO recomp and allows git to detect binary files. (#50) 2021-02-25 18:21:51 -05:00
.gitignore z_object_switch OK (#527) 2022-03-10 05:49:11 -05:00
checksum_uncompressed.md5 Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
checksum.md5 QOL addtions to the readme (#104) 2021-05-18 18:39:08 -04:00
CONTRIBUTING.md Updates contributing.md and reviewing.md for the new reservation board. (#402) 2021-11-03 11:27:48 -03:00
diff_settings.py Remove .mdebug sections by default (#313) 2021-09-25 09:36:15 -04:00
diff.py diff.py symlink and graphovl.py (#151) 2021-05-18 22:21:14 -04:00
extract_assets.py Building on Macs (#513) 2021-12-28 01:07:41 +00:00
first_diff.py Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
fixle.sh Update tools (#16) 2020-09-13 21:09:13 -04:00
format.sh Building on Macs (#513) 2021-12-28 01:07:41 +00:00
Jenkinsfile Script for checking relocs correctly updated on spec (#718) 2022-03-24 21:25:41 -03:00
Makefile z_sram_NES with 2 NON_MATCHINGs and 1 NON_EQUIVALENTs (#531) 2022-03-27 12:37:02 -03:00
README.md Update Readme (#765) 2022-03-29 16:19:59 +01:00
requirements.txt Updates progress.py to use the git module for outputting commit hash 2021-03-10 22:28:06 -05:00
REVIEWING.md Updates contributing.md and reviewing.md for the new reservation board. (#402) 2021-11-03 11:27:48 -03:00
spec En_Kujiya (#757) 2022-03-29 21:21:56 +01:00
sym_info.py Two minor fixes (#287) 2021-09-21 18:09:14 -04:00
undefined_syms.txt En_Kujiya (#757) 2022-03-29 21:21:56 +01:00

Legend of Zelda: Majora's Mask (US) 1.0

Build Status Decompilation Progress Contributors Discord Channel

- WARNING! -

The ROM this repository builds while has a matching checksum cannot be 'shifted' due
to hardcoded pointers which have yet to be dumped. Thus this repository is currently
in an experimental and research phase and cannot currently be used traditionally as a
source code base for general changes.

This is a WIP decompilation of The Legend of Zelda: Majora's Mask. The purpose of the project is to recreate a source code base for the game from scratch, using information found inside the game along with static and/or dynamic analysis. It is not producing a PC port. For more information you can get in touch with the team on our Discord server.

The only build currently supported is N64 US, but other versions are planned to be supported.

It currently builds the following ROM:

  • mm.us.rev1.rom.z64 md5: 2a0a8acb61538235bc1094d297fb6556

This repo does not include any assets or assembly code necessary for compiling the ROM. A prior copy of the game is required to extract the required assets.

Please refer to the following for more information:

Installation

Windows

For Windows 10, install WSL and a distribution by following this Windows Subsystem for Linux Installation Guide. We recommend using Debian or Ubuntu 20.04 Linux distributions.

MacOS

Preparation is covered in a separate document.

Linux (Native or under WSL / VM)

1. Install build dependencies

The build process has the following package requirements:

  • make
  • git
  • build-essential
  • binutils-mips-linux-gnu
  • python3
  • pip3
  • libpng-dev

Under Debian / Ubuntu (which we recommend using), you can install them with the following commands:

sudo apt update
sudo apt install make git build-essential binutils-mips-linux-gnu python3 python3-pip libpng-dev

2. Clone the repository

Create your own fork of the repository at https://github.com/zeldaret/mm. Then clone your fork where you wish to have the project, with the command:

git clone https://github.com/<YOUR_USERNAME>/mm.git

This will copy the GitHub repository contents into a new folder in the current directory called mm. Change into this directory before doing anything else:

cd mm

3. Install python dependencies

The build process has a few python packages required that are located in requirements.txt.

To install them simply run in a terminal:

python3 -m pip install -r requirements.txt

4. Prepare a base ROM

Copy your ROM to inside the root of this new project directory, and rename the file of the baserom to reflect the version of ROM you are using. ex: baserom.mm.us.rev1.z64

5. Make and Build the ROM

To start the extraction/build process, run the following command:

make init

This will extract all the individual files in the ROM into a newly created baserom folder, as well as decompress the compressed files in a newly created decomp folder. This will create the build folders as well as a new folder with the ASM as well as containing the disassemblies of nearly all the files containing code.

This make target will also build the ROM. If all goes well, a new ROM called "mm.us.rev1.rom.z64" should be built and the following text should be printed:

mm.us.rev1.rom.z64: OK

If you instead see the following:

mm.us.rev1.rom.z64: FAILED
md5sum: WARNING: 1 computed checksum did NOT match

This means that something is wrong with the ROM's contents. Either the baserom files are incorrect due to a bad ROM, or some of the code is not matching.

Running make init will also make the ./expected directory and copy all of the files there, which will be useful when running the diff script. The diff script is useful in decompiling functions and can be ran with this command: ./tools/asm-differ/diff.py -wmo3 <insert_function_here>

Note: to speed up the build, you can pass -jN to make setup and make, where N is the number of threads to use in the build, e.g. make -j4. The generally-accepted wisdom is to use the number of virtual cores your computer has, which is the output of nproc (which should be installed as part of coreutils). The disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass -jN). (-j also exists, which uses unlimited jobs, but is generally slower.)

Contributing

All contributions are welcome. This is a group effort, and even small contributions can make a difference. Some tasks also don't require much knowledge to get started.

Please note that is is our strict policy that Anyone who wishes to contribute to the OOT or MM projects must not have accessed leaked source code at any point in time for Nintendo 64 SDK, iQue player SDK, libultra, Ocarina of Time, Majora's Mask, Animal Crossing/Animal Forest, or any other game that shares the same game engine or significant portions of code to a Zelda 64 game or any other console similar to the Nintendo 64.

Most discussions happen on our Discord Server, where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects.

For more information on getting started, see our Contributing Guide and our Code Review Guidelines to see what code quality guidelines we follow.

FAQ

Q: Why does MM use transient assembly?

A: It is the view of the MM project leads that transient asm is safer than storing the disassembly in the repo. We feel like the C code is more transformative than a straight disassembly.