feat(mods): a Mods tab, merged resource size tables, ExeFS patches and Atmosphere cheats #2478
Open
hckrman101 wants to merge 4 commits from
hckrman101/feat/mods-cheats into main
pull from: hckrman101/feat/mods-cheats
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2478
Loading…
Reference in a new issue
No description provided.
Delete branch "hckrman101/feat/mods-cheats"
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?
Branch: feat/mods-cheats, head
f654ef2056(5d9a877e, then a fix, a merge of main940eb9ef, and the menu header)Mods that each make files bigger, such as HD texture packs, can't be combined today: the game reads one resource size table, so only one mod's grown entries count. ExeFS patches (IPS, pchtxt) and Atmosphère cheat files, which many Switch mods ship, aren't loaded at all. This PR merges the size tables, adds a Mods tab to the Insert menu, applies ExeFS patches when the game is built, and runs cheat files.
What changes
modcache/rsizetable.zsand logged.hookshot_mods.txtand apply at the next start; closing the menu asks to restart ("the mods").mods/<name>/exefs/*.ipsand*.pchtxtfiles (IPS, IPS32, IPSwitch) are applied to main's image before the lift relocates and translates it, as rtld would see the module. The code is then compiled from the patched instructions, and image.bin holds the patched data.@nsobid)..text(a code cave) becomes code the lift translates.exefs_patches.txtinto the game folder. The Mods tab uses it to say when a mod's patches wait for the next build (a change takes a rebuild, since the code is compiled ahead of time).mods/<name>/cheats/E0F3CCFAF50065AE.txtin Atmosphère/dmnt format. They are separate from the Debug tab's built-in cheats (#785 tools,oot_cheat_items.h), which this PR doesn't touch.hookshot_mods.txt.{Master}codes are always on.assets/hookshot.png) and the build, a little smaller than before (13 points, from 15). The tabs are a little smaller too (21 points, from 23). They stay centred while that leaves the header room; otherwise they start after it, with the Q/E keys at their ends as before. Where it is still too tight (Small at 1280x720 with a long source build's version), the header drops "Hookshot " first (the icon says it), then the git suffix after the release (v2.1.0-rc.3...), then a size step. Only after that do the tabs shrink. With no mods (five tabs) the same rules apply.Credit
runtime/mods.c,romfs.c,restbl.c,cheats.candtools/exefs_patches.py. That project is MIT, Copyright (c) 2026 Valiantsin Dzerakh; its notice is kept inhost/restbl.handnx2/exefs_patches.py, and host/PROVENANCE.md names the files.Verified
On an RTX 3090 (Linux), headless runs with copies of saves. The test mods were made locally from the user's own files and never shared.
Mods that grow the same file load together.
Title.bntx(+64 KiB) and the HUD'sCommon.bntx(+64 KiB), with its own table.Title.bntx(+256 KiB), with its own table.resource size table: 2 tables of mods merged (3 entries), 2 entries raised for mod files ... served from modcache. The title texture is served from B (lower in the list) and the HUD from A.ExeFS patches.
.text. In game, R3 switches to first person (screenshots: before / after).mov x19, x0re-encoded asadd x19, x0, #0in the camera view update): its bytes are in image.bin.1075 bytes of main patched by 2 filesandmain's code reaches 0x3c46f8c now (a code cave); the Mods tab shows both mods' patches as built in.Mods tab. In game, with screenshots: the list, a mod moved up (hookshot_mods.txt written; "Restart needed: the mods"), and a cheat switched on (log
cheats: ... 1 on).Game-free checks, 399 of 399 passing on Linux:
test_mods_sizes(three mods over a synthetic RomFS and tables: the merged entries, the served files, the counts, hookshot_mods.txt across two starts, ExeFS status, no mods = nothing written).test_exefs_patches(IPS/IPS32/pchtxt, build ids, the mods' order, code/data/linker tables on a synthetic main, caves, the list).test_cheat_vm(stores, buttons, pointer chains, loops, register conditions, out-of-guest reads, code writes refused).test_mods_menu(the tab's lines and keys against a fake host, hidden without mods or with an older host).test_mods_size_table,test_fs_links,test_present_trace,test_input_background.Menu header, in the game (RTX 3090, Linux, headless; the game's own frames). Small, Medium and Large at 1280x720, 1600x900, 1920x1080 and 2560x1440, with six tabs and the version
v2.1.0-rc.3-135-g32bb5f4-dirty; plus five tabs (no mods) at Small 1280x720 and Medium 1920x1080. Before: at Medium and Large the version was hidden, and at Large the tab keys reached the bar's ends. After: the icon and the version show at every size. Small and Medium keep the whole "Hookshot v2.1.0-rc.3-135-g32bb5f4-dirty"; Large, at every resolution, shows "v2.1.0-rc.3..." beside the icon. Nothing overlaps, and the Q/E keys stay inside the bar. The full suite (tests/run_all.py) passes after the merge and the header: 412 passed, 0 failed, 12 skipped.tests/test_menu_size.pychecks the header's order of shortening and the shortened version.Not tested
test_cheat_vm.2ed98c46. After the rebase, the game-free checks pass; the full rebuild (compile check) was still queued when this was written: see ~/.cache/hookshot-work/port-mods/build2.log.atmosphere/exefs_patches/<name>/layout and opcode C4/0xF extensions are not supported.Screenshots (game output only): pr-shots/a-third-person.png, a-first-person.png, mods-tab.png, mods-tab-moving.png, mods-tab-moved.png, mods-tab-cheat-on.png (in ~/.cache/hookshot-work/port-mods/pr-shots/).
Menu header screenshots (the game's own frames)
Before, 6 tabs, Large, 1920x1080 (the version is hidden):
After, Medium and Large at 1920x1080, Small at 1280x720, and Medium with no mods:
I'm prototyping the optional indexed RomFS image from #583 (tracked in #1007; no PR yet). At
f654ef20, the storage boundaries to preserve aregame_file,find_sizes, and the base RESTBL reads inmerge_sizes: they currently inspect the loose RomFS folder directly.I'll handle image-backed base reads/enumeration in that package and revalidate against your real mod loader. Mod ordering, switches and RESTBL merging remain in this PR. Whichever lands second will need that integration; the existing folder path should keep working. No loading-speed gain is established yet.
github-sync referenced this pull request2026-11-12 06:22:55 +00:00
WIP: 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 cheatsThanks for the Mods tab work. I would like to build on your ordering and enable switches, not introduce another loader.
Your draft already separates restart-time RomFS changes from rebuild-time code patches (
f654ef20, host/mods.c:1–28).A later shared interface could let randomizers and co-op use named game events and safe item grants, while keeping your tab as the place players choose mods: I have written that up as a proposal in #2892.
First, I can offer a Linux test with a real, locally generated Clawshot seed and copied saves: loading, on/off across restart, ordering, merged size entries and controller prompts.
Clawshot already launches through HOS_MODS (
755317b3, src/clawshot/pack/runtime.py:135–163).I have not run your branch for this proposal, and that seed test would not establish ExeFS, cheat or Archipelago compatibility.
Would that test be useful on this head, or would you prefer it after your next integration with main?