feat(mods): pause menu buttons for mods, and a Longshot Options button that opens the menu #3209

Merged
HumanBean merged 3 commits from HumanBean/Longshot:feat/pause-menu-button into main 2026-12-05 07:55:21 +00:00
Owner

Summary

The Insert menu can only be opened with a key (Insert, F1) or a pad chord, which a controller player may never find. The pause menu's System page now has a Longshot Options button below Title Screen that opens it.

The button is a system mod, system/menu-button (on by default, can be switched off in the Mods tab), over a new API any mod can use:

  • pauseMenu.addButton({ label }) from longshot/game, permission ui.pausemenu (low risk), with a pressed event and setLabel (the built-in button follows a change of Menu language), and setVisible.
  • Pause menu button (Debug tab, Developer page; on by default) hides or shows the built-in button at once, no restart. The page has room for two buttons, one per mod (docs/modding/pause-menu.md).
  • settingsHost.open() (system mods only), over a new LS_ACTION_OPEN renderer action.

This replaces #290 by @prob, which no longer fits how hooks are done on main. The idea, the extra layout pane and the button's construction are theirs; this is a rewrite on hook sites:

  • game/crates/game-core/src/pause_buttons/: two hidden panes are added to PaSystemMenu_00 in memory, as the game reads it (a Rust port of #290's pause_layout.py, working on the loaded, relocated layout). No game file is written, and the Button prompts' archive is left alone.
  • game/sites/sites.toml: five pauseButtons.* sites. All five must be placed, or has("game.pauseMenu") is false and nothing is changed on screen.
  • host/pad_mods.c: while the cursor is on a mod's button, the game does not see A, and the host counts its presses for that button. A choice the game makes of a button it does not know leaves the page unable to close.

Testing

Tested: Linux (CachyOS), NVIDIA RTX 3090, driver 620.70.06, this checkout built over a shared base, headless runs driven over the control bridge from the kokiri-start save, with the pad:

  • The button shows below Title Screen, the cursor stops on it, and the unused second slot stays hidden.
  • A opens the Insert menu (twice in a row); after closing it, B closes the pause menu back to play.
  • The pause menu reopens normally and the game's own buttons still work.
  • After switching to the Items tab from the button, A does not open the Insert menu. After closing with Plus on the button, A in play is the game's.

Game-free: new tests for the layout edit (including a loaded, relocated layout), the two slots, and a press while the cursor is on a button. The tests of host-sys, game-core, api, longshot-game, ffi-gen and the Insert menu's pass.

mise run test, the failures left:

  • these also fail on plain main on this PC: test_present_held_image, test_present_acquire_ahead, test_present_geometry_trace, test_present_image_free, test_dlssg, test_no_map_reload, test_no_game_title, test_sync_watch_event, test_ui_renderer, test_turf_budget, test_vk_draw_overhead_lean;
  • test_lifter also fails on plain main on this PC the same ways: its clippy step stops on settings_abi.rs, and cargo test --workspace fails in build-driver (tools.lock against the table), longshot-builder (one_copy) and net-broker (socket path too long here).

With the pause menu open, turning the checkbox's setting off and on (through the control bridge) hid and showed the button at once; a page opened while it was off had no button, the cursor stopped at Title Screen, and the shown button opened the menu. The checkbox itself was not clicked in the Insert menu.

Still to test:

  • A real controller and a mouse click on a desktop (the runs used the bridge's pad): choose the button, expecting the Insert menu, then close both, by hand.
  • Windows: the same, expecting the same, by hand or @Beanstalk.
  • A language other than English: expecting the button's translated text to draw in the game's font, by hand.
  • The game over screen after the pause menu was closed with the cursor on the button: expecting A to work there, by hand.

Measurements

Not measured: nothing is rendered or computed differently in play. The sites run when the pause menu's layout is read, its page is made and a button changes state; each frame adds one short check in the mods' services, and the pad read a flag load or two.

Risks

  • The pause menu's System page, on a game build where the layout or functions differ: the sites then do not resolve, or the layout is left alone with a warning, and the page is the game's.
  • While the cursor is on a mod's button, A is kept from the game; it lapses after 250 ms if the mods stop running.
  • Mods can add a button only before the game makes its pause menu; one added later shows from the next time it does.
  • Turning it off: switch "Pause menu button" off in the Mods tab, or revert.
  • Saves, settings and caches are unchanged. A game update needs the five sites found again.

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).
  • 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

  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Linux built; no llvm-mingw on this PC, waiting for CI.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • 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.

Co-Authored-By: prob [email protected]
Assisted-by: Claude Code (Claude Sonnet 5.5)

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV

## Summary The Insert menu can only be opened with a key (Insert, F1) or a pad chord, which a controller player may never find. The pause menu's System page now has a **Longshot Options** button below Title Screen that opens it. The button is a system mod, `system/menu-button` (on by default, can be switched off in the Mods tab), over a new API any mod can use: - `pauseMenu.addButton({ label })` from `longshot/game`, permission `ui.pausemenu` (low risk), with a `pressed` event and `setLabel` (the built-in button follows a change of Menu language), and `setVisible`. - **Pause menu button** (Debug tab, Developer page; on by default) hides or shows the built-in button at once, no restart. The page has room for two buttons, one per mod ([docs/modding/pause-menu.md](docs/modding/pause-menu.md)). - `settingsHost.open()` (system mods only), over a new `LS_ACTION_OPEN` renderer action. This replaces #290 by @prob, which no longer fits how hooks are done on `main`. The idea, the extra layout pane and the button's construction are theirs; this is a rewrite on hook sites: - `game/crates/game-core/src/pause_buttons/`: two hidden panes are added to `PaSystemMenu_00` **in memory**, as the game reads it (a Rust port of #290's `pause_layout.py`, working on the loaded, relocated layout). No game file is written, and the Button prompts' archive is left alone. - `game/sites/sites.toml`: five `pauseButtons.*` sites. All five must be placed, or `has("game.pauseMenu")` is false and nothing is changed on screen. - `host/pad_mods.c`: while the cursor is on a mod's button, the game does not see A, and the host counts its presses for that button. A choice the game makes of a button it does not know leaves the page unable to close. ## Testing **Tested:** Linux (CachyOS), NVIDIA RTX 3090, driver 620.70.06, this checkout built over a shared base, headless runs driven over the control bridge from the `kokiri-start` save, with the pad: - The button shows below Title Screen, the cursor stops on it, and the unused second slot stays hidden. - A opens the Insert menu (twice in a row); after closing it, B closes the pause menu back to play. - The pause menu reopens normally and the game's own buttons still work. - After switching to the Items tab from the button, A does not open the Insert menu. After closing with Plus on the button, A in play is the game's. Game-free: new tests for the layout edit (including a loaded, relocated layout), the two slots, and a press while the cursor is on a button. The tests of `host-sys`, `game-core`, `api`, `longshot-game`, `ffi-gen` and the Insert menu's pass. `mise run test`, the failures left: - these also fail on plain `main` on this PC: `test_present_held_image`, `test_present_acquire_ahead`, `test_present_geometry_trace`, `test_present_image_free`, `test_dlssg`, `test_no_map_reload`, `test_no_game_title`, `test_sync_watch_event`, `test_ui_renderer`, `test_turf_budget`, `test_vk_draw_overhead_lean`; - `test_lifter` also fails on plain `main` on this PC the same ways: its clippy step stops on `settings_abi.rs`, and `cargo test --workspace` fails in `build-driver` (`tools.lock` against the table), `longshot-builder` (`one_copy`) and `net-broker` (socket path too long here). With the pause menu open, turning the checkbox's setting off and on (through the control bridge) hid and showed the button at once; a page opened while it was off had no button, the cursor stopped at Title Screen, and the shown button opened the menu. The checkbox itself was not clicked in the Insert menu. **Still to test:** - A real controller and a mouse click on a desktop (the runs used the bridge's pad): choose the button, expecting the Insert menu, then close both, by hand. - Windows: the same, expecting the same, by hand or @Beanstalk. - A language other than English: expecting the button's translated text to draw in the game's font, by hand. - The game over screen after the pause menu was closed with the cursor on the button: expecting A to work there, by hand. ## Measurements Not measured: nothing is rendered or computed differently in play. The sites run when the pause menu's layout is read, its page is made and a button changes state; each frame adds one short check in the mods' services, and the pad read a flag load or two. ## Risks - The pause menu's System page, on a game build where the layout or functions differ: the sites then do not resolve, or the layout is left alone with a warning, and the page is the game's. - While the cursor is on a mod's button, A is kept from the game; it lapses after 250 ms if the mods stop running. - Mods can add a button only before the game makes its pause menu; one added later shows from the next time it does. - Turning it off: switch "Pause menu button" off in the Mods tab, or revert. - Saves, settings and caches are unchanged. A game update needs the five sites found again. ## 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). - [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 - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Linux built; no llvm-mingw on this PC, waiting for CI. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [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. Co-Authored-By: prob <[email protected]> Assisted-by: Claude Code (Claude Sonnet 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
feat(mods): pause menu buttons for mods, and a Longshot Options button that opens the menu
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
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
2874e5b7ea
game.pauseMenu.addButton (any mod, ui.pausemenu) and settingsHost.open (system
mods), with the system mod menu-button over them. Replaces #290, rewritten on
hook sites: the layout is edited in memory, and the host keeps A from the game
while the cursor is on a mod's button.

Co-Authored-By: prob <[email protected]>
Assisted-by: Claude Code (Claude Sonnet 5.5)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
Author
Owner

Tested in game: Linux (CachyOS), RTX 3090, driver 620.70.06, headless from the kokiri-start save, on f359e262 plus this branch: the Longshot Options button shows below Title Screen; A opens the Insert menu (twice); after closing it B closes the pause menu; reopening and the game's own buttons work.

Tested in game: Linux (CachyOS), RTX 3090, driver 620.70.06, headless from the kokiri-start save, on f359e262 plus this branch: the Longshot Options button shows below Title Screen; A opens the Insert menu (twice); after closing it B closes the pause menu; reopening and the game's own buttons work.
Author
Owner

The pause menu's System page, cursor moved down as far as it goes (Linux, RTX 3090, headless).

Before: main @ ee9e1ed7 (the shared base): five buttons.

main

After: this PR @ 2874e5b7: Longshot Options below Title Screen.

this PR

The pause menu's System page, cursor moved down as far as it goes (Linux, RTX 3090, headless). **Before: main @ ee9e1ed7** (the shared base): five buttons. ![main](https://git.magicbean.dev/attachments/637270f1-2b8f-48b4-9d90-308735a8ba00) **After: this PR @ 2874e5b7**: Longshot Options below Title Screen. ![this PR](https://git.magicbean.dev/attachments/c07e30e9-277e-4f27-ab16-b030e4064c34)
Member

Possibly related, for context:

  • issue #1724 Idea: Make the settings-menu hotkeys easier to discover — Addresses hard-to-discover settings-menu access
  • issue #2642 Idea: mod API: the game screens' button prompts, set by a mod, and every prompt clickable — Related mod API work for game-screen menu prompts
Possibly related, for context: - issue #1724 Idea: Make the settings-menu hotkeys easier to discover — Addresses hard-to-discover settings-menu access - issue #2642 Idea: mod API: the game screens' button prompts, set by a mod, and every prompt clickable — Related mod API work for game-screen menu prompts
Author
Owner
@review
BeanBot requested changes 2026-12-04 23:52:16 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The button works in the recorded Linux run, but input and lifecycle races can deliver the wrong action or let the game select a button it cannot handle. A failed button allocation can also leave a visible, nonfunctional button.

Adds mod buttons to the pause menu and a default-enabled system button that opens Longshot Options. It makes the menu easier to discover for controller players, at the cost of new layout hooks and input interception that need stronger synchronization and failure handling.

Blocking (2): must change before merging.

  1. L1 game/crates/game-core/src/pause_buttons/mod.rs:177: The frame and the worker-thread state hook can publish conflicting cursor states out of order. (more on the line) Do: Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving.
  2. L2 game/crates/game-core/src/pause_buttons/mod.rs:161: Presses are counted separately from their button identity, so a press can be delivered to a different button. (more on the line) Do: Record the selected button identity together with each press at input time, and drain those records in order at the service frame.

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

  • L3 host/pad_mods.c:92: Disarming resets the remembered A state even when A is still held. (more on the line) Do: Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge.
  • L4 game/crates/game-core/src/pause_buttons/mod.rs:285: The pane becomes visible before allocation and initialization of its button have succeeded. (more on the line) Do: Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails.
  • L5 game/mods/menu-button/src/main.ts:6: The built-in button translates its label only when the mod starts. (more on the line) Do: Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page.

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

  • L6: The player-facing input paths still need the recorded manual checks. When: The existing run uses a bridge-driven pad on Linux, so it does not show that a physical controller, mouse click or Windows input opens and closes both menus correctly. Do: Run the described controller and mouse checks on a desktop and the same open/close flow on Windows; also check a translated label and A on the game-over screen after leaving the pause menu from the button.

@fix can do L1, L2, L3, L4 and L5.

Checks: Still running: 11 checks.

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

Does it help: Yes for the demonstrated path: the author reports opening the menu twice and returning to play on Linux with an RTX 3090 using bridge-driven pad input. Physical controller, mouse, Windows, other languages and the game-over path remain untested.

Other systems: The hooks run on game worker threads, while the mod service runs at the acquire phase and the host filters pad reads from multiple threads. The change also affects mouse-generated A presses, game menu layout loading, translated labels and renderer menu actions. The recorded run covers one Linux/NVIDIA configuration; Windows and physical input remain unverified.

Switches: No environment switches added, changed or removed. The system/menu-button mod is enabled by default and can be disabled in the Mods tab; that default fits the feature, subject to the input fixes and remaining runs.

Reviewed: 2874e5b7ea against f359e26213: Read the repository rules, PR template, standards, commit and diff; read the new pause-button implementation, layout editor, service, host input path, menu action, schemas, system mod and its test. Skimmed translations, generated schema, documentation changes and other small integration changes. The rest of the changed code files and their surrounding callers were not all read in full; docs/review-checklist.md is absent.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance and credits the earlier button work.
  • The added layout test uses synthetic data, and the diff contains no apparent committed game output.
  • The renderer interface struct is unchanged, so this action addition does not itself require a MkwVkHost or MkwVkRenderer version bump.

Testing: No code, tests or scripts were run during review. All listed CI checks are still running; the author reports the game-free checks and one Linux game run described above.

Overlaps and merge order: The description says this replaces #290; no other overlap was established from the available checkout.


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

**Recommendation: Request changes.** The button works in the recorded Linux run, but input and lifecycle races can deliver the wrong action or let the game select a button it cannot handle. A failed button allocation can also leave a visible, nonfunctional button. Adds mod buttons to the pause menu and a default-enabled system button that opens Longshot Options. It makes the menu easier to discover for controller players, at the cost of new layout hooks and input interception that need stronger synchronization and failure handling. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/game-core/src/pause_buttons/mod.rs:177`: The frame and the worker-thread state hook can publish conflicting cursor states out of order. (more on the line) **Do:** Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving. 2. **L2** `game/crates/game-core/src/pause_buttons/mod.rs:161`: Presses are counted separately from their button identity, so a press can be delivered to a different button. (more on the line) **Do:** Record the selected button identity together with each press at input time, and drain those records in order at the service frame. **Should fix (3)**: not blocking, but worth doing before merging. - **L3** `host/pad_mods.c:92`: Disarming resets the remembered A state even when A is still held. (more on the line) **Do:** Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge. - **L4** `game/crates/game-core/src/pause_buttons/mod.rs:285`: The pane becomes visible before allocation and initialization of its button have succeeded. (more on the line) **Do:** Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails. - **L5** `game/mods/menu-button/src/main.ts:6`: The built-in button translates its label only when the mod starts. (more on the line) **Do:** Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L6**: The player-facing input paths still need the recorded manual checks. *When:* The existing run uses a bridge-driven pad on Linux, so it does not show that a physical controller, mouse click or Windows input opens and closes both menus correctly. **Do:** Run the described controller and mouse checks on a desktop and the same open/close flow on Windows; also check a translated label and A on the game-over screen after leaving the pause menu from the button. `@fix` can do L1, L2, L3, L4 and L5. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the demonstrated path: the author reports opening the menu twice and returning to play on Linux with an RTX 3090 using bridge-driven pad input. Physical controller, mouse, Windows, other languages and the game-over path remain untested. **Other systems:** The hooks run on game worker threads, while the mod service runs at the acquire phase and the host filters pad reads from multiple threads. The change also affects mouse-generated A presses, game menu layout loading, translated labels and renderer menu actions. The recorded run covers one Linux/NVIDIA configuration; Windows and physical input remain unverified. **Switches:** No environment switches added, changed or removed. The system/menu-button mod is enabled by default and can be disabled in the Mods tab; that default fits the feature, subject to the input fixes and remaining runs. **Reviewed:** 2874e5b7ea45 against f359e2621315: Read the repository rules, PR template, standards, commit and diff; read the new pause-button implementation, layout editor, service, host input path, menu action, schemas, system mod and its test. Skimmed translations, generated schema, documentation changes and other small integration changes. The rest of the changed code files and their surrounding callers were not all read in full; docs/review-checklist.md is absent.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance and credits the earlier button work. - The added layout test uses synthetic data, and the diff contains no apparent committed game output. - The renderer interface struct is unchanged, so this action addition does not itself require a MkwVkHost or MkwVkRenderer version bump. **Testing:** No code, tests or scripts were run during review. All listed CI checks are still running; the author reports the game-free checks and one Linux game run described above. **Overlaps and merge order:** The description says this replaces #290; no other overlap was established from the available checkout. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +158,4 @@
let mut s = state();
let mut pressed = Vec::new();
// (the presses are of the button the cursor was on when they were made: the last frame's)
if count != s.counted {
Member

L2 (blocking): Presses are counted separately from their button identity, so a press can be delivered to a different button.

When: The player presses A on the first mod button and moves to the second before the next service frame. The host increments its global counter, then on_state replaces s.on with the second key; frame delivers the first button's press to the second mod.

Do: Record the selected button identity together with each press at input time, and drain those records in order at the service frame.

**L2** (blocking): Presses are counted separately from their button identity, so a press can be delivered to a different button. *When:* The player presses A on the first mod button and moves to the second before the next service frame. The host increments its global counter, then on_state replaces s.on with the second key; frame delivers the first button's press to the second mod. **Do:** Record the selected button identity together with each press at input time, and drain those records in order at the service frame.
@ -0,0 +174,4 @@
// (a button taken away keeps its A from the game while the page still shows it: choosing it would lock the page)
s.on = slot.map_or(0, |i| page.keys[i]);
drop(s);
host_sys::input::pad_menu_button(slot.is_some());
Member

L1 (blocking): The frame and the worker-thread state hook can publish conflicting cursor states out of order.

When: A frame reads the old control state and decides the cursor is not on a mod button. The worker then moves onto the button and arms the host in on_state, but the frame subsequently publishes false. An A read before the next frame reaches the game, which can select the unknown button and leave the pause page unable to close.

Do: Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving.

**L1** (blocking): The frame and the worker-thread state hook can publish conflicting cursor states out of order. *When:* A frame reads the old control state and decides the cursor is not on a mod button. The worker then moves onto the button and arms the host in on_state, but the frame subsequently publishes false. An A read before the next frame reaches the game, which can select the unknown button and leave the pause page unable to close. **Do:** Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving.
@ -0,0 +282,4 @@
return Ok(());
}
let Some(button) = button else { continue };
let tree = call1(c, PART_LAYOUT, "a part's layout", &[page + PART_BODY])?;
Member

L4 (should fix): The pane becomes visible before allocation and initialization of its button have succeeded.

When: If the game's button allocation returns zero, make returns after setting VISIBLE. The page shows a button with no constructed control or press handler.

Do: Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails.

**L4** (should fix): The pane becomes visible before allocation and initialization of its button have succeeded. *When:* If the game's button allocation returns zero, make returns after setting VISIBLE. The page shows a button with no constructed control or press handler. **Do:** Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails.
@ -0,0 +3,4 @@
import { t } from "longshot/i18n";
import { open } from "longshot/settings-host";
const button = pauseMenu.addButton({ label: t("Longshot Options") });
Member

L5 (should fix): The built-in button translates its label only when the mod starts.

When: A player changes Menu language during a session. Other menu text changes, but reopening the pause menu still shows the button in the old language because the stored label never changes.

Do: Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page.

**L5** (should fix): The built-in button translates its label only when the mod starts. *When:* A player changes Menu language during a session. Other menu text changes, but reopening the pause menu still shows the button in the old language because the stored label never changes. **Do:** Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page.
host/pad_mods.c Outdated
@ -83,0 +89,4 @@
if (on) __atomic_store_n(&button_at_ns, hos_now_ns(), __ATOMIC_RELEASE);
if ((__atomic_load_n(&button_armed, __ATOMIC_RELAXED) != 0) == (on != 0)) return;
/* (reads are not seen while off the button: A is taken to be up when the cursor comes back) */
if (!on) __atomic_store_n(&button_down, 0u, __ATOMIC_SEQ_CST);
Member

L3 (should fix): Disarming resets the remembered A state even when A is still held.

When: A player holds A while moving from a game button onto a mod button. The next pad read sees armed and !was, counts a new press and invokes the mod even though A was not pressed again.

Do: Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge.

**L3** (should fix): Disarming resets the remembered A state even when A is still held. *When:* A player holds A while moving from a game button onto a mod button. The next pad read sees armed and !was, counts a new press and invokes the mod even though A was not pressed again. **Do:** Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge.
HumanBean changed title from WIP: feat(mods): pause menu buttons for mods, and a Longshot Options button that opens the menu to feat(mods): pause menu buttons for mods, and a Longshot Options button that opens the menu 2026-12-04 23:55:28 +00:00
BeanBot left a comment

Recommendation: Request changes. The button can receive a press intended for another mod, and competing cursor updates can leave A incorrectly exposed to or withheld from the game. The recorded manual input and platform checks also remain outstanding.

Adds a default-enabled Longshot Options button to the pause menu and an API for mods to add buttons. The Linux bridge-driven run shows the intended flow, but cursor and press handling still have correctness defects.

Blocking (2): must change before merging.

  1. L1 game/crates/game-core/src/pause_buttons/mod.rs:177: The frame and the worker-thread state hook can publish conflicting cursor states out of order. When: A frame reads the old control state and decides the cursor is not on a mod button. The worker then moves onto the button and arms the host in on_state, but the frame subsequently publishes false. An A read before the next frame reaches the game, which can select the unknown button and leave the pause page unable to close. Do: Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving.
  2. L2 game/crates/game-core/src/pause_buttons/mod.rs:161: Presses are counted separately from their button identity, so a press can be delivered to a different button. When: The player presses A on the first mod button and moves to the second before the next service frame. The host increments its global counter, then on_state replaces s.on with the second key; frame delivers the first button's press to the second mod. Do: Record the selected button identity together with each press at input time, and drain those records in order at the service frame.

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

  • L3 host/pad_mods.c:92: Disarming resets the remembered A state even when A is still held. When: A player holds A while moving from a game button onto a mod button. The next pad read sees armed and !was, counts a new press and invokes the mod even though A was not pressed again. Do: Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge.
  • L4 game/crates/game-core/src/pause_buttons/mod.rs:285: The pane becomes visible before allocation and initialization of its button have succeeded. When: If the game's button allocation returns zero, make returns after setting VISIBLE. The page shows a button with no constructed control or press handler. Do: Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails.
  • L5 game/mods/menu-button/src/main.ts:6: The built-in button translates its label only when the mod starts. When: A player changes Menu language during a session. Other menu text changes, but reopening the pause menu still shows the button in the old language because the stored label never changes. Do: Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page.

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

  • L6: The player-facing input paths still need the recorded manual checks. When: The existing run uses a bridge-driven pad on Linux, so it does not show that a physical controller, mouse click or Windows input opens and closes both menus correctly. Do: Run the described controller and mouse checks on a desktop and the same open/close flow on Windows; also check a translated label and A on the game-over screen after leaving the pause menu from the button.

@fix can do L1, L2, L3, L4 and L5.

Since the last review (on 2874e5b7ea)
Still open: L1 (The frame and the worker-thread state hook can publish conflicting cursor states out of or…); L2 (Presses are counted separately from their button identity, so a press can be delivered to…); L3 (Disarming resets the remembered A state even when A is still held.); L4 (The pane becomes visible before allocation and initialization of its button have succeeded…); L5 (The built-in button translates its label only when the mod starts.); L6 (The player-facing input paths still need the recorded manual checks.)

Checks: Still running: 11 checks.

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

Does it help: Yes for the tested flow: the author reports that the button appeared and opened the menu twice on Linux with an RTX 3090 using bridge-driven pad input. Real controller, mouse, Windows and other listed manual checks remain unverified.

Other systems: The host pad path runs on Windows and Linux and can affect A outside the mod button; the recorded run covers Linux through the control bridge. Translation rendering, mouse input, Windows and the game-over path remain untested as described in the pull request.

Switches: The system mod Pause menu button is enabled by default and can be disabled in the Mods tab. Its intended default makes the menu discoverable, but the input defects must be fixed before shipping it.

Reviewed: 2874e5b7ea against f359e26213: Read the pause-button core module, host pad implementation, built-in mod entry point, project rules and pull request template; inspected the related API and documentation, diff excerpts, commit list and recorded runs. The full diff, remaining changed code, generated files and translations were not read in full.; nothing run (a code review).

Checked and fine:

  • The recorded Linux bridge run exercises opening the menu twice, closing the pause menu and returning to play.
  • The core truncates button labels at a UTF-8 character boundary.

Testing: No commands that build or run the project were executed. The author reports game-free tests and a Linux bridge-driven game run; CI is still running.

Overlaps and merge order: The pull request says it replaces #290; no independent overlap check was available.


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

**Recommendation: Request changes.** The button can receive a press intended for another mod, and competing cursor updates can leave A incorrectly exposed to or withheld from the game. The recorded manual input and platform checks also remain outstanding. Adds a default-enabled Longshot Options button to the pause menu and an API for mods to add buttons. The Linux bridge-driven run shows the intended flow, but cursor and press handling still have correctness defects. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/game-core/src/pause_buttons/mod.rs:177`: The frame and the worker-thread state hook can publish conflicting cursor states out of order. *When:* A frame reads the old control state and decides the cursor is not on a mod button. The worker then moves onto the button and arms the host in on_state, but the frame subsequently publishes false. An A read before the next frame reaches the game, which can select the unknown button and leave the pause page unable to close. **Do:** Serialize cursor-state publication with the state hook, or publish a generation-tagged state so an older frame cannot overwrite a newer transition. Add a test for this interleaving. 2. **L2** `game/crates/game-core/src/pause_buttons/mod.rs:161`: Presses are counted separately from their button identity, so a press can be delivered to a different button. *When:* The player presses A on the first mod button and moves to the second before the next service frame. The host increments its global counter, then on_state replaces s.on with the second key; frame delivers the first button's press to the second mod. **Do:** Record the selected button identity together with each press at input time, and drain those records in order at the service frame. **Should fix (3)**: not blocking, but worth doing before merging. - **L3** `host/pad_mods.c:92`: Disarming resets the remembered A state even when A is still held. *When:* A player holds A while moving from a game button onto a mod button. The next pad read sees armed and !was, counts a new press and invokes the mod even though A was not pressed again. **Do:** Track the physical A edge across cursor transitions, including while the cursor is outside a mod button, and count only a new down edge. - **L4** `game/crates/game-core/src/pause_buttons/mod.rs:285`: The pane becomes visible before allocation and initialization of its button have succeeded. *When:* If the game's button allocation returns zero, make returns after setting VISIBLE. The page shows a button with no constructed control or press handler. **Do:** Construct and initialize the control before showing its pane, and roll back any partial construction when a later step fails. - **L5** `game/mods/menu-button/src/main.ts:6`: The built-in button translates its label only when the mod starts. *When:* A player changes Menu language during a session. Other menu text changes, but reopening the pause menu still shows the button in the old language because the stored label never changes. **Do:** Refresh or replace the button when the menu language changes, preserving its press handler and updating the next constructed page. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L6**: The player-facing input paths still need the recorded manual checks. *When:* The existing run uses a bridge-driven pad on Linux, so it does not show that a physical controller, mouse click or Windows input opens and closes both menus correctly. **Do:** Run the described controller and mouse checks on a desktop and the same open/close flow on Windows; also check a translated label and A on the game-over screen after leaving the pause menu from the button. `@fix` can do L1, L2, L3, L4 and L5. **Since the last review** (on 2874e5b7ea45) Still open: L1 (The frame and the worker-thread state hook can publish conflicting cursor states out of or…); L2 (Presses are counted separately from their button identity, so a press can be delivered to…); L3 (Disarming resets the remembered A state even when A is still held.); L4 (The pane becomes visible before allocation and initialization of its button have succeeded…); L5 (The built-in button translates its label only when the mod starts.); L6 (The player-facing input paths still need the recorded manual checks.) **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 flow: the author reports that the button appeared and opened the menu twice on Linux with an RTX 3090 using bridge-driven pad input. Real controller, mouse, Windows and other listed manual checks remain unverified. **Other systems:** The host pad path runs on Windows and Linux and can affect A outside the mod button; the recorded run covers Linux through the control bridge. Translation rendering, mouse input, Windows and the game-over path remain untested as described in the pull request. **Switches:** The system mod Pause menu button is enabled by default and can be disabled in the Mods tab. Its intended default makes the menu discoverable, but the input defects must be fixed before shipping it. **Reviewed:** 2874e5b7ea45 against f359e2621315: Read the pause-button core module, host pad implementation, built-in mod entry point, project rules and pull request template; inspected the related API and documentation, diff excerpts, commit list and recorded runs. The full diff, remaining changed code, generated files and translations were not read in full.; nothing run (a code review). **Checked and fine:** - The recorded Linux bridge run exercises opening the menu twice, closing the pause menu and returning to play. - The core truncates button labels at a UTF-8 character boundary. **Testing:** No commands that build or run the project were executed. The author reports game-free tests and a Linux bridge-driven game run; CI is still running. **Overlaps and merge order:** The pull request says it replaces #290; no independent overlap check was available. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.</sub>
fix(mods): pause menu buttons: the review's findings
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
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
7fcff12d7b
- each press is counted for its own button, and the state hook and the frame
  tell the host under one lock;
- a held A moved onto a button is not a press;
- a button's pane is shown only once its button is made;
- PauseMenuButton.setLabel, and the built-in button follows Menu language.

Assisted-by: Claude Code (Claude Sonnet 5.5)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
Author
Owner

BeanBot's five findings checked against the code, all held, fixed in 7fcff12d:

  • L1: the state hook runs before the control's new state is stored, so the frame could read the old one. The cursor is now kept from the state the hook is given, and both the hook and the frame tell the host under one lock (test: a_frame_never_undoes_what_the_cursor_just_did).
  • L2: the host counts presses per button slot (test: a_press_is_its_own_buttons_though_the_cursor_moved_on).
  • L3: A is followed at every read while mods have buttons, on a button or not, so a held A moved onto one is not a press.
  • L4: the pane is shown only after the button's constructor and set-up succeed; a failure forgets the slot.
  • L5: new PauseMenuButton.setLabel; the built-in button calls it when Menu language changes the text. It shows from the next time the menu is opened or its cursor moves.

Run again on the same PC (Linux, RTX 3090, bridge pad): the open/close steps, the tab and Plus edge cases, and a setLabel made while playing (a temporary line in the mod), which showed on the next opening and still opened the menu. L3 and L4 were not provoked in game.

The Insert menu's own tests pass except once on a loaded PC: the_menu_passes_its_tests missed its 2 ms a frame script budget (search 2.28 ms); it passed on the run before.

L6 (real controller, mouse, Windows, another language, game over) is still to test, as the description says.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV

BeanBot's five findings checked against the code, all held, fixed in 7fcff12d: - **L1:** the state hook runs before the control's new state is stored, so the frame could read the old one. The cursor is now kept from the state the hook is given, and both the hook and the frame tell the host under one lock (test: `a_frame_never_undoes_what_the_cursor_just_did`). - **L2:** the host counts presses per button slot (test: `a_press_is_its_own_buttons_though_the_cursor_moved_on`). - **L3:** A is followed at every read while mods have buttons, on a button or not, so a held A moved onto one is not a press. - **L4:** the pane is shown only after the button's constructor and set-up succeed; a failure forgets the slot. - **L5:** new `PauseMenuButton.setLabel`; the built-in button calls it when Menu language changes the text. It shows from the next time the menu is opened or its cursor moves. Run again on the same PC (Linux, RTX 3090, bridge pad): the open/close steps, the tab and Plus edge cases, and a `setLabel` made while playing (a temporary line in the mod), which showed on the next opening and still opened the menu. L3 and L4 were not provoked in game. The Insert menu's own tests pass except once on a loaded PC: `the_menu_passes_its_tests` missed its 2 ms a frame script budget (search 2.28 ms); it passed on the run before. L6 (real controller, mouse, Windows, another language, game over) is still to test, as the description says. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
Author
Owner

Pushed a Pause menu button checkbox (Debug tab, Developer page, on by default) that hides or shows the Longshot Options button live, over a new PauseMenuButton.setVisible. Checked in game on Linux (RTX 3090, headless) by setting it through the control bridge with the pause menu open.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV

Pushed a **Pause menu button** checkbox (Debug tab, Developer page, on by default) that hides or shows the Longshot Options button live, over a new `PauseMenuButton.setVisible`. Checked in game on Linux (RTX 3090, headless) by setting it through the control bridge with the pause menu open. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
feat(mods): a Debug checkbox that hides the Longshot Options button, live
Some checks failed
PR description / Title and description (pull_request_target) Failing after 8s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 21s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m26s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m45s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 13m37s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m42s
CI / Website build and checks (pull_request) Failing after 40s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 47m31s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
db2bcab9a2
PauseMenuButton.setVisible, and the menu-button system mod's setting
pause_menu_button (Debug, Developer page) over it.

Assisted-by: Claude Code (Claude Sonnet 5.5)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2NRBuhritgQ3NpoUV
HumanBean deleted branch feat/pause-menu-button 2026-12-05 07:55:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!3209
No description provided.