feat(mods): a Mods tab, merged resource size tables, ExeFS patches and Atmosphere cheats #3
Loading…
Reference in a new issue
No description provided.
Delete branch "snaildev99/Hookshot:feat/mods-exefs-patches"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Mods that change the game's code (ExeFS patches:
.ips,.pchtxt) do nothing on Hookshot, two mods that each ship a resource size table cannot load together, and there is no place in the game to see or order the mods. sirhumanbean's draft for all of this was pull request 2478 on GitHub and went with the issues and pull requests there. This brings it back onto currentmain, with the fixes from its review on Longshot.Built from this branch and played on Hookshot by hand (below, with two pictures); the same code was played more widely on Longshot before the port.
What changed
sirhumanbean's two commits are kept under his name; the commits after them are the port and the review's fixes. It is squashed at the merge, so please credit him there (
Co-authored-by: hckrman101).host/mods.c,host/restbl.c,host/zs.c): the mods' order and switches are read fromhookshot_mods.txt; one size table is served, merged from every enabled mod's and raised for each file a mod serves (written tomodcache/rsizetable.zs), so mods that each grow files load together; the menu gets the list (hos_mod_info,hos_mod_edit,hos_mods_changed).nx2/exefs_patches.py,nx2/image.py,nx2/make_game.py):mods/<name>/exefs/*.ipsand*.pchtxtare read when the game is built and written intomainbefore it is relocated and lifted; a write into the padding after the code makes it code (a code cave). They are part of the lift's key, andexefs_patches.txtin the game folder lists what the build applied.host/cheats.c): Atmosphere cheats of the mods that are on; data cheats are switched in the menu.gpu/vk/vk_menu.cpp): a Mods tab, shown when there are mods: each mod On or Off, Enter and Up or Down to move it, its cheats under it. A change asks for a restart as a row that takes one does.main:maintook API version 22 forwide_cover, so the Mods tab's five functions come after it as version 23 (gpu/vk/vk_api.h,host/rx_backend.c,can_mods(),tests/test_mods_menu.py). Six conflict blocks in five files; nothing ofmain's was dropped.exefs_patches.txt; the compact bar shows the Mods tab's full page.tests/test_exefs_patches.py,test_cheat_vm.py,test_mods_menu.py,test_mods_sizes.py, and additions totest_mods_size_table.pyandtest_fs_links.py. Docs: the README's Mods section,docs/development.md.The lift fix a code-cave routine needs is already on
main(commit56ca2f89: a function with code below its entry starts at its entry).How it was tested
Game-free, on this branch (Windows 11, llvm-mingw; the full run was on
main@34389c34, the branch has since been rebased ontof532c100, three commits of docs, and the mod checks pass again there):python -I -B tests/run_all.py: 536 passed, 38 skipped, 8 failed. The same eight fail onmain@34389c34on this PC (532 passed there):test_updater_asset_digest,test_builder_details_hitbox,test_builder_dlss_update,test_builder_upscaler_parts,test_controls_key_slots,test_portable_archive,test_portable_builder_startup,test_portable_builder_home.test_mods_menu,test_exefs_patches,test_cheat_vm,test_menu_restart,test_menu_tune(test_mods_sizes,test_mods_size_tableandtest_fs_linksskip their file parts off Linux).In the game on Hookshot, this branch @
b18ab96c(v2.2.0-rc.1-124-gb18ab96c), Windows 11, RTX 3090, by hand, with a mod that has RomFS files, a size table and six code patches in one.ips(https://github.com/snaildev99/OoT-Character-Select):nx2/make_game.py, the mod inmods: 13 min 8 s, compiled in 10 min 44 s, 0 failed.In the game, the same code before this port, on Longshot (its pull request 134, where the pictures and the log lines are: https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/134):
.ips(https://github.com/snaildev99/OoT-Character-Select, v0.1.3): the Mods tab lists it, the mod's menu page, its character swap, its cloth and voice hooks all work, 60 fps, the size table's merge takes 56 to 111 ms at the start..ipsfiles for one build id built in (exefs: 4935 bytes of main patched by 6 files), a mod switched Off and On from the tab with Restart now, a mod moved.Not tested anywhere: a
.pchtxtmod, a cheat file, the mouse on the tab, the compact bar with Mods current, a patch into a relocated word. Not tested on Hookshot itself: several mods at once (on Longshot only), and Linux.For mod authors
A patch routine that is entered with
blhas to leave withret. One that jumps back into its caller runs the caller's tail twice once the code is lifted; the console and the emulators do not show it.Risk
Without a
modsfolder nothing of this runs (hos_mods_initreturns first). With mods, the size table the game gets is the merged one, where before it was the last mod's own. A build with ExeFS patches lifts patched code; without such patches the lift and its key are as before. Reverting the merge is enough.🤖 Generated with Claude Code
7d76d216bcb18ab96c94WIP: feat(mods): a Mods tab, merged resource size tables, ExeFS patches and Atmosphere cheatsto feat(mods): a Mods tab, merged resource size tables, ExeFS patches and Atmosphere cheatsBuilt from this branch (
b18ab96c) and played on Hookshot by hand, Windows 11, RTX 3090: the Mods tab lists the mod, the mod's own menu page and its character swap work (they come from its six code patches), and a mod switched Off from the tab asks for the restart and stays off after it. The build took 13 min 8 s with 0 failed. The log lines and two pictures are in the description, and the draft mark is off. Left untested on Hookshot itself: several mods at once (played on Longshot), Linux, a .pchtxt mod and a cheat file.