feat(mods): a Mods tab, merged resource size tables, ExeFS patches and Atmosphere cheats #2900
Open
snaildev99
wants to merge 7 commits from
snaildev99/Hookshot-fork:feat/mods-exefs-patches into main
pull from: snaildev99/Hookshot-fork:feat/mods-exefs-patches
merge into: Hookshot:main
Hookshot:main
Hookshot:release/v2.2.0-rc.1-forgejo
Hookshot:release/v2.1.0-forgejo
Hookshot:github/pr/2893
Hookshot:github/pr/2890
Hookshot:github/pr/2887
Hookshot:github/pr/2878
Hookshot:github/pr/2875
Hookshot:github/pr/2874
Hookshot:github/pr/2873
Hookshot:github/pr/2871
Hookshot:github/pr/2756
Hookshot:github/pr/2897
Hookshot:github/pr/2896
Hookshot:github/pr/2718
Hookshot:github/pr/2842
Hookshot:github/pr/2691
Hookshot:github/pr/2895
Hookshot:github/pr/2743
Hookshot:github/pr/2765
Hookshot:github/pr/2708
Hookshot:github/pr/2732
Hookshot:github/pr/2755
Hookshot:github/pr/2817
Hookshot:github/pr/2876
Hookshot:release-please--branches--main
Hookshot:release-please--branches--main--release-notes
Hookshot:github/pr/2778
Hookshot:github/pr/2888
Hookshot:github/pr/2866
Hookshot:github/pr/2877
Hookshot:github/pr/2800
Hookshot:github/pr/2829
Hookshot:github/pr/2850
Hookshot:github/pr/2889
Hookshot:github/pr/2882
Hookshot:github/pr/2860
Hookshot:github/pr/2849
Hookshot:github/pr/2886
Hookshot:github/pr/2794
Hookshot:github/pr/2840
Hookshot:github/pr/2830
Hookshot:github/pr/2834
Hookshot:github/pr/2719
Hookshot:github/pr/2742
Hookshot:github/pr/2741
Hookshot:github/pr/2820
Hookshot:github/pr/2771
Hookshot:github/pr/2859
Hookshot:github/pr/2858
Hookshot:github/pr/2823
Hookshot:github/pr/2757
Hookshot:github/pr/2769
Hookshot:github/pr/2844
Hookshot:github/pr/2843
Hookshot:github/pr/2673
Hookshot:github/pr/2855
Hookshot:github/pr/2739
Hookshot:github/pr/2807
Hookshot:github/pr/2851
Hookshot:github/pr/2789
Hookshot:github/pr/2814
Hookshot:github/pr/2818
Hookshot:github/pr/2774
Hookshot:github/pr/2772
Hookshot:github/pr/2750
Hookshot:github/pr/2786
Hookshot:github/pr/2785
Hookshot:github/pr/2782
Hookshot:github/pr/2779
Hookshot:github/pr/2775
Hookshot:github/pr/2706
Hookshot:github/pr/2766
Hookshot:github/pr/2747
Hookshot:github/pr/2759
Hookshot:github/pr/2745
Hookshot:github/pr/2740
Hookshot:github/pr/2733
Hookshot:github/pr/2725
Hookshot:github/pr/2727
Hookshot:github/pr/2728
Hookshot:github/pr/2729
Hookshot:github/pr/2721
Hookshot:github/pr/2722
Hookshot:github/pr/2715
Hookshot:github/pr/2714
Hookshot:github/pr/2707
Hookshot:github/pr/2703
Hookshot:github/pr/2705
Hookshot:github/pr/2697
Hookshot:github/pr/2679
Hookshot:github/pr/2676
Hookshot:github/pr/2669
Hookshot:docs/what-hookshot-connects-to
Hookshot:fix/hdr-encode-test
Hookshot:fix/main-tests
Hookshot:fix/play-cache-files
Hookshot:perf/game-barrier-order
Hookshot:feat/heap-lazy
Hookshot:feat/texture-detail
Hookshot:perf/astc-opaque-bc1
Hookshot:fix/fs-dir-lock
Hookshot:fix/framegen-native-kept
Hookshot:fix/update-no-downgrade
Hookshot:port/k10-gcn-f16-mirrors
Hookshot:fix/framegen-mult-cap
Hookshot:chore/release-as-2.1.1
Hookshot:perf/pcache-load-switch
Hookshot:fix/prepare-progress-log
Hookshot:fix/update-closes-stale-game
Hookshot:fix/hdr-scaled-sampled
Hookshot:perf/first-start-preset
Hookshot:perf/zero-upload
Hookshot:fix/vcore-escape-2s
Hookshot:test/fake-gh-atomic
Hookshot:perf/batch-idle-flush
Hookshot:test/finish-stub-a
Hookshot:chore/record-2.1.0
Hookshot:fix/main-red-tests
Hookshot:fix/test-display-startup-driver-cache
Hookshot:feat/mesh-shader-mode
Hookshot:fix/menu-probes-at-startup
Hookshot:fix/fps-counter-classic
Hookshot:fix/test-log-batch-flake
Hookshot:fix/narrow-screen-hud
Hookshot:ci/prereleases
Hookshot:release/v2.0.15
Hookshot:hotfix/v2.0.15
Hookshot:fix/present-ahead-replay
Hookshot:release/v2.0.13
Hookshot:fix/bracket-paths-2013
Hookshot:fix/hdr-overlays-2013
Hookshot:fix/fps-counter-scale-2013
Hookshot:fix/stick-seen-at-rest
Hookshot:hotfix/menu-fits-screen
Hookshot:fix/f1-always-opens-menu
Hookshot:fix/ini-keep-lines
Hookshot:claude/cranky-pike-7cf247
Hookshot:perf/texture-answer-flat
Hookshot:fix/stamp-test-modules
Hookshot:fix/appimage-fonts
Hookshot:fix/display-awake
Hookshot:release/v2.0.12
Hookshot:fix/discord-windows
Hookshot:rc/v2.0.12-tests
Hookshot:fix/dlss-keep-feature
Hookshot:rc/v2.0.12
Hookshot: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
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
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
Hookshot/Hookshot!2900
Loading…
Reference in a new issue
No description provided.
Delete branch "snaildev99/Hookshot-fork: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 is #2478, restored here from GitHub without its author, so its branch cannot be brought up to date (it no longer merges). This is that work on currentmain, with the fixes from its review on Longshot. Supersedes #2478.(Opened a second time: it was pull request 3 here for a few hours, before the old issues and pull requests were restored and took the numbers.)
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. The build and the run were at b18ab96c; the branch has been rebased as
mainmoved, last ontomain@262ea386(head6db793b3; the comments say what each rebase changed), and the mod checks pass again there. That head is not built or played.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_coverand 23 fortake_text, so the Mods tab's five functions come after them as version 24 (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.pyat6db793b3on Windows 11: 541 passed, 81 skipped, 31 failed. The same thirty-one fail onmain@262ea386on this PC in the same run (537 passed there):test_builder_details_hitbox,test_builder_dlss_update,test_builder_dump_search,test_builder_upscaler_parts,test_controls_key_slots,test_cpm_discovery,test_cpp_preflight,test_crash_dialog,test_dev_packs,test_fastfp_fma,test_fpx_sticky,test_hdr_encode,test_linux_preflight,test_make_game_cache,test_make_game_prepare,test_missing_nup,test_oot_state_tap,test_options_budget_once,test_portable_archive,test_portable_builder_home,test_portable_builder_startup,test_portable_setup_start,test_portable_setup_transaction,test_readback_late,test_setup_runtime,test_setup_runtime_paths,test_spawn_emit,test_tested_configurations,test_updater_asset_digest,test_upscaler_round_trip,test_vram_budget_row; none of them is a mods or menu check.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
b5e3f992e30e86799d7dRebased onto main @
0822ffb4, since it no longer merged: head0e86799d. Two conflicts, both small and the same two as on Longshot's copy of this work:restart_valuesingpu/vk/vk_menu.cpp(main now reads a row's value throughrow_restart_value; the mods' slot is added after that loop as before) and the list of posix shims intests/test_mods_size_table.py(main's comment kept,MoveFileExAadded). The mod checks pass (the Mods tab, ExeFS patches, the cheat VM, the size table merge, the restart rows).tests/run_all.pyon Windows: 560 passed, 19 failed, 39 skipped, and the 19 are the same 19 that fail on main @0822ffb4on this PC (556 passed, 19 failed there). Not built or played again after this rebase: the run in the game described above is of b18ab96c.Rebased onto main @
a2bcc012, since it no longer merged: head779941c0. What changed:take_text) since the last rebase, so the Mods tab's five functions now followwide_cover(22) andtake_text(23) inMkwVkHostas version 24:vk_api.h, the table inhost/rx_backend.c(in the struct's order),can_mods()andtests/test_mods_menu.py. Nothing else about them changed.vk_menu.cpp, the rows' keys. Main's text field line (field_row) joins the block this branch moved inside the Mods tab'selse.tests/test_menu_text_field.py(main's new test), one new commit, the last. Its harness cutsrestart_valuesout of the menu, and that function also fills the mods' slot here, so the harness declares the slot (none),can_modsand the host'smods_changedbeside itspad_raw.The mod checks and the text field test pass.
tests/run_all.pyon Windows: 573 passed, 17 failed, 39 skipped, the same failures as main @a2bcc012on this PC in the same run (569 passed there). Not built or played again after this rebase or the one before: the run in the game described above is of b18ab96c. The same work on Longshot's side (their pull request 134) had the same three changes there.0e86799d7d779941c098779941c0986db793b3f8Rebased onto main @
262ea386(v2.3.1 and the commits after it), since it no longer merged: head6db793b3.gpu/vk/vk_menu.cpp: main added the weak laptop row's press (is_laptop_row) to the block this branch moves inside the Mods tab'selse; the line is in that block now. Nothing else in the seven commits changed (git range-diff: the first commit's one line, the other six equal). The API version stays 24 (main is at 23).OOT_environment, which holds the patches' file and its SHA-1, so a build with ExeFS patches never restores a lift made without them, or with other patches.gpu/vk/vk_menu.cppcompiles alone with the build's flags, andtests/run_all.pyon Windows gives 541 passed, 31 failed, 81 skipped, the same thirty-one as main @262ea386in the same run (537 passed there).Since the last comment, on the Longshot copy of this work (the same code): two
.pchtxtmods run for another tester, and an Atmosphere cheat file works (listed off, switched on in the game, in effect at once). A mod that ships only a code module (exefs/subsdk*) is listed and does nothing, without a note that says why; that note is a small follow-up I would send after this.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.