-
Notifications
You must be signed in to change notification settings - Fork 12
Modding
Mods are .nrm files. Install one by copying it into the mods folder of the
data folder above (or dropping it onto the Mods menu), then enable it in the
Mods menu. Some mods have options there too.
The included mods are in mods/. Build one on Linux (or in WSL), from the
repository root, after recomp/run.sh:
sh mods/build_mod.sh mods/skip_cutscenesThe .nrm ends up in the mod's build/ folder.
-
Skip Any Cutscene (
mods/skip_cutscenes): L skips a cutscene even the first time you see it. An option also allows skipping the ones the game never lets you skip. -
Cheats (
mods/cheats): infinite health, infinite lives and a full wallet, each toggled in the mod's options.
Mods are .nrm files for N64ModernRuntime, installed by dropping them into
mods/ in the data folder (or through the launcher's Mods menu, which also
enables and configures them). Each mod in mods/ here has a mod.toml and C
sources in src/; build one in WSL from the repo root with
sh mods/build_mod.sh mods/skip_cutscenes
which compiles for MIPS with clang, links with mips-linux-gnu-ld (ld.lld
isn't needed) and runs RecompModTool, leaving the .nrm in the mod's build/.
Mods link against mods/syms/conker.us.{syms,datasyms}.toml, which
recomp/run.sh regenerates with N64Recomp's --dump-context; rebuild mods
after the game's function layout changes.
Mods can replace a game function (RECOMP_PATCH) or run code before it or
when it returns (RECOMP_HOOK, RECOMP_HOOK_RETURN). Patching rewrites the
start of the recompiled host function, which is why the exe links with
/OPT:NOICF. A hook makes the runtime recompile the hooked function again,
with LiveRecomp, from its instructions in the ROM. .game is compressed in the
real ROM, so conker::decompress_rom (host/src/overlays.cpp) builds the ROM
the recompiler saw instead: the original .game and .debugger code (which
the exe already carries for the TLB pages) at their ROM addresses in the
recompiled layout, plus the words prepare_elf.py rewrote
(emit_tlb_pages.py emits both). Limits of hooks: a function with a jump
table can't be hooked (its table is in .game_data, which the regenerated
code can't see), and hooking a function that conker.toml hooks drops the
toml hook. func_1501BBB8 (reads the controllers once per game frame) makes
a good per-frame hook.
The game exports recomp_printf (host/src/mod_api.cpp), and the runtime
provides the recomp_get_config_* functions for a mod's config options.
mods/skip_cutscenes lets L skip any cutscene the first time it plays (the game
normally only lets you skip ones you've watched), and optionally the ones the
game's script never lets you skip, like the opening. mods/cheats has infinite
health, infinite lives and a full wallet, each an option.