This is an example mod for Majora's Mask: Recompiled that can be used as a template for creating mods. It has a basic build system, headers, sample code, and a mod config toml.
Example code for using the recompui API to build ingame UI can be found in the ui-example branch.
See this document for an explanation of the modding framework, including how to write function patches and perform interop between different mods.
You'll need to install clang and make to build this template.
- On Windows, using chocolatey to install both is recommended. The packages are
llvmandmakerespectively.- The LLVM 19.1.0 llvm-project release binary, which is also what chocolatey provides, does not support MIPS correctly. The solution is to install 18.1.8 instead, which can be done in chocolatey by specifying
--version 18.1.8or by downloading the 18.1.8 release directly.
- The LLVM 19.1.0 llvm-project release binary, which is also what chocolatey provides, does not support MIPS correctly. The solution is to install 18.1.8 instead, which can be done in chocolatey by specifying
- On Linux, these can both be installed using your distro's package manager. You may also need to install your distro's package for the
lldlinker. On Debian/Ubuntu based distros this will be thelldpackage. - On MacOS, these can both be installed using Homebrew. Apple clang won't work, as you need a mips target for building the mod code.
On Linux and MacOS, you'll need to also ensure that you have the zip utility installed.
You'll also need to grab a build of the RecompModTool utility from the releases of N64Recomp. You can also build it yourself from that repo if desired.
- First, run
make(with an optional job count) to build the mod code itself. - Next, run the
RecompModToolutility withmod.tomlas the first argument and the build dir (buildin the case of this template) as the second argument.- This will produce your mod's
.nrmfile in the build folder. - If you're on MacOS, you may need to specify the path to the
clangandld.lldbinaries using theCCandLDenvironment variables, respectively.
- This will produce your mod's
Mods can also be made with newer versions of the Majora's Mask decompilation instead of the commit targeted by this repo's submodule. To update the commit of the decompilation that you're targeting, follow these steps:
- Build the N64Recomp repo and copy the N64Recomp executable to the root of this repository.
- Make sure you pass
KEEP_MDEBUG=1tomakewhen building the decomp in order to keep debug information. This must be done from a clean build if you have built the decomp already withoutKEEP_MDEBUG=1.
- Make sure you pass
- Build the version of the Majora's Mask decompilation that you want to update to and copy the resulting .elf file to the root of this repository.
- Update the
mm-decompsubmodule in your clone of this repo to point to the commit you built in the previous step. - Run
N64Recomp generate_symbols.toml --dump-context - Rename
dump.tomlanddata_dump.tomltomm.us.rev1.syms.tomlandmm.us.rev1.datasyms.tomlrespectively.- Place both files in the
Zelda64RecompSymsfolder.
- Place both files in the
- Try building.
- If it succeeds, you're done.
- If it fails due to a missing header, create an empty header file in the
include/dummy_headersfolder, with the same path.- For example, if it complains that
assets/objects/object_cow/object_cow.his missing, create an emptyinclude/dummy_headers/objects/object_cow.hfile.
- For example, if it complains that
- If RecompModTool fails due to a function "being marked as a patch but not existing in the original ROM", it's likely that function you're patching was renamed in the Majora's Mask decompilation.
- Find the relevant function in the map file for the old decomp commit, then go to that address in the new map file, and update the reference to this function in your code with the new name.