Decompilation of The Legend of Zelda: Majora's Mask
Go to file
Anghelo Carvajal efc9df3f56
ovl_player_actor: Dawn of a new PR (#1227)
* Rename Player_UpdateBottleHeld

* Match func_808497A0

* func_80852290 NON_MATCHING

* Match func_8083B3B4

* Params cleanup

* Match func_8083FBC4

* sfxId cleanups and others

* Fix declaration of functions from D_8085D990

* Change D_8085BE84 to be a 2D array

* ARRAY_COUNT_2D

* Match func_8085ADA0

* func_808426F0 nonmatching

* Match func_80852290

* Match func_808426F0

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>

* Add notes to Player_SetDoAction

* Name putAwayCountdown

* rebase

* Match func_80856918

* format

* func_8084933C nonmatching
small amount of boomerang documentation

* Progress on moving data near where it is used

* finish moving data

* format

* cleanup up remaining data

* more match

* Some minor cleanups

* PlayerCsMode enum

* func_80851F18 nonmatching

* Fix unk_B10

* Purge ExchangeItemID enum

* Rename `targetActor` to `talkActor`

* Name `targetedActor`

* PLAYER_LIMB_BUF_SIZE

Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>

* Change SkelAnime Player functions to take a void pointer for the corresponding buffers

* Use PlayerAnimationFrame on Player_DrawImpl

* Match func_8082F1AC

* Match func_8083D23C

* cleanup

* Match and clean up func_808373F8

* Match and document func_8083A98C

* PLAYER_PARAMS macro and PlayerInitMode enum

* Preliminary names for InitMode functions

* Match func_8083C8E8

* remove redundant externs

* Match func_8084933C

* cleanup func_8084933C

* Access D_8085BE84 directly instead of using a macro

* Match func_8084AC84

* Fix boomearng typo

* OK boomerang

* cleanup func_8083D168

* untargetedRotY

* this->unk_14E = ABS_ALT(var_v1);

* GIFIELD macros

* sort of a match

* Match func_8084C16C

Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>

* Use the same trick to match func_808573A4

* Add note on Deku spinning

* Match func_8084D18C

* Match func_80850D68

* Improve func_80832660

* Match func_80854EFC

Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>

* Rename unk_B2A to getItemDrawId

* Some cleanup

* fix merge issues

* format

* minor anim docs

* Match func_808553F4

* Cleanup func_808553F4

* func_8083D860 nonmatching

* Match func_8083D860

* Defake func_80859BA8

* ()

* Add notes to PlayerAnimGroup enum

* underwaterTimer

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>

* some stateFlags cleaning

* more stateFlags cleaning

* some notes and minor cleanups

* more general cleanups

* Slightly less fake func_80832CAC

* Document some melee weapon damage stuff

* Mark lunge storage

* Note PCS patch

* match

* add notes to bss

* yeet extra indentation

* add reloc as nonmatching to spec

* floorSfxOffset

* Player_GetFloorSfx

* Player_GetFloorSfxByAge

* Comments for AnimSfx dunctions

* Name some AnimSfx functions

* Name AnimSfx stuff

* Some PlayerAgeProperties notes

* use animflag defines

* Player_SpawnExplosive

* fix enum and some other minor fixes

* Bit more misc. cleanup

* Use OoT's version of func_808333CC

* Note on quickspin buffer

* Final nonmatching, func_80851F18

Co-authored-by: Synray <31429825+Synray@users.noreply.github.com>

* RIP player.c

* Name Player_StopHorizontalMovement

* misc fixes

* Actor_DeactivateLens

* fixes

* typos and tweaks

* minor stuff

* add names as comments on the animgoup array

* Correct some function names and data type

* add anim commets to ageproperties

* some notes

* De-fake func_80840F90

* Defake & clean up func_8085ADA0

* Improve func_80859BA8

* Enums in func_80852B28

* Name some secret-related things

* 3 small things

* stuff

* Player_TalkWithPlayer

* SurfaceType_GetFloorType

* SurfaceType_GetWallFlags

* and more bgcheck stuff

* more bss naming

* sPlayerControlInput

* clean up func_80836F10 a bit

* name the parameters of func_80835BF8

* door stuff

* remove NON_MATCHING

* remove D_8085D2B0 padding

* Name some Player_Cutscene_ functions

* various cleanups

* format

* remainingHopsCounter

* some cleanups on the struct

* Actor_RequestRumble

* this->exchangeItemId = PLAYER_AP_NONE;

* fix merge stuff

* format

* PlayerUnkAA5

* Name two cylinder-related functions

* BSS

* Add MagicConsume's enum, treat lensActive as bool

* Update func_808332A0 based on better info

* fix merge

* fix merge issues

* remove redundant comments

* Name Player_AddQuake

* ANIM_FLAG_UPDATE*_*Y

* Format

* AT_TYPE_ENEMY

* fix merge issues

* format

* fix uintptr_ts

* Rename

* Name leftHandMf

* fix merge issues

* format

* exchangeItemId <= PLAYER_IA_MINUS1

* getItemDrawIdPlusOne

* currentActorCsIndex

* <= PLAYER_IA_MINUS1

* fix merge issues

* format

* namefixer and bss

* fix build

* bombs parameters cleanup

* bss

* Fix building

* fix building

* Fix building

* Fix building and cleanups

* Pre-PR cleanup

* really...

* format

* review

* stateFlag Mistakes

* 268 * 0.1f

* z64door.h

* fix cutscene stuff

* bss

* Update include/z64player.h

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* Update include/z64player.h

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* reiew

* PR Review

* collision

* review

* format and a few stuff i missed

* EnBomExplosiveType

* weekeventregconvert and eventinfconvert

* more review

* review

* bss

* review

* re format sGetItemTable

* Entangle PlayerMask and PlayerItemAction

* a few extra cases i missed

* bss

* review

* EnArrow stuff

* ARROW_MAGIC_DEKU_BUBBLE

* minor format

* merge

* fix bss

* review

* !ARROW_IS_ARROW

* review

* bool cleanup

* fix merge

* review

* Player_StopCutscene

* Player_RequestQuake

* quakeIndex

* Player_RequestQuakeAndRumble

* knobDoor and slidingDoor

* bss

* fix

* review

* dog and float

---------

Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu>
Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>
Co-authored-by: Synray <31429825+Synray@users.noreply.github.com>
2023-05-28 17:41:37 -04:00
assets ovl_Bg_Tobira01 OK and documented (#1247) 2023-05-28 14:19:53 -04:00
docs Add SaveInfo substruct to SaveContext (#1191) 2023-04-18 18:54:32 -04:00
include ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
src ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
tools ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
.clang-format Adds clang-format script to MM 2020-07-24 19:57:54 -04:00
.clang-tidy Format Script Update (#904) 2022-10-04 04:06:04 +01:00
.gitattributes Fixes IDO recomp and allows git to detect binary files. (#50) 2021-02-25 18:21:51 -05:00
.gitignore Ignore other rom extensions (#1218) 2023-03-21 10:28:24 -03: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
diff_settings.py ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
diff.py diff.py symlink and graphovl.py (#151) 2021-05-18 22:21:14 -04:00
Dockerfile Adding Docker Support (#914) 2022-07-11 23:54:17 -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.py Fix Website 404 and Format script error message (#1161) 2023-02-07 19:29:17 -05:00
Jenkinsfile Update Jenkinsfile 2022-10-16 17:20:16 +09:00
Makefile ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
README.md Update README.md (#1116) 2022-10-13 22:29:19 +01:00
requirements.txt Add pyelftools back to requirements.txt (#1064) 2022-11-06 14:31:26 -05:00
spec ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00
sym_info.py Two minor fixes (#287) 2021-09-21 18:09:14 -04:00
undefined_syms.txt ovl_player_actor: Dawn of a new PR (#1227) 2023-05-28 17:41:37 -04:00

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

Build Status Decompilation Progress Contributors Discord Channel

- WARNING! -

This repository is a work in progress, and while it can be used to make certain changes, it's 
still constantly evolving. If you wish to use it for modding purposes in its current state,
please be aware that the codebase could drastically change at any time. Also note that some
parts of the ROM may not be 'shiftable' yet, so modifying them could currently be difficult.

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, and will not, produce a PC port. For frequently asked questions, you can visit our website, and for more information you can get in touch with the team on our Discord server.

The only version currently supported is N64 US, but we intend to eventually support every retail version of the original game (i.e. not versions of MM3D, which is a totally different game).

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.

Docker

Preparation is covered in Building Docker.

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 run 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 work also doesn'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 or ZeldaRET's other decompilation projects.

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