WIP: fix(menu): the restart line and question say which mods are switched, On or Off #305

Draft
snaildev99 wants to merge 6 commits from snaildev99/Longshot:fix/mods-restart-names into main
Contributor

Depends on #134 (the Mods tab): this branch is #134's head with one commit on top, so until #134 is in, the diff here shows its commits too. The commit to read is the last one. It stays work in progress until then.

Why

With #134's Mods tab, switching a mod asks for a restart, but the texts say "the mods" whatever changed: "Restart needed: the mods" and "Restart to apply the mods?" for one mod or five, switched on or off. A player who chose Later cannot see afterwards which mods wait for the restart, and after Later a mod switched again in the same visit to the menu is not asked about, where a row of the other tabs is. All three were found playing #134 by hand with eight mods.

What changed

  • the question (gpu/vk/vk_menu.cpp, draw_ask): it counts what a restart applies ("Restart to apply 1 setting and 2 mods?") and lists it under that, a line each with the menu's diamond: the rows changed, the mods switched with their switch's word ("Character field swap (Off)"), the order when it changed. Eight lines at most, the last one then how many more; the window is as tall as its lines, and as before for one line and no list. This is the question for the other tabs' rows too, which were all put into its one sentence.
  • the line (restart_line, gpu/vk/menu_restart.h line_forms): the rows stay by name, the mods come after them as a group: one mod's switch by name, more as "2 mods", the first form that fits the line ("Output resolution, 2 mods", then "Output resolution and 1 more, 2 mods", then "2 settings, 2 mods").
  • which mods (menu_restart.h mod_changes; mods_keep_start, restart_texts): the menu keeps the mods as the game started with them before the Mods tab's first change and tells what differs. No new host function: mod_info gives the list now. "the mods" stays for when the start's list is not known.
  • the Mods tab (draw_mods): a mod switched since the start has the gold mark a changed row has, and its help says it takes effect after a restart. The line is not shown while the selected mod's own switch is all that waits.
  • Later (menu_tick): a mod's change is told to the restart state as set_row tells a row's, so a mod switched again in the same visit is asked about at the next close.
  • tests: tests/test_menu_restart.cpp (mod_changes, list, line_forms), tests/test_mods_menu.py (the menu's use of them); the README's Mods section and its paragraph on the restart.

Flags and settings

Flag What it does Default now Recommendation Helps on Doesn't help on Untested on
The restart question and the "Restart needed" line (Insert menu; no new row or switch) name the mods switched, On or Off; the question lists what it applies, rows and mods always on every system - a language other than English (the new words " mod", " mods" and "the mods' order" have no translations yet, as the rest of the Mods tab)

Measurements

this PR: fix/mods-restart-names @ f3f11547
Baseline: #134 @ 5142c2d7
main has no Mods tab, so main against this PR would show #134's change, not this one's: the comparison is #134's head against this branch, which is that head with one commit.
Hardware: RTX 3090, Windows 11
Scene: the Insert menu's Mods and Graphics tabs over the game in play, 2048x1152, eight mods in the mods folder
Method: this PR's tests/test_menu_restart.cpp and tests/test_mods_menu.py on #134's sources and on this PR's (the files copied over #134's), twice each, the same result both times; and the menu by hand, with the pictures below
How to reproduce: python -I -B tests/test_menu_restart.py --cxx clang++ --cc clang, python -I -B tests/test_mods_menu.py --cxx clang++; in the game with two or more mods, F1, the Mods tab, switch two mods, close the menu

