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.
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.
- 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 build N64Recomp for the RecompModTool utility.
- First, run
make(with an optional job count) to build the mod code itself.- On macOS, you must specify the custom clang and lld: i.e.
CC=/opt/local/bin/clang-mp-18 LD=/opt/local/bin/ld.lld-mp-18 make
- On macOS, you must specify the custom clang and lld: i.e.
- 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.
- This will produce your mod's
- Finally, compile your mod offline.
- This part is temporary and only needed while the recomp mod runtime doesn't have LuaJIT recompilation implemented
- Start by running the
OfflineModRecomputility (included in the N64Recomp repo). Pass the following arguments:build/mod_syms.bin build/mod_binary.bin Zelda64RecompSyms/mm.us.rev1.syms.toml build/mod_recompiled.c - Next, build the dynamic library from the generated
build/mod_recompiled.cfile and passoffline_buildas an include path.- On Windows, you can run:
On Linux, you can run:
clang-cl build/mod_recompiled.c -fuse-ld=lld -Z7 /Ioffline_build /MD /O2 /link /DLL /OUT:build/mm_recomp_mod_template-1.0.0.dllOn macOS, you can run:clang build/mod_recompiled.c -shared -fvisibility=hidden -fPIC -O2 -Ioffline_build -o build/mm_recomp_mod_template-1.0.0.soclang build/mod_recompiled.c -shared -fPIC -O2 -Ioffline_build -o build/mm_recomp_mod_template-1.0.0.dylib - Make sure your mod's dynamic library and .nrm file have the same filename (besides the extension).
- e.g.
testmod-1.0.0.nrmandtestmod-1.0.0.dll
- e.g.
- On Windows, you can run: