Decompilation of The Legend of Zelda: Majora's Mask
Go to file
rylieb 12bd420f7b
Obj_Warpstone - Tiny PR to address final suggestions from previous PR's code review. (#251)
* EnBji01_Init OK and Partially Documented.

* EnBji01_Destroy OK and Fully Documented.

* func_809CCE98 OK and partially documented.

* Removed goto in func_809CCE98().

* func_809CD6C0 matching and partly documented.

* Pasted raw mips_to_c into EnBji01_Update().

* EnBji01_Update() matching and partially documented.

* EnBji01_Update() matching and partially documented.

* func_809CDA4C() matching and partially documented.

* func_809CDA4C actually matching this time, and partially documented.

* func_809CDB04() matching and partially documented.

* func_809CD028() matching and mostly documented.

* func_809CD6B0() matching.

* func_809CD328() matching and partially documented.

* func_809CCDE0() matching and partially documented, func_8013E950()
prototyped.

* func_809CD634() and func_809CD70C() matching and partially documented.
func_801A5BD0() prototyped.

* func_809CD77C() matching and mostly documented. All functions now
matching.

* Imported data from ovl_En_Bji_01_data.asm to z_en_bji_01.c. Updated
object_script.txt and code_script.txt. Ran format.sh. Builds OK.

* Documented all of the unks in Shikashi's struct. Build still OK.

* Fixed new warning in Bg_Haka_Tomb resulting from my new prototype of
func_8013E3B8().

* Renamed remaining instances of unk160 to cutscenes.

* Update src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h

Remove unnecessary comment about compiler padding.

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>

* Update src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c

Correct stack declaration spacing.

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>

* Update src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h

Remove unnecessary comment about compiler alignment padding.

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* Update src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c

Remove unnecessary padding comment.

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>

* Apply suggestions from code review

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>
Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* Batch commit for comments during code review.

* Apply suggestions from code review (trailing Us)

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Deleted exteraneous space at the bottom of En_Bji_01 struct in the
header file.

* Used params enum for switch cases.

* Update src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h

Co-authored-by: Parker Burnett <burnettparker@gmail.com>

* Apply suggestions from code review

replacing magic numbers with limb enums

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>

* Renamed func_809CD328 to EnBji01_DialogueHandler per code review.

* ObjWarpstone_Init() matching and mostly documented.

* ObjWarpstone_Destroy() matching and fully documented.

* ObjWarpstone_Update() matching and partially documented.

* ObjWarpstone_Draw() matching and partially documented.

* func_80B92B10() matching and partially documented.

* func_80B92C00() matching and mostly documented.

* func_80B92C48() matching and mostly documented.

* func_80B92CD0() matching and partially documented.

* func_80B92DC4() matching and fully documented.

* Obj_Warpstone OK.

* Obj_Warpstone OK and mostly documented.

* Changed "actionFunc" return values from 0/1 to false/true.

* Apply suggestions from code review

Change colors to decimal, and use matrix defines/enums instead of magic numbers.

Co-authored-by: kyleburnette <kyle@kyleburnette.com>

* Convert more colors to decimal and replace more magic nums with mtx
defines/enums.

* Ran format.sh after adding (wordy) mtx defines.

* Ran format.sh which updated ginko_man.

* Update src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c

Switch to line comments.

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Changed floating point constants in ObjWarpstone_Draw to hex per code review.

* Rename timer and timer enums.

* Address a few last comments on my PR. Mainly regarding variable/macro
naming, and also using generated reloc instead of extracted.

* Added C file descriptors to both of my merged actors.

* Changed macro name from "_HIT" to "_ACTIVATED" to be more accurate.

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>
Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Co-authored-by: Parker Burnett <burnettparker@gmail.com>
Co-authored-by: kyleburnette <kyle@kyleburnette.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
2021-08-08 09:33:59 -04:00
.github CONTRIBUTING.md (#157) 2021-05-20 21:06:30 -04:00
assets ZAPD update: Gotta go fast! (#226) 2021-07-28 21:55:02 -04:00
include Obj_Warpstone - Tiny PR to address final suggestions from previous PR's code review. (#251) 2021-08-08 09:33:59 -04:00
src Obj_Warpstone - Tiny PR to address final suggestions from previous PR's code review. (#251) 2021-08-08 09:33:59 -04:00
tools sched.c OK (#248) 2021-08-07 12:43:11 -04: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 Overhaul the build system (#234) 2021-08-03 23:21:31 -04: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 Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
diff_settings.py Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
diff.py diff.py symlink and graphovl.py (#151) 2021-05-18 22:21:14 -04:00
extract_assets.py Overhaul the build system (#234) 2021-08-03 23:21:31 -04: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 Format everything (#141) 2021-05-18 20:00:36 -04:00
Jenkinsfile Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
Makefile Fix gcc warnings (#246) 2021-08-04 08:14:38 -04:00
README.md Convert every submodule into subrepo (#170) 2021-06-07 18:31:56 -04: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 Adds a REVIEWING.md documentation file (#160) 2021-05-30 11:20:29 -04:00
spec Obj_Warpstone - Tiny PR to address final suggestions from previous PR's code review. (#251) 2021-08-08 09:33:59 -04:00
sym_info.py Overhaul the build system (#234) 2021-08-03 23:21:31 -04:00
undefined_syms.txt En_Dinofos (#235) 2021-08-06 17:14:09 -04: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 repo does not include any assets or code necessary for compiling the ROM. A prior copy of the game is required to extract the required assets.

This is a decompilation of Legend of Zelda: Majora's Mask (US) 1.0

It builds the following ROM:

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

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 18.04 Linux distributions.

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

To install the Python dependencies simply run in a terminal:

python3 -m pip install -r requirements.txt

2. Fork 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

3. 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

4. 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 either:

  • 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.
  • Pass -j to make setup and make, to use as many threads as possible, but beware that this can use too much memory on lower-end systems. Both of these have 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 -j or -jN).

Note: if you rename symbols, it is recommended that you use the tools/rename_sym.sh to ensure that you cover all instances, including the tables which are used to generate the asm/ directory.

Usage: tools/rename_sym.sh old_name new_name. Example:

tools/rename_sym.sh func_808A3428 EnTorch2_UpdateIdle

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.

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.