#134 @ 5142c2d7 this PR @ f3f11547
tests/test_menu_restart.cpp (this PR's) does not compile: no member named 'Mod' in namespace 'mkwvk::menu_restart' passes
tests/test_mods_menu.py (this PR's) fails: the restart line and question do not name the mods a restart would switch passes
Two mods switched off: the line "Restart needed: the mods" "Restart needed: 2 mods"
Two mods switched off: the question "Restart to apply the mods?" "Restart to apply 2 mods?" and the two mods under it, each with (Off)
After Later: the same mod switched On and Off again, then the menu closed not asked asked
#134 @ 5142c2d7:     tests/test_menu_restart.cpp:74:34: error: no member named 'Mod' in namespace 'mkwvk::menu_restart'
                     test_mods_menu: the restart line and question do not name the mods a restart would switch (menu_restart.h mod_changes)
this PR @ f3f11547:  menu restart: all checks passed
                     PASS: the Mods tab: its lines, the switches, moving a mod, the cheats; hidden without mods or an older host

Testing

Tested:

  • python -I -B tests/run_all.py on Windows 11 at f3f11547, with llvm-mingw's bin on the path: 498 passed, 36 skipped, 8 failed. The same eight fail on #134 @ 5142c2d7 and on its base of main on this PC: test_builder_details_hitbox, test_builder_dlss_update, test_portable_archive, test_portable_builder_home, test_portable_builder_startup (no .NET SDK here), test_check_third_party, test_release, test_setup_runtime.
  • vk_menu.cpp compiled alone at f3f11547 with the build's flags and include folders (-fsyntax-only): no error, no new warning.
  • In the game, by hand (a player, Windows 11, RTX 3090, 2048x1152, eight mods), in a build of this commit with the restart note's pull request (#304) on top (a local test branch). Confirmed by the tester one by one: a mod switched Off gets the gold mark and the line names it; after Later, a mod switched On and Off again is asked about at the close. Gone through by him with the pictures below taken, and no fault reported in the texts: two mods Off give "Restart needed: 2 mods" and the question "Restart to apply 2 mods?" with both listed; with a Graphics and an Audio row changed as well, the question counts settings and mods and lists them. The first cut (every mod by name in one sentence, "2 settings" for two mods on the line) was played before it and changed on his notes.

Not tested:

  • The order changed (the question's "the mods' order" line), more than eight lines in the question, a mod's name too long for its line: by the checks and the code only.
  • A narrow window, a gamepad, a menu language other than English, Linux.
  • This commit without #304's commits in the game (see above).

Needs other testers:

  • Linux: the branch builds, and with two mods switched the line says "2 mods" and the question lists them, expecting the same as on Windows (request to open, once #134 is in and this is rebased onto main)

Screenshots

From the test build named under Testing (this commit and #304's on top of #134), Windows 11, RTX 3090, taken by the tester, at this branch's second cut (the texts as they are now; the box of the help was moved since, in #304).

this PR, in the test build: the restart question counting what it applies, with the list under it

this PR (in the test build): the restart question, counting what it applies and listing it.

this PR, in the test build: the Mods tab with two mods switched

this PR (in the test build): the Mods tab with two mods switched, the line saying "2 mods".

Risk and rollback

The restart question changes for every tab: a count and a list where a sentence named the rows. A host whose mods change before the menu first runs would get "the mods" as before. Reverting the commit is enough.

Reviewer notes

  • The wording is the tester's choice among what I showed: " (Off)" for a mod, counts in the question's sentence so that one mod reads "1 mod", bullets under it.
  • No translations for the three new texts: the Mods tab's other texts on #134 have none either. The settings' count words are main's and translated.
  • A later idea from the tester, not done: the "Restart needed" line as a list too, a line a setting, in place of the one compact line.
  • #304 touches the same README paragraph and gives help_box a note with three states; whichever goes in second I rebase (the Mods tab's call then passes 1 before a switch and 2 after).

Issues

See #134

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots for a change that shows on screen.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.

🤖 Generated with Claude Code

**Depends on #134** (the Mods tab): this branch is #134's head with one commit on top, so until #134 is in, the diff here shows its commits too. The commit to read is the last one. It stays work in progress until then. ## Why With #134's Mods tab, switching a mod asks for a restart, but the texts say "the mods" whatever changed: "Restart needed: the mods" and "Restart to apply the mods?" for one mod or five, switched on or off. A player who chose Later cannot see afterwards which mods wait for the restart, and after Later a mod switched again in the same visit to the menu is not asked about, where a row of the other tabs is. All three were found playing #134 by hand with eight mods. ## What changed - the question (`gpu/vk/vk_menu.cpp`, `draw_ask`): it counts what a restart applies ("Restart to apply 1 setting and 2 mods?") and lists it under that, a line each with the menu's diamond: the rows changed, the mods switched with their switch's word ("Character field swap (Off)"), the order when it changed. Eight lines at most, the last one then how many more; the window is as tall as its lines, and as before for one line and no list. This is the question for the other tabs' rows too, which were all put into its one sentence. - the line (`restart_line`, `gpu/vk/menu_restart.h` `line_forms`): the rows stay by name, the mods come after them as a group: one mod's switch by name, more as "2 mods", the first form that fits the line ("Output resolution, 2 mods", then "Output resolution and 1 more, 2 mods", then "2 settings, 2 mods"). - which mods (`menu_restart.h` `mod_changes`; `mods_keep_start`, `restart_texts`): the menu keeps the mods as the game started with them before the Mods tab's first change and tells what differs. No new host function: `mod_info` gives the list now. "the mods" stays for when the start's list is not known. - the Mods tab (`draw_mods`): a mod switched since the start has the gold mark a changed row has, and its help says it takes effect after a restart. The line is not shown while the selected mod's own switch is all that waits. - Later (`menu_tick`): a mod's change is told to the restart state as `set_row` tells a row's, so a mod switched again in the same visit is asked about at the next close. - tests: `tests/test_menu_restart.cpp` (`mod_changes`, `list`, `line_forms`), `tests/test_mods_menu.py` (the menu's use of them); the README's Mods section and its paragraph on the restart. ## Flags and settings | Flag | What it does | Default now | Recommendation | Helps on | Doesn't help on | Untested on | |---|---|---|---|---|---|---| | The restart question and the "Restart needed" line (Insert menu; no new row or switch) | name the mods switched, On or Off; the question lists what it applies, rows and mods | always | on | every system | - | a language other than English (the new words " mod", " mods" and "the mods' order" have no translations yet, as the rest of the Mods tab) | ## Measurements this PR: fix/mods-restart-names @ f3f11547 Baseline: #134 @ 5142c2d7 main has no Mods tab, so main against this PR would show #134's change, not this one's: the comparison is #134's head against this branch, which is that head with one commit. Hardware: RTX 3090, Windows 11 Scene: the Insert menu's Mods and Graphics tabs over the game in play, 2048x1152, eight mods in the `mods` folder Method: this PR's `tests/test_menu_restart.cpp` and `tests/test_mods_menu.py` on #134's sources and on this PR's (the files copied over #134's), twice each, the same result both times; and the menu by hand, with the pictures below How to reproduce: `python -I -B tests/test_menu_restart.py --cxx clang++ --cc clang`, `python -I -B tests/test_mods_menu.py --cxx clang++`; in the game with two or more mods, F1, the Mods tab, switch two mods, close the menu | | #134 @ 5142c2d7 | this PR @ f3f11547 | |---|---|---| | `tests/test_menu_restart.cpp` (this PR's) | does not compile: `no member named 'Mod' in namespace 'mkwvk::menu_restart'` | passes | | `tests/test_mods_menu.py` (this PR's) | fails: `the restart line and question do not name the mods a restart would switch` | passes | | Two mods switched off: the line | "Restart needed: the mods" | "Restart needed: 2 mods" | | Two mods switched off: the question | "Restart to apply the mods?" | "Restart to apply 2 mods?" and the two mods under it, each with (Off) | | After Later: the same mod switched On and Off again, then the menu closed | not asked | asked | ``` #134 @ 5142c2d7: tests/test_menu_restart.cpp:74:34: error: no member named 'Mod' in namespace 'mkwvk::menu_restart' test_mods_menu: the restart line and question do not name the mods a restart would switch (menu_restart.h mod_changes) this PR @ f3f11547: menu restart: all checks passed PASS: the Mods tab: its lines, the switches, moving a mod, the cheats; hidden without mods or an older host ``` ## Testing **Tested:** - `python -I -B tests/run_all.py` on Windows 11 at f3f11547, with llvm-mingw's `bin` on the path: 498 passed, 36 skipped, 8 failed. The same eight fail on #134 @ 5142c2d7 and on its base of main on this PC: `test_builder_details_hitbox`, `test_builder_dlss_update`, `test_portable_archive`, `test_portable_builder_home`, `test_portable_builder_startup` (no .NET SDK here), `test_check_third_party`, `test_release`, `test_setup_runtime`. - `vk_menu.cpp` compiled alone at f3f11547 with the build's flags and include folders (`-fsyntax-only`): no error, no new warning. - In the game, by hand (a player, Windows 11, RTX 3090, 2048x1152, eight mods), in a build of this commit with the restart note's pull request (#304) on top (a local test branch). Confirmed by the tester one by one: a mod switched Off gets the gold mark and the line names it; after Later, a mod switched On and Off again is asked about at the close. Gone through by him with the pictures below taken, and no fault reported in the texts: two mods Off give "Restart needed: 2 mods" and the question "Restart to apply 2 mods?" with both listed; with a Graphics and an Audio row changed as well, the question counts settings and mods and lists them. The first cut (every mod by name in one sentence, "2 settings" for two mods on the line) was played before it and changed on his notes. **Not tested:** - The order changed (the question's "the mods' order" line), more than eight lines in the question, a mod's name too long for its line: by the checks and the code only. - A narrow window, a gamepad, a menu language other than English, Linux. - This commit without #304's commits in the game (see above). **Needs other testers:** - Linux: the branch builds, and with two mods switched the line says "2 mods" and the question lists them, expecting the same as on Windows (request to open, once #134 is in and this is rebased onto main) ## Screenshots From the test build named under Testing (this commit and #304's on top of #134), Windows 11, RTX 3090, taken by the tester, at this branch's second cut (the texts as they are now; the box of the help was moved since, in #304). ![this PR, in the test build: the restart question counting what it applies, with the list under it](https://git.magicbean.dev/attachments/85be6d44-61f4-4ef8-a86a-8a0a8a301e62) this PR (in the test build): the restart question, counting what it applies and listing it. ![this PR, in the test build: the Mods tab with two mods switched](https://git.magicbean.dev/attachments/178ef9db-bb08-44c0-a5fe-769aca81dabb) this PR (in the test build): the Mods tab with two mods switched, the line saying "2 mods". ## Risk and rollback The restart question changes for every tab: a count and a list where a sentence named the rows. A host whose mods change before the menu first runs would get "the mods" as before. Reverting the commit is enough. ## Reviewer notes - The wording is the tester's choice among what I showed: "<name> (Off)" for a mod, counts in the question's sentence so that one mod reads "1 mod", bullets under it. - No translations for the three new texts: the Mods tab's other texts on #134 have none either. The settings' count words are main's and translated. - A later idea from the tester, not done: the "Restart needed" line as a list too, a line a setting, in place of the one compact line. - #304 touches the same README paragraph and gives `help_box` a note with three states; whichever goes in second I rebase (the Mods tab's call then passes 1 before a switch and 2 after). ## Issues See #134 ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [ ] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [x] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Screenshots for a change that shows on screen. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Mods that each grow files (HD texture packs) could not be combined: only one
resource size table was used. Hookshot now merges every enabled mod's table
into the game's at start (the button prompts' entries kept) and raises the
entry of every file a mod serves to fit its size (host/mods.c, host/restbl.c,
host/zs.c). #2270's merge of the prompts' entries into the winning mod's table
stays as the fallback when no merged table can be made.

The Insert menu gets a Mods tab (shown only when there are mods): each mod on
or off and its place in the list, kept in hookshot_mods.txt and applied at the
next start (the restart question names them), and the cheats of the enabled
mods, switched at once.

ExeFS patches (IPS, IPS32, IPSwitch .pchtxt) are applied to main's image when
the game is built (nx2/exefs_patches.py, nx2/image.py), so the code is
translated from the patched instructions; a write into the padding after the
code (a code cave) makes it code. exefs_patches.txt in the game folder lists
what a build applied; the Mods tab says when a patch waits for a build.

Atmosphere cheat-code files (separate from the Debug tab's built-in cheats)
run in a cheat VM after dmnt's (host/cheats.c), every presented frame, on
guest memory the game was given; cheats that write the game's code are
listed as not supported.

The list, order and switches, the size table's merge, the patch formats and
the cheat VM follow valentderah/totk-pc-recomp (MIT), whose notice is kept in
host/restbl.h and nx2/exefs_patches.py.

Co-authored-by: Valiantsin Dzerakh <[email protected]>
Co-authored-by: conongnang <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The control bridge's bridge_fill names each MenuTab and checks the count: with the Mods tab
added before Debug, its table needs "mods" there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The compact bar (added to main after the Mods tab was written) draws the
selected row of the current tab. The Mods tab has no such rows: its lines come
from the host. With the bar asked for on the Mods tab the full page is drawn.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
- hos_mods_file gives prompts.c no table when the merged one is served.
- A mod that is off: its ExeFS files are not counted as waiting for a build
  (the Mods tab's text and the log's line).
- The Mods tab's texts and longshot_mods.txt's header say Longshot.
- A Restart or Quit waiting for its second press is cleared on the Mods tab.
- The merged size table: a mod file whose path is in another case than the
  game's takes the game's entry (looked up only when the mod's own case
  misses the table).
- exefs_patches.py: bytes into a relocated word are left out and the file's
  note says so; the comment on DT_RELR words says what happens.
- The compact bar on the Mods tab dims the game behind, as the full menu.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
docs(mods): the Mods tab's file and the two written beside it, in the development guide
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
5142c2d7b9
Co-Authored-By: Claude Fable 5.2 <[email protected]>
fix(menu): the restart line and question say which mods are switched, On or Off
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
f3f11547f0
"Restart needed: the mods" and "Restart to apply the mods?" read the same for
one mod or several, switched on or off, and the question put every changed
row into one sentence.

- The question counts what a restart applies ("Restart to apply 1 setting
  and 2 mods?") and lists it under that, a line each: the rows changed, the
  mods switched with their switch's word ("Character field swap (Off)"), the
  order when it changed. Eight lines at most; its window is as tall as its
  lines, and as before for one line and no list.
- The "Restart needed" line keeps the rows by name and groups the mods after
  them: one mod's switch by name, more as "2 mods"
  (menu_restart.h line_forms: the first form that fits the line).
- On the Mods tab the line is not shown while the selected mod's own
  switch, which its help says, is all that waits.
- menu_restart.h: mod_changes (what differs from the mods as the game
  started), list and line_forms, checked in tests/test_menu_restart.cpp;
  vk_menu.cpp keeps the mods as the game started before the Mods tab's
  first change. "the mods" stays for when they are not known.
- A mod switched since the start has the gold mark a changed row has, and
  its help says it takes effect after a restart.
- A mod's change is told to the restart state as set_row tells a row's:
  after Later, a mod switched again in the same visit to the menu is asked
  about at the next close.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request has changes conflicting with the target branch.
  • README.md
  • gpu/vk/vk_api.h
  • gpu/vk/vk_menu.cpp
  • host/rx_backend.c
  • tests/test_mods_size_table.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/mods-restart-names:snaildev99-fix/mods-restart-names'
git switch 'snaildev99-fix/mods-restart-names'
Sign in to join this conversation.
No reviewers
No milestone
No project
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
MagicBeanDev/Longshot!305
No description provided.