fix(mods): a patch mod turned off or on keeps the profile's game folder #3213

Merged
HumanBean merged 2 commits from snaildev99/Longshot:mods/switch-folder into main 2026-12-05 17:29:02 +00:00
Member

Summary

Turning a patch mod on or off in the Mods tab should need only a restart: the build puts its ExeFS patches in behind
a switch whether it is on or off, and the game sets them at its start. Through the builder it builds the game again
every time. The game folder's name (builds/<stamp>, the mods stamp) leaves out the patches of a mod that is off, so a
mod turned off or on names another folder, and the restart (or the next Play) builds a whole new one: about 4 minutes,
and a folder of about 2 GB for each set of switches. profiles.md says a mod switched that a build takes either way
changes nothing, which is what the game's own check does; the builder's name did not.

With this change:

  • The folder's name counts each mod's patches whether it is on or off (code modules still only when on), so switching
    a mod keeps the folder, and a switch's restart builds nothing. A mod of the emulators' layout whose patches an
    accepted converted copy brings is left out of the name whether the copy is on or off, so turning the copy off or on
    keeps the folder too.
  • The fast check compares the folder's record of the mods ("mods", the stamp the game checks too) with the mods
    now, with the folder's switch table: a mod whose patches the build fixed in (no switch: past the eighth, or sharing
    bytes with one that is no switch) turned on or off is built again, in the same folder. Before, that took a folder of
    its own. The same goes for a converted copy turned off or on: the build takes the original only while the copy is
    off (as on main), so the original comes in or goes, and that is built again in the folder.
  • The folder's name and the mods now come from one reading of the profile's mods (game_files::code_mods::Scan), so
    the check finds and hashes them once.

How to see it on main: turning_a_patch_mod_off_or_on_keeps_its_game_folder (build-driver) turns an accepted patch
mod off; on main the profile's game folder becomes another one (builds/default for its only mod).
turning_a_converted_copy_off_or_on_keeps_its_game_folder turns a converted copy off, both copies accepted; on main
that names another folder too.

Read first: game_files::code_mods::mods_stamp and Scan, then build_driver::play::rebuild_reason.

Testing

Tested: Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, with this PR's two commits on top of the other open
mod compatibility ports (none of which this depends on), adult Link in Kakariko. The profile's only mods are
four patch-only test mods (IPS32, one instruction each in the HUD's per-frame update), all four built in behind a
switch; update off, the three others on. The first Play built the folder once (builds/67a4f9165b5fdc6b, now the name
for every on/off state of the four). Then call A turned off and the game restarted through its builder (longshot-builder mod relaunch, the request the menu's Restart now makes):

longshot: the game asked to be started again
longshot: fast check: up to date (4.5 ms)
[hos host] mods: local/patch-hud-call-a-off: its ExeFS patches are off at this start (built in behind a switch)

in the same folder; turned on again, the next restart was up to date (4.6 ms) with its patches on, and the save loads
and plays. The same restart on main's builder, with a copy of the same profile:

longshot: the game asked to be started again
longshot: fast check: not built yet (2.7 ms)
longshot: updating the game folder: not built yet
longshot: Longshot is building the game (10 to 20 minutes the first time, less after). It starts by itself when it's done. (0 %)

and a new folder (builds/df2f3ed58c2e961a). On both sides the switch was set in profile.json, as the Mods tab
writes it, and the restart is the menu's.
After the rebase onto main @ 3a0f7d8f7 and the review's fixes, here @ 04de1a894, built with the other ports
merged (929bf025a), the same profile: call A turned off, the restart through the builder was fast check: up to date (15.8 ms) in the same folder (builds/67a4f9165b5fdc6b) with call A off, and on again up to date (4.1 ms) with it
on. The review's case of a converted copy (a second profile with Rupee Counter and local/rupee-counter-off, the
imported copy of an Atmosphere patch set that undoes Rupee Counter's hook, built in fixed, not behind a switch, with
the set's own folder off): the copy turned off was fast check: the mods that need a build changed (5.0 ms), then a
build into the same folder (builds/72764e29350b3da6), and the rupee counter came back in the game.
Game-free: turning_a_patch_mod_off_or_on_keeps_its_game_folder and
turning_a_converted_copy_off_or_on_keeps_its_game_folder in build-driver (below).

mise run test, run locally while CI's run waits for approval (Windows 11, tests/run_all.py --strict, 12 checks at
once), here @ 04de1a894 and on main @ 3a0f7d8f7: 843 passed, 16 failed, 52 skipped here; 845 passed, 14 failed, 52
skipped on main. 13 of the 16 also fail on main: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title,
test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image,
test_present_image_free, test_program_cache_store_record, test_sync_watch_event, test_turf_budget, test_ui_renderer.
The other three hit their timeouts while other work ran on the PC: test_audio_voice_biquad and
test_audio_wave_buffer_release pass here run alone (--exact); test_dev_update times out the same way on main @
3a0f7d8f7 beside the same load. This PR touches none of the sources they read. The checks that read play.rs and code_mods.rs
(test_game_start, test_recomplauncher_json) pass unchanged.

cargo test -p modtool --lib -- testing_game::tests::the_menu_passes_its_tests, the one modtool failure, again
on an idle PC (nothing else in the queue), twice here and twice on main @ f359e2621: it fails all four times, the same
way: every frame's script under 2.00 ms (the budget it measures, 2.00 to 2.30 ms) with search the one over it, at
2.62 and 3.21 ms here and 3.28 and 2.72 ms on main. It is main's, and this PR touches no modtool code.

Still to test:

  • Windows: the fast check's time on a large profile, against main (measurement, the review's L4)

Measurements

Verdict: It works: a switched patch mod turned off or on restarts in the same folder with no build (the fast check
in 4.6 ms), where main builds a whole new folder.

Setup: cargo test on Windows 11 (the before side is the test commit, 41cf0028c: main's code @ 3a0f7d8f7 with the
new tests),
then the restart in the game as Testing says (its before side is main's builder @ f577a1aea, the base of the mod
ports; mods_stamp and rebuild_reason, the lines this changes, are the same there and at f359e2621).

Before: main @ 3a0f7d8f7 (modtool's row: f359e2621; the game's row: f577a1aea) After: this PR @ 04de1a894 (modtool's and the game's rows: ddd6fa8dd)
turning_a_patch_mod_off_or_on_keeps_its_game_folder fails: turned off: the same game folder (left None: builds/default) passes
turning_a_converted_copy_off_or_on_keeps_its_game_folder fails: the copy turned off: the same game folder passes
cargo test -p build-driver --lib the 2 below fail too 226 passed, 2 failed
cargo test -p game-files --lib, -p mods-stamp --lib 60 and 10 passed
cargo test -p modtool --lib the menu test fails too (idle PC, twice) 251 passed, 1 failed (the menu test's time budget, as on main)
In the game: restart with call A turned off fast check: not built yet, a build of 5 min 22 s (two test suites running) into a new 1.9 GB folder fast check: up to date (4.5 ms), no build, the same folder

The two build-driver failures fail on main's code too and touch nothing here:
dev_runtime::tests::prepare_only_says_in_one_line_when_the_caches_stand (this PC's test runner sets
LONGSHOT_NO_PREPARE) and tools::tests::the_repository_s_lock_and_the_table_agree (tools.lock's Linux compiler
stamp is not the one the test pins).

Risks

  • A mod whose patches are fixed in the build, turned off and on, is built again in its folder each time; before, each
    state kept a folder (the second switch back was no build).
  • A converted copy of a mod of the emulators' layout, both copies accepted, turned off and on, is built again in its
    folder each time too (the original comes into the build or leaves it, which the game's own check needs as well);
    before, each state kept a folder.
  • A profile with a patch mod off, or a converted copy off beside its accepted original, names another folder than
    before this change: one build at the first play after updating.
  • game_files::code_mods now finds and hashes the mods once (Scan) for the folder's name, the record's stamp and
    the stamp now. The rule is the same (ordered, stamp and current_stamp give what they gave; their tests pass
    unchanged), but a mistake there would show as a build at every play or a folder not rebuilt.
  • Players: switching a patch mod restarts without a build. No save or setting changes. A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (run locally, Testing names them; CI's run waits for approval)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened. (tests/test_game_start.py and tests/test_recomplauncher_json.py read play.rs and code_mods.rs: they pass unchanged)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Turning a patch mod on or off in the Mods tab should need only a restart: the build puts its ExeFS patches in behind a switch whether it is on or off, and the game sets them at its start. Through the builder it builds the game again every time. The game folder's name (`builds/<stamp>`, the mods stamp) leaves out the patches of a mod that is off, so a mod turned off or on names another folder, and the restart (or the next Play) builds a whole new one: about 4 minutes, and a folder of about 2 GB for each set of switches. `profiles.md` says a mod switched that a build takes either way changes nothing, which is what the game's own check does; the builder's name did not. With this change: - The folder's name counts each mod's patches whether it is on or off (code modules still only when on), so switching a mod keeps the folder, and a switch's restart builds nothing. A mod of the emulators' layout whose patches an accepted converted copy brings is left out of the name whether the copy is on or off, so turning the copy off or on keeps the folder too. - The fast check compares the folder's record of the mods (`"mods"`, the stamp the game checks too) with the mods now, with the folder's switch table: a mod whose patches the build fixed in (no switch: past the eighth, or sharing bytes with one that is no switch) turned on or off is built again, in the same folder. Before, that took a folder of its own. The same goes for a converted copy turned off or on: the build takes the original only while the copy is off (as on `main`), so the original comes in or goes, and that is built again in the folder. - The folder's name and the mods now come from one reading of the profile's mods (`game_files::code_mods::Scan`), so the check finds and hashes them once. How to see it on `main`: `turning_a_patch_mod_off_or_on_keeps_its_game_folder` (build-driver) turns an accepted patch mod off; on `main` the profile's game folder becomes another one (`builds/default` for its only mod). `turning_a_converted_copy_off_or_on_keeps_its_game_folder` turns a converted copy off, both copies accepted; on `main` that names another folder too. Read first: `game_files::code_mods::mods_stamp` and `Scan`, then `build_driver::play::rebuild_reason`. ## Testing **Tested:** Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, with this PR's two commits on top of the other open mod compatibility ports (none of which this depends on), adult Link in Kakariko. The profile's only mods are four patch-only test mods (IPS32, one instruction each in the HUD's per-frame update), all four built in behind a switch; update off, the three others on. The first Play built the folder once (`builds/67a4f9165b5fdc6b`, now the name for every on/off state of the four). Then call A turned off and the game restarted through its builder (`longshot-builder mod relaunch`, the request the menu's Restart now makes): ``` longshot: the game asked to be started again longshot: fast check: up to date (4.5 ms) [hos host] mods: local/patch-hud-call-a-off: its ExeFS patches are off at this start (built in behind a switch) ``` in the same folder; turned on again, the next restart was `up to date (4.6 ms)` with its patches on, and the save loads and plays. The same restart on `main`'s builder, with a copy of the same profile: ``` longshot: the game asked to be started again longshot: fast check: not built yet (2.7 ms) longshot: updating the game folder: not built yet longshot: Longshot is building the game (10 to 20 minutes the first time, less after). It starts by itself when it's done. (0 %) ``` and a new folder (`builds/df2f3ed58c2e961a`). On both sides the switch was set in `profile.json`, as the Mods tab writes it, and the restart is the menu's. After the rebase onto `main` @ 3a0f7d8f7 and the review's fixes, here @ 04de1a894, built with the other ports merged (929bf025a), the same profile: call A turned off, the restart through the builder was `fast check: up to date (15.8 ms)` in the same folder (`builds/67a4f9165b5fdc6b`) with call A off, and on again `up to date (4.1 ms)` with it on. The review's case of a converted copy (a second profile with Rupee Counter and `local/rupee-counter-off`, the imported copy of an Atmosphere patch set that undoes Rupee Counter's hook, built in fixed, not behind a switch, with the set's own folder off): the copy turned off was `fast check: the mods that need a build changed (5.0 ms)`, then a build into the same folder (`builds/72764e29350b3da6`), and the rupee counter came back in the game. Game-free: `turning_a_patch_mod_off_or_on_keeps_its_game_folder` and `turning_a_converted_copy_off_or_on_keeps_its_game_folder` in `build-driver` (below). `mise run test`, run locally while CI's run waits for approval (Windows 11, `tests/run_all.py --strict`, 12 checks at once), here @ 04de1a894 and on `main` @ 3a0f7d8f7: 843 passed, 16 failed, 52 skipped here; 845 passed, 14 failed, 52 skipped on `main`. 13 of the 16 also fail on `main`: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title, test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image, test_present_image_free, test_program_cache_store_record, test_sync_watch_event, test_turf_budget, test_ui_renderer. The other three hit their timeouts while other work ran on the PC: test_audio_voice_biquad and test_audio_wave_buffer_release pass here run alone (`--exact`); test_dev_update times out the same way on `main` @ 3a0f7d8f7 beside the same load. This PR touches none of the sources they read. The checks that read `play.rs` and `code_mods.rs` (test_game_start, test_recomplauncher_json) pass unchanged. `cargo test -p modtool --lib -- testing_game::tests::the_menu_passes_its_tests`, the one `modtool` failure, again on an idle PC (nothing else in the queue), twice here and twice on `main` @ f359e2621: it fails all four times, the same way: `every frame's script under 2.00 ms` (the budget it measures, 2.00 to 2.30 ms) with `search` the one over it, at 2.62 and 3.21 ms here and 3.28 and 2.72 ms on `main`. It is `main`'s, and this PR touches no `modtool` code. **Still to test:** - Windows: the fast check's time on a large profile, against `main` (measurement, the review's L4) ## Measurements **Verdict:** It works: a switched patch mod turned off or on restarts in the same folder with no build (the fast check in 4.6 ms), where `main` builds a whole new folder. Setup: `cargo test` on Windows 11 (the before side is the test commit, 41cf0028c: `main`'s code @ 3a0f7d8f7 with the new tests), then the restart in the game as Testing says (its before side is `main`'s builder @ f577a1aea, the base of the mod ports; `mods_stamp` and `rebuild_reason`, the lines this changes, are the same there and at f359e2621). | | Before: main @ 3a0f7d8f7 (modtool's row: f359e2621; the game's row: f577a1aea) | After: this PR @ 04de1a894 (modtool's and the game's rows: ddd6fa8dd) | |---|---|---| | `turning_a_patch_mod_off_or_on_keeps_its_game_folder` | fails: `turned off: the same game folder` (left `None`: `builds/default`) | passes | | `turning_a_converted_copy_off_or_on_keeps_its_game_folder` | fails: `the copy turned off: the same game folder` | passes | | `cargo test -p build-driver --lib` | the 2 below fail too | 226 passed, 2 failed | | `cargo test -p game-files --lib`, `-p mods-stamp --lib` | | 60 and 10 passed | | `cargo test -p modtool --lib` | the menu test fails too (idle PC, twice) | 251 passed, 1 failed (the menu test's time budget, as on `main`) | | In the game: restart with call A turned off | `fast check: not built yet`, a build of 5 min 22 s (two test suites running) into a new 1.9 GB folder | `fast check: up to date (4.5 ms)`, no build, the same folder | The two `build-driver` failures fail on `main`'s code too and touch nothing here: `dev_runtime::tests::prepare_only_says_in_one_line_when_the_caches_stand` (this PC's test runner sets `LONGSHOT_NO_PREPARE`) and `tools::tests::the_repository_s_lock_and_the_table_agree` (`tools.lock`'s Linux compiler stamp is not the one the test pins). ## Risks - A mod whose patches are fixed in the build, turned off and on, is built again in its folder each time; before, each state kept a folder (the second switch back was no build). - A converted copy of a mod of the emulators' layout, both copies accepted, turned off and on, is built again in its folder each time too (the original comes into the build or leaves it, which the game's own check needs as well); before, each state kept a folder. - A profile with a patch mod off, or a converted copy off beside its accepted original, names another folder than before this change: one build at the first play after updating. - `game_files::code_mods` now finds and hashes the mods once (`Scan`) for the folder's name, the record's stamp and the stamp now. The rule is the same (`ordered`, `stamp` and `current_stamp` give what they gave; their tests pass unchanged), but a mistake there would show as a build at every play or a folder not rebuilt. - Players: switching a patch mod restarts without a build. No save or setting changes. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (run locally, Testing names them; CI's run waits for approval) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. (`tests/test_game_start.py` and `tests/test_recomplauncher_json.py` read `play.rs` and `code_mods.rs`: they pass unchanged) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The check of the fix that follows, on main's code. It fails there for the bug's reason: an accepted patch mod turned
off names another game folder (`mods_stamp` leaves its patches out), so the builder's play builds a new folder for a
switch the game sets at its start.

It also checks the fast check in that folder: a switch's patches need no build either way, and patches a build fixed
in (no switch) turned off are built again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(mods): a patch mod turned off or on keeps the profile's game folder
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
ddd6fa8dd3
The game folder's name (`builds/<stamp>`, `game_files::code_mods::mods_stamp`) left out the ExeFS patches of a mod
that is off, so turning a switched patch mod off or on named another folder, and the builder's play built a whole new
one for a switch the game sets at its start. The name now counts each mod's patches whether it is on or off (a code
module still only while on).

In that folder the fast check compares the build record's mods with the mods now and the folder's switch table
(`mods_stamp::compare`, as the game does at its start): a switch's patches turned on or off need no build, and
patches the build fixed in (no switch) are built again there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88, adult Link in Kakariko: four patch-only test mods built behind switches; call A turned off, then on, each a restart through the builder: fast check up to date (4.5 ms, 4.6 ms), the same game folder, its patches off then on at the start, the save loads and plays. On main's builder the same restart builds a new folder (fast check: not built yet).

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88, adult Link in Kakariko: four patch-only test mods built behind switches; call A turned off, then on, each a restart through the builder: fast check up to date (4.5 ms, 4.6 ms), the same game folder, its patches off then on at the start, the save loads and plays. On main's builder the same restart builds a new folder (fast check: not built yet).
Member

Possibly related, for context:

  • PR #2607 feat(builder): the profile's mods' ExeFS patches are built in, and a start builds again when they change — Earlier merged patch stamps trigger rebuilds when switch state changes; this PR revises folder identity and fast-check behavior.
Possibly related, for context: - PR #2607 feat(builder): the profile's mods' ExeFS patches are built in, and a start builds again when they change — Earlier merged patch stamps trigger rebuilds when switch state changes; this PR revises folder identity and fast-check behavior.
Author
Member

mise run test, run locally while CI's run waits for approval: 847 passed, 12 failed, 52 skipped here @ ddd6fa8dd; all 12 also fail on main @ f359e2621 run alone, with the same messages (named in Testing). test_game_start and test_recomplauncher_json, which read play.rs and code_mods.rs, pass unchanged. Boxes ticked.

mise run test, run locally while CI's run waits for approval: 847 passed, 12 failed, 52 skipped here @ ddd6fa8dd; all 12 also fail on main @ f359e2621 run alone, with the same messages (named in Testing). test_game_start and test_recomplauncher_json, which read play.rs and code_mods.rs, pass unchanged. Boxes ticked.
snaildev99 changed title from WIP: fix(mods): a patch mod turned off or on keeps the profile's game folder to fix(mods): a patch mod turned off or on keeps the profile's game folder 2026-12-05 02:43:49 +00:00
BeanBot left a comment

Recommendation: Approve. The reported Windows run shows that an ordinary switched patch mod can restart without another build. The fixed-in patch path and Linux behavior still need a run before merge, and CI is still running. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Patch mods generally keep the same game folder when toggled, avoiding a new build for patches controlled by a runtime switch. The fast check now reads the mods and switch table again, and fixed-in patches rebuild in the same folder when their state changes.

Should fix (1): not blocking, but worth doing before merging.

  • L1 builder/crates/game-files/src/code_mods.rs:36: A converted patch mod and its original emulator-layout copy can still change the folder when the converted mod is toggled. (more on the line) Do: Make folder naming account consistently for the suppressed original and converted copy across the toggle, and add a regression test for both accepted copies.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 builder/crates/build-driver/src/play.rs:776: The fixed-in patch rebuild path has not been exercised in the game. (more on the line) Do: Run a fixed-in patch mod off and on through the builder, checking that each required rebuild completes and the resulting game has the requested patch state.
  • L3 builder/crates/build-driver/src/play.rs:777: The changed builder path has not been tested on Linux. (more on the line) Do: On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state.
  • L4 builder/crates/build-driver/src/play.rs:777: The added mod scan's startup cost is unmeasured for a substantial mod collection. (more on the line) Do: Compare warm and cold fast-check times on main and this branch with a representative large profile, using repeated runs. (@fix does its part first: Reuse the already discovered and hashed mod data for the folder stamp and current record comparison.)

@fix can do L1 and L4.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested case: on Windows, the reported restart reused the folder with a 4.5–4.6 ms fast check; the main-branch comparison built a new 1.9 GB folder in 5 min 22 s. Those are single reported runs, and do not establish the startup cost for larger mod collections.

Other systems: The builder path affects Windows and Linux independently of GPU. The reported run covers switched patches on Windows; fixed-in patches and Linux have not been demonstrated in game. Saves, rendering, audio and input are not directly changed.

Switches: None added, changed or removed.

Reviewed: ddd6fa8dd3 against f359e26213: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the diff and commit messages. Read the changed code and the surrounding stamp, build-record, switch-planning and restart paths; skimmed existing tests and the changed reference documentation. docs/review-checklist.md and ../Tooling/AGENTS.md are absent from this checkout.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance in trailers.
  • The changed files contain no committed game-derived output, generated files, third-party changes or renderer API changes.
  • The game-free test checks folder reuse and the fixed-in comparison, and the reported main-branch run fails for the folder-name regression.
  • The existing builder-version check forces an update when a folder was built by another builder.

Testing: Read-only review; no commands from the project or tests were run. The author reports the Windows game run and game-free results; CI remains in progress.

Overlaps and merge order: Unknown; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as snaildev99 took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Windows run shows that an ordinary switched patch mod can restart without another build. The fixed-in patch path and Linux behavior still need a run before merge, and CI is still running. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Patch mods generally keep the same game folder when toggled, avoiding a new build for patches controlled by a runtime switch. The fast check now reads the mods and switch table again, and fixed-in patches rebuild in the same folder when their state changes. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `builder/crates/game-files/src/code_mods.rs:36`: A converted patch mod and its original emulator-layout copy can still change the folder when the converted mod is toggled. (more on the line) **Do:** Make folder naming account consistently for the suppressed original and converted copy across the toggle, and add a regression test for both accepted copies. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `builder/crates/build-driver/src/play.rs:776`: The fixed-in patch rebuild path has not been exercised in the game. (more on the line) **Do:** Run a fixed-in patch mod off and on through the builder, checking that each required rebuild completes and the resulting game has the requested patch state. - **L3** `builder/crates/build-driver/src/play.rs:777`: The changed builder path has not been tested on Linux. (more on the line) **Do:** On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state. - **L4** `builder/crates/build-driver/src/play.rs:777`: The added mod scan's startup cost is unmeasured for a substantial mod collection. (more on the line) **Do:** Compare warm and cold fast-check times on main and this branch with a representative large profile, using repeated runs. *(`@fix` does its part first: Reuse the already discovered and hashed mod data for the folder stamp and current record comparison.)* `@fix` can do L1 and L4. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested case: on Windows, the reported restart reused the folder with a 4.5–4.6 ms fast check; the main-branch comparison built a new 1.9 GB folder in 5 min 22 s. Those are single reported runs, and do not establish the startup cost for larger mod collections. **Other systems:** The builder path affects Windows and Linux independently of GPU. The reported run covers switched patches on Windows; fixed-in patches and Linux have not been demonstrated in game. Saves, rendering, audio and input are not directly changed. **Switches:** None added, changed or removed. **Reviewed:** ddd6fa8dd360 against f359e2621315: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the diff and commit messages. Read the changed code and the surrounding stamp, build-record, switch-planning and restart paths; skimmed existing tests and the changed reference documentation. docs/review-checklist.md and ../Tooling/AGENTS.md are absent from this checkout.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance in trailers. - The changed files contain no committed game-derived output, generated files, third-party changes or renderer API changes. - The game-free test checks folder reuse and the fixed-in comparison, and the reported main-branch run fails for the folder-name regression. - The existing builder-version check forces an update when a folder was built by another builder. **Testing:** Read-only review; no commands from the project or tests were run. The author reports the Windows game run and game-free results; CI remains in progress. **Overlaps and merge order:** Unknown; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as snaildev99 took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -772,1 +773,4 @@
}
// (in the folder the mods name, what the build took against what the game would take now: a patch mod turned on
// or off names the same folder, and only patches the build fixed in need it again, as the game's start finds)
if let Some(built) = &rec.mods
Member

L2 (should fix): The fixed-in patch rebuild path has not been exercised in the game.

When: The reported game run uses four switch-backed mods; the new game-free test supplies a synthetic switch table and record. A real mod beyond the switch limit or sharing bytes with a fixed-in patch follows a different build and restart path.

Do: Run a fixed-in patch mod off and on through the builder, checking that each required rebuild completes and the resulting game has the requested patch state.

**L2** (should fix): The fixed-in patch rebuild path has not been exercised in the game. *When:* The reported game run uses four switch-backed mods; the new game-free test supplies a synthetic switch table and record. A real mod beyond the switch limit or sharing bytes with a fixed-in patch follows a different build and restart path. **Do:** Run a fixed-in patch mod off and on through the builder, checking that each required rebuild completes and the resulting game has the requested patch state.
@ -773,0 +774,4 @@
// (in the folder the mods name, what the build took against what the game would take now: a patch mod turned on
// or off names the same folder, and only patches the build fixed in need it again, as the game's start finds)
if let Some(built) = &rec.mods
&& !::mods_stamp::compare(built, &game_files::code_mods::current_stamp(folder, Some(profile), Some(&mod_store())))
Member

L3 (should fix): The changed builder path has not been tested on Linux.

When: Linux players use the same folder selection and fast check, but the only reported in-game restart was on Windows.

Do: On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state.

**L3** (should fix): The changed builder path has not been tested on Linux. *When:* Linux players use the same folder selection and fast check, but the only reported in-game restart was on Windows. **Do:** On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state.
Member

L4 (should fix): The added mod scan's startup cost is unmeasured for a substantial mod collection.

When: Every up-to-date play now computes current_stamp after computing the folder stamp, reading and hashing the profile's mod code again; the reported timing covers four one-instruction patches.

Do: Compare warm and cold fast-check times on main and this branch with a representative large profile, using repeated runs.

**L4** (should fix): The added mod scan's startup cost is unmeasured for a substantial mod collection. *When:* Every up-to-date play now computes current_stamp after computing the folder stamp, reading and hashing the profile's mod code again; the reported timing covers four one-instruction patches. **Do:** Compare warm and cold fast-check times on main and this branch with a representative large profile, using repeated runs.
@ -29,3 +34,3 @@
let mods = ordered(Some(profile), store, &choices);
let from: Vec<(String, String)> = mods.iter().map(|m| (m.id.clone(), m.from.clone())).collect();
let stamp = profile_mods::stamp(&layout, &found_of(mods, &choices), &from, &[]);
let every: Vec<String> = mods.iter().map(|m| m.id.clone()).collect();
Member

L1 (should fix): A converted patch mod and its original emulator-layout copy can still change the folder when the converted mod is toggled.

When: When both copies are accepted, ordered() suppresses the original while the converted copy is on, but includes it when the converted copy is off. The new all-switch stamp therefore hashes different mod lists and the next restart selects another folder.

Do: Make folder naming account consistently for the suppressed original and converted copy across the toggle, and add a regression test for both accepted copies.

**L1** (should fix): A converted patch mod and its original emulator-layout copy can still change the folder when the converted mod is toggled. *When:* When both copies are accepted, ordered() suppresses the original while the converted copy is on, but includes it when the converted copy is off. The new all-switch stamp therefore hashes different mod lists and the next restart selects another folder. **Do:** Make folder naming account consistently for the suppressed original and converted copy across the toggle, and add a regression test for both accepted copies.
Author
Member

The menu test (modtool's one failure) again on an idle PC, nothing else in the queue: it fails twice here and twice on main @ f359e2621 the same way, search over the per-frame script budget (2.62 and 3.21 ms here, 3.28 and 2.72 ms on main, against 2.00 to 2.30 ms). It is main's; this PR touches no modtool code. Moved into Tested.

The menu test (modtool's one failure) again on an idle PC, nothing else in the queue: it fails twice here and twice on main @ f359e2621 the same way, search over the per-frame script budget (2.62 and 3.21 ms here, 3.28 and 2.72 ms on main, against 2.00 to 2.30 ms). It is main's; this PR touches no modtool code. Moved into Tested.
snaildev99 force-pushed mods/switch-folder from ddd6fa8dd3
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 04de1a894f
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 7s
2026-12-05 10:21:02 +00:00
Compare
Author
Member

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ 04de1a894. Tested (the game again on this head), mise run test (against main @ 3a0f7d8f7: the failures main doesn't have are timeouts under load, each passing alone or timing out on main beside the same load) and Measurements are updated. Answers to the review below.

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ 04de1a894. Tested (the game again on this head), `mise run test` (against main @ 3a0f7d8f7: the failures main doesn't have are timeouts under load, each passing alone or timing out on main beside the same load) and Measurements are updated. Answers to the review below.
Author
Member

L1 (a converted copy and its original change the folder when the copy is toggled): fixed, in the fix commit (04de1a894). The
folder's name (game_files::code_mods::mods_stamp) now leaves a mod of the emulators' layout to an accepted copy that
brings its patches whether the copy is on or off, so both states name the same folder. The toggle is still built again
there, as a fixed-in patch is: the game takes the original only while the copy is off (code_mods::ordered, the
game's own code_status rule), and the two have different ids, so the build's mods really change and the game's own
stamp check needs the build either way. The fast check finds that from the folder's record. The game's rule and the
build's choice of mods are unchanged; only the name moved. Test, in the test commit (41cf0028c):
turning_a_converted_copy_off_or_on_keeps_its_game_folder (build-driver), both copies accepted: the copy turned off
names the same folder and the check says Mods (the original comes in), built again, then on again: the same folder,
Mods again (the original left to the copy). It fails on the earlier head (the copy turned off: the same game folder: 2fbd9adb882a1aea against df7807c38f44d64f) and on main. Docs (builder.md, profiles.md) and Risks say
so.

L2 (the fixed-in rebuild path in the game): run on this head, built with the other ports merged. A profile with
Rupee Counter and local/rupee-counter-off (the imported copy of an Atmosphere patch set that undoes Rupee Counter's
hook, built in fixed): the copy turned off and the game restarted through its builder gave fast check: the mods that need a build changed (5.0 ms), then a build into the same folder (builds/72764e29350b3da6), and the rupee counter
came back in the game. That covers the converted copy (L1) and the fixed-in path at once. Testing says so.

L3 (Linux): not run here; for a Linux run.

L4 (the fast check reads and hashes the mods twice): the code part is fixed, in the fix commit (04de1a894). The mods are now
found once per check (game_files::code_mods::Scan: code_mods::find once, each mod's code hash and patch hash made
once), and the folder's name and the stamp now both come from that one scan (play::check and ensure_built pass it
to rebuild_reason). Before this, a play found and hashed the mods twice (the name, then the stamp now), and hashed
each accepted mod's code more than once inside each pass. The results don't change: the existing stamp and fast-check
tests pass unchanged. The name and the comparison now also read the same files at the same moment. The timing on a
large profile is still to measure.

**L1** (a converted copy and its original change the folder when the copy is toggled): fixed, in the fix commit (04de1a894). The folder's name (`game_files::code_mods::mods_stamp`) now leaves a mod of the emulators' layout to an accepted copy that brings its patches whether the copy is on or off, so both states name the same folder. The toggle is still built again there, as a fixed-in patch is: the game takes the original only while the copy is off (`code_mods::ordered`, the game's own `code_status` rule), and the two have different ids, so the build's mods really change and the game's own stamp check needs the build either way. The fast check finds that from the folder's record. The game's rule and the build's choice of mods are unchanged; only the name moved. Test, in the test commit (41cf0028c): `turning_a_converted_copy_off_or_on_keeps_its_game_folder` (build-driver), both copies accepted: the copy turned off names the same folder and the check says `Mods` (the original comes in), built again, then on again: the same folder, `Mods` again (the original left to the copy). It fails on the earlier head (`the copy turned off: the same game folder`: `2fbd9adb882a1aea` against `df7807c38f44d64f`) and on `main`. Docs (`builder.md`, `profiles.md`) and Risks say so. **L2** (the fixed-in rebuild path in the game): run on this head, built with the other ports merged. A profile with Rupee Counter and `local/rupee-counter-off` (the imported copy of an Atmosphere patch set that undoes Rupee Counter's hook, built in fixed): the copy turned off and the game restarted through its builder gave `fast check: the mods that need a build changed (5.0 ms)`, then a build into the same folder (`builds/72764e29350b3da6`), and the rupee counter came back in the game. That covers the converted copy (L1) and the fixed-in path at once. Testing says so. **L3** (Linux): not run here; for a Linux run. **L4** (the fast check reads and hashes the mods twice): the code part is fixed, in the fix commit (04de1a894). The mods are now found once per check (`game_files::code_mods::Scan`: `code_mods::find` once, each mod's code hash and patch hash made once), and the folder's name and the stamp now both come from that one scan (`play::check` and `ensure_built` pass it to `rebuild_reason`). Before this, a play found and hashed the mods twice (the name, then the stamp now), and hashed each accepted mod's code more than once inside each pass. The results don't change: the existing stamp and fast-check tests pass unchanged. The name and the comparison now also read the same files at the same moment. The timing on a large profile is still to measure.
Author
Member

Still to test now lists the measurement the review asked for, which the answers above say is still to run.

Still to test now lists the measurement the review asked for, which the answers above say is still to run.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The patch toggle avoids the unnecessary rebuild in the recorded Windows run, and the converted-copy case now keeps the same folder. A Linux run and the large-profile fast-check measurement remain outstanding. Recommend approval; not approved on the forge.

Patch mods built behind switches can be toggled without creating and building another game folder. Fixed-in patches and converted copies still rebuild when needed; the shared scan avoids reading and hashing mods twice.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3 builder/crates/build-driver/src/play.rs:777: The changed builder path has not been tested on Linux. When: Linux players use the same folder selection and fast check, but the only reported in-game restart was on Windows. Do: On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state.
  • L4 builder/crates/build-driver/src/play.rs:777: The fast check's startup cost on a substantial mod collection remains unmeasured. When: A player with a large mod collection runs the fast check; the cost relative to main is unknown. Do: Measure repeated fast checks on the same substantial profile and machine against main. (@fix does its part first: Reuse the already discovered and hashed mod data for the folder stamp and current record comparison.)

@fix can do L4.

Since the last review (on ddd6fa8dd3)
Resolved: L1 (A converted patch mod and its original emulator-layout copy can still change the folder wh…); L2 (The fixed-in patch rebuild path has not been exercised in the game.)
Still open: L3 (The changed builder path has not been tested on Linux.); L4 (The fast check's startup cost on a substantial mod collection remains unmeasured.)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes. In the recorded Windows run, turning a switched patch off reused the folder with a 4.5 ms fast check; the comparison on main built a new 1.9 GB folder in 5 minutes 22 seconds. The large-profile startup cost remains unmeasured.

Other systems: The builder path also runs on Linux, where it has not yet been tested. The changed code does not depend on GPU vendor; fixed-in patches and converted copies can still require a rebuild.

Switches: None added, changed or removed.

Reviewed: 04de1a894f against 3a0f7d8f7f: Read the repository rules, PR template, standards, changed code and diff, relevant stamp and rebuild paths, description, comments and recorded results. Skimmed the remaining surrounding tests and documentation; no generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • The folder name and current stamp use the same scan in both check and ensure_built.
  • The recorded fixed-in patch run exercises the rebuild path.
  • No new environment or player-facing switches are introduced.

Testing: Recorded Windows game runs and game-free tests cover the main toggle and converted-copy cases. Linux and large-profile timing remain outstanding; CI is still running. No commands from the pull request were run in this review.

Overlaps and merge order: none found


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The patch toggle avoids the unnecessary rebuild in the recorded Windows run, and the converted-copy case now keeps the same folder. A Linux run and the large-profile fast-check measurement remain outstanding. Recommend approval; not approved on the forge. Patch mods built behind switches can be toggled without creating and building another game folder. Fixed-in patches and converted copies still rebuild when needed; the shared scan avoids reading and hashing mods twice. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3** `builder/crates/build-driver/src/play.rs:777`: The changed builder path has not been tested on Linux. *When:* Linux players use the same folder selection and fast check, but the only reported in-game restart was on Windows. **Do:** On Linux, build a profile with a switch-backed patch mod and toggle it off and on through the builder, checking folder reuse and the patch state. - **L4** `builder/crates/build-driver/src/play.rs:777`: The fast check's startup cost on a substantial mod collection remains unmeasured. *When:* A player with a large mod collection runs the fast check; the cost relative to main is unknown. **Do:** Measure repeated fast checks on the same substantial profile and machine against main. *(`@fix` does its part first: Reuse the already discovered and hashed mod data for the folder stamp and current record comparison.)* `@fix` can do L4. **Since the last review** (on ddd6fa8dd360) Resolved: L1 (A converted patch mod and its original emulator-layout copy can still change the folder wh…); L2 (The fixed-in patch rebuild path has not been exercised in the game.) Still open: L3 (The changed builder path has not been tested on Linux.); L4 (The fast check's startup cost on a substantial mod collection remains unmeasured.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes. In the recorded Windows run, turning a switched patch off reused the folder with a 4.5 ms fast check; the comparison on main built a new 1.9 GB folder in 5 minutes 22 seconds. The large-profile startup cost remains unmeasured. **Other systems:** The builder path also runs on Linux, where it has not yet been tested. The changed code does not depend on GPU vendor; fixed-in patches and converted copies can still require a rebuild. **Switches:** None added, changed or removed. **Reviewed:** 04de1a894f29 against 3a0f7d8f7f34: Read the repository rules, PR template, standards, changed code and diff, relevant stamp and rebuild paths, description, comments and recorded results. Skimmed the remaining surrounding tests and documentation; no generated files or translations changed.; nothing run (a code review). **Checked and fine:** - The folder name and current stamp use the same scan in both check and ensure_built. - The recorded fixed-in patch run exercises the rebuild path. - No new environment or player-facing switches are introduced. **Testing:** Recorded Windows game runs and game-free tests cover the main toggle and converted-copy cases. Linux and large-profile timing remain outstanding; CI is still running. No commands from the pull request were run in this review. **Overlaps and merge order:** none found </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch mods/switch-folder 2026-12-05 17:29:03 +00:00
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 7s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!3213
No description provided.