fix(input): Sprint keeps its buttons after a restart; the controls' bindings move to Rust #3108

Merged
HumanBean merged 3 commits from HumanBean/Longshot:push-xlrluxqvxtpy into main 2026-12-03 23:35:40 +00:00
Owner

Summary

The bug (since #2822): turn Sprint on, restart the game: the Sprint row still reads On, but L3 and Shift no longer sprint until you turn it off and on again. Turning Sprint on moved Shift and the left stick's press onto Sprint in the host, but only the "off" path told the game to read the bindings back (binds_moved()), so the "on" move was never saved.

What this changes

  • The game now owns the controls' bindings. New crate game/crates/binds: the table, the rebind rules, Sprint's layout, the Layout presets and Reset. longshot-game keeps it beside the settings and saves every change where it is made.
  • The host (host/nn_hid.c) only copies the table when game_binds_generation moves; a read of the controllers keeps the copy it began with.
  • gpu/vk/menu/sprint.cpp and bindings.cpp are gone, with MkwVkHost.bind and binds_serial.
  • Nothing is repaired at start. A player on a nightly since #2822 whose Sprint reads On with no button turns it off and on once; that now saves. A broken file reads the same as one whose player cleared Sprint's inputs, so changing it at start could overwrite a chosen layout.
  • A read of the controllers keeps one copy of the bindings, with Sprint's row and Toggle in it; each change and the writing of its lines are one step under one lock.

Read first: game/crates/binds/src/lib.rs (ported from the C and C++), then edit_binds, change_binds and rules_after in game/crates/longshot-game/src/settings_now.rs, then binds_load in host/nn_hid.c.

Conflicts to expect with other open PRs on the same code: #2753, #1709, #3031, #3044.

Testing

Not tested in the game. The person this was done for asked to skip the game test. Nothing here has run with a controller or keyboard.

Tested (Linux, RTX 3090; no one has played it yet):

  • On head 159d3ca0, rebased onto main 6318f405 (one conflict: #3105 also took MKWVK_API_VERSION 90, so this is now 91): cargo check of the touched crates, ffi-gen --check and test_sprint, test_bound_keys, test_input_background, test_prompt_current_binds pass. The runs below are from before the rebase.
  • On head 54613068 (base main 76092c5e): a Linux runtime builds, and dev.py smoke passes (headless: in play from kokiri-start, 900 frames, the Insert menu opened). It does not touch Sprint or any binding.
  • On the same head: the tests of binds, host-sys and longshot-game pass.
  • tests/sprint_saved.rs copied onto plain main fails there for the bug's reason: the file has sprint = true and no pad_sprint.
  • On earlier heads: the workspace's Rust tests, clippy, the generated files (0aeb6858); mise run test with 10 failures, 8 also on plain main and since fixed there, 2 this branch's and fixed (313178e5); the host's C compiled for Windows (llvm-mingw, compile only) (313178e5).
  • Not run on this head: the whole suite, api's and modtool's tests, clippy, the Windows compile (CI runs them).

Still to test:

  • Any OS, by hand: turn Sprint on, restart, sprint with L3 and with Shift while moving; turn it off and check L3 and B are back.
  • Any OS, by hand: with a settings.toml from a nightly that has the bug (Sprint on, no button), turn Sprint off and on, restart, and check it still works.
  • Any OS, by hand: rebind a button and a key (also onto one in use), each Layout preset, one control's Reset and Reset to defaults, restart and check all are kept.
  • Any OS, by hand: the HUD shortcut, the ocarina note controls, Walk, Hold/Toggle, button prompts after a rebind.
  • Windows: a game start (@Beanstalk or by hand).

Measurements

Not measured. The input read's change: an atomic load per read to see whether the bindings moved, a copy of the 128-byte table only when they did, and two reader locks gone.

Risks

  • Players' saved bindings: the file's pad_, key_ and sprint_auto_bind lines keep their names and values; the reader is now Rust. A porting slip would show as controls lost or changed after updating. A revert is enough.
  • The host log no longer prints "hid: N controls from longshot_options.ini".

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. (Skipped on request.)
  • mise run test passes (any failure that also fails on main is named). (Not rerun on this head, see Testing.)
  • Measured against main, or Measurements says why there is nothing to measure. (Not measured.)
  • 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. (game/crates/longshot-game/tests/sprint_saved.rs)
  • A check under tests/ that reads changed source is updated, not weakened. (test_pad_layout, test_plus_binding and test_ocarina_note_bindings tested the removed C: their table rules are now game/crates/binds' tests. test_bound_keys and test_sprint keep their host checks.)
  • MKWVK_API_VERSION bumped (MkwVkHost or MkwVkRenderer in gpu/vk/vk_api.h changed).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Done before the last rebases, not on this head.)
  • 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 **The bug (since #2822):** turn Sprint on, restart the game: the Sprint row still reads On, but L3 and Shift no longer sprint until you turn it off and on again. Turning Sprint on moved Shift and the left stick's press onto Sprint in the host, but only the "off" path told the game to read the bindings back (`binds_moved()`), so the "on" move was never saved. **What this changes** - The game now owns the controls' bindings. New crate `game/crates/binds`: the table, the rebind rules, Sprint's layout, the Layout presets and Reset. `longshot-game` keeps it beside the settings and saves every change where it is made. - The host (`host/nn_hid.c`) only copies the table when `game_binds_generation` moves; a read of the controllers keeps the copy it began with. - `gpu/vk/menu/sprint.cpp` and `bindings.cpp` are gone, with `MkwVkHost.bind` and `binds_serial`. - **Nothing is repaired at start.** A player on a nightly since #2822 whose Sprint reads On with no button turns it off and on once; that now saves. A broken file reads the same as one whose player cleared Sprint's inputs, so changing it at start could overwrite a chosen layout. - A read of the controllers keeps one copy of the bindings, with Sprint's row and Toggle in it; each change and the writing of its lines are one step under one lock. Read first: `game/crates/binds/src/lib.rs` (ported from the C and C++), then `edit_binds`, `change_binds` and `rules_after` in `game/crates/longshot-game/src/settings_now.rs`, then `binds_load` in `host/nn_hid.c`. Conflicts to expect with other open PRs on the same code: #2753, #1709, #3031, #3044. ## Testing **Not tested in the game.** The person this was done for asked to skip the game test. Nothing here has run with a controller or keyboard. **Tested** (Linux, RTX 3090; no one has played it yet): - On head 159d3ca0, rebased onto `main` 6318f405 (one conflict: #3105 also took `MKWVK_API_VERSION` 90, so this is now 91): `cargo check` of the touched crates, `ffi-gen --check` and `test_sprint`, `test_bound_keys`, `test_input_background`, `test_prompt_current_binds` pass. The runs below are from before the rebase. - On head 54613068 (base `main` 76092c5e): a Linux runtime builds, and `dev.py smoke` passes (headless: in play from `kokiri-start`, 900 frames, the Insert menu opened). It does not touch Sprint or any binding. - On the same head: the tests of `binds`, `host-sys` and `longshot-game` pass. - `tests/sprint_saved.rs` copied onto plain `main` fails there for the bug's reason: the file has `sprint = true` and no `pad_sprint`. - On earlier heads: the workspace's Rust tests, clippy, the generated files (0aeb6858); `mise run test` with 10 failures, 8 also on plain `main` and since fixed there, 2 this branch's and fixed (313178e5); the host's C compiled for Windows (llvm-mingw, compile only) (313178e5). - **Not run on this head:** the whole suite, `api`'s and `modtool`'s tests, clippy, the Windows compile (CI runs them). **Still to test:** - Any OS, by hand: turn Sprint on, restart, sprint with L3 and with Shift while moving; turn it off and check L3 and B are back. - Any OS, by hand: with a `settings.toml` from a nightly that has the bug (Sprint on, no button), turn Sprint off and on, restart, and check it still works. - Any OS, by hand: rebind a button and a key (also onto one in use), each Layout preset, one control's Reset and Reset to defaults, restart and check all are kept. - Any OS, by hand: the HUD shortcut, the ocarina note controls, Walk, Hold/Toggle, button prompts after a rebind. - Windows: a game start (@Beanstalk or by hand). ## Measurements Not measured. The input read's change: an atomic load per read to see whether the bindings moved, a copy of the 128-byte table only when they did, and two reader locks gone. ## Risks - Players' saved bindings: the file's `pad_`, `key_` and `sprint_auto_bind` lines keep their names and values; the reader is now Rust. A porting slip would show as controls lost or changed after updating. A revert is enough. - The host log no longer prints "hid: N controls from longshot_options.ini". ## Checklist ### Ready for review - [x] 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. (Skipped on request.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (Not rerun on this head, see Testing.) - [ ] Measured against `main`, or Measurements says why there is nothing to measure. (Not measured.) - [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. (`game/crates/longshot-game/tests/sprint_saved.rs`) - [x] A check under `tests/` that reads changed source is updated, not weakened. (`test_pad_layout`, `test_plus_binding` and `test_ocarina_note_bindings` tested the removed C: their table rules are now `game/crates/binds`' tests. `test_bound_keys` and `test_sprint` keep their host checks.) - [x] `MKWVK_API_VERSION` bumped (`MkwVkHost` or `MkwVkRenderer` in `gpu/vk/vk_api.h` changed). - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Done before the last rebases, not on this head.) - [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)
fix(input): Sprint keeps its buttons after a restart; the controls' bindings move to Rust
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
e0ce70df5f
Turning Sprint on moved Shift and the left stick's press onto it but never
saved them: the renderer moved the host's bindings and had to tell the game
to read them back, and the on path did not. After a restart Sprint read On
with no button.

The game now owns the bindings (game/crates/binds: the table, the rebind
rules, Sprint's layout, the Layout presets, Reset) and saves every change
where it is made. The host only copies the table. A saved file with Sprint
on and no key or button is given its layout at the start.

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

Possibly related, for context:

  • PR #1929 feat(input): sprint on Shift or the left stick's press, the game's own post-roll run (#196 carried onto main) — Merged Sprint implementation whose auto-binding persistence this PR revises
Possibly related, for context: - PR #1929 feat(input): sprint on Shift or the left stick's press, the game's own post-roll run (#196 carried onto main) — Merged Sprint implementation whose auto-binding persistence this PR revises
HumanBean changed title from WIP: fix(input): Sprint keeps its buttons after a restart; the controls' bindings move to Rust to fix(input): Sprint keeps its buttons after a restart; the controls' bindings move to Rust 2026-12-03 20:15:49 +00:00
Author
Owner
@review
BeanBot requested changes 2026-12-03 20:17:42 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The migration can mix binding versions within one input report and can save stale bindings after concurrent edits. Startup repair also overwrites deliberately empty Sprint bindings, and the fix has not been exercised in the game.

The change moves binding ownership into the game and saves Sprint's automatically assigned inputs. It also replaces the host's locked input snapshot with per-thread copies and repairs unbound Sprint settings at startup; those paths need correction before merge.

Blocking (2): must change before merging.

  1. L3 game/crates/longshot-game/src/settings_now.rs:598: The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs. (more on the line) Do: Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs.
  2. L5 game/crates/longshot-game/src/settings_now.rs:1249: The fix lacks the repository-required game-free regression test that can demonstrate the failure on the base. (more on the line) Do: Add a game-free regression harness that exercises the old and new observable save-and-restart behavior and fails on the base while passing here.

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

  • L1 host/nn_hid.c:1199: An input read can replace its bindings after it has started, despite marking the snapshot active. (more on the line) Do: Load once at the start of the report and make every later load respect input_snapshot_active; publish Sprint's setting and its bindings as one coherent input snapshot too.
  • L2 game/crates/longshot-game/src/settings_now.rs:637: Binding edits and their serialization are not ordered as one operation. (more on the line) Do: Serialize each table mutation and its complete document update with a shared transaction lock, including binding rules and resets.
  • L4 game/crates/binds/src/lib.rs:226: The numeric parser saturates multiplication but can still overflow when it adds the next digit. (more on the line) Do: Use saturating_add as well, or parse with checked arithmetic and reject out-of-range values.

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

  • L6: The migrated input path has not been exercised in the game. When: The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. Do: Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results.

@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: Unproven. The added Rust tests cover save and reload behavior, but the PR reports no keyboard or controller game run and no before-and-after measurements.

Other systems: The binding table feeds keyboard, mouse, gamepad, HUD shortcut, ocarina notes and prompts on Windows and Linux. Concurrent changes can affect a controller report in progress; neither platform has a reported game run on this head.

Switches: No switches added, changed or removed.

Reviewed: e0ce70df5f against 76092c5e5a: Read the available AGENTS.md, CONTRIBUTING.md and PR template; docs/review-checklist.md and ../Tooling/AGENTS.md were absent. Read the commit and portions of the diff, including the binding table, startup and persistence code, host input snapshot and API wiring. The full set of changed files, surrounding callers, tests, documentation and generated files was not read in full; this review cannot establish that all problems were found.; nothing run (a code review).

Checked and fine:

  • MKWVK_API_VERSION is bumped for the host interface change.
  • The commit records AI assistance in a Co-Authored-By trailer.
  • The listed CI checks are still running; none is reported failing only on this head.

Testing: Read-only review; no tests, builds or project scripts were run. The PR reports cargo check on the head's base, earlier checks on other bases, and no game test.

Overlaps and merge order: The PR identifies #2753, #1709, #3031 and #3044 as conflicting work; their current state and merge order were not available in the checkout.


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

**Recommendation: Request changes.** The migration can mix binding versions within one input report and can save stale bindings after concurrent edits. Startup repair also overwrites deliberately empty Sprint bindings, and the fix has not been exercised in the game. The change moves binding ownership into the game and saves Sprint's automatically assigned inputs. It also replaces the host's locked input snapshot with per-thread copies and repairs unbound Sprint settings at startup; those paths need correction before merge. **Blocking (2)**: must change before merging. 1. **L3** `game/crates/longshot-game/src/settings_now.rs:598`: The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs. (more on the line) **Do:** Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs. 2. **L5** `game/crates/longshot-game/src/settings_now.rs:1249`: The fix lacks the repository-required game-free regression test that can demonstrate the failure on the base. (more on the line) **Do:** Add a game-free regression harness that exercises the old and new observable save-and-restart behavior and fails on the base while passing here. **Should fix (3)**: not blocking, but worth doing before merging. - **L1** `host/nn_hid.c:1199`: An input read can replace its bindings after it has started, despite marking the snapshot active. (more on the line) **Do:** Load once at the start of the report and make every later load respect input_snapshot_active; publish Sprint's setting and its bindings as one coherent input snapshot too. - **L2** `game/crates/longshot-game/src/settings_now.rs:637`: Binding edits and their serialization are not ordered as one operation. (more on the line) **Do:** Serialize each table mutation and its complete document update with a shared transaction lock, including binding rules and resets. - **L4** `game/crates/binds/src/lib.rs:226`: The numeric parser saturates multiplication but can still overflow when it adds the next digit. (more on the line) **Do:** Use saturating_add as well, or parse with checked arithmetic and reject out-of-range values. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L6**: The migrated input path has not been exercised in the game. *When:* The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. **Do:** Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results. `@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:** Unproven. The added Rust tests cover save and reload behavior, but the PR reports no keyboard or controller game run and no before-and-after measurements. **Other systems:** The binding table feeds keyboard, mouse, gamepad, HUD shortcut, ocarina notes and prompts on Windows and Linux. Concurrent changes can affect a controller report in progress; neither platform has a reported game run on this head. **Switches:** No switches added, changed or removed. **Reviewed:** e0ce70df5f30 against 76092c5e5a3b: Read the available AGENTS.md, CONTRIBUTING.md and PR template; docs/review-checklist.md and ../Tooling/AGENTS.md were absent. Read the commit and portions of the diff, including the binding table, startup and persistence code, host input snapshot and API wiring. The full set of changed files, surrounding callers, tests, documentation and generated files was not read in full; this review cannot establish that all problems were found.; nothing run (a code review). **Checked and fine:** - MKWVK_API_VERSION is bumped for the host interface change. - The commit records AI assistance in a Co-Authored-By trailer. - The listed CI checks are still running; none is reported failing only on this head. **Testing:** Read-only review; no tests, builds or project scripts were run. The PR reports cargo check on the head's base, earlier checks on other bases, and no game test. **Overlaps and merge order:** The PR identifies #2753, #1709, #3031 and #3044 as conflicting work; their current state and merge order were not available in the 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 +223,4 @@
Some(t) => (-1, t),
None => (1, t.strip_prefix('+').unwrap_or(t)),
};
sign * t.bytes().take_while(u8::is_ascii_digit).fold(0i64, |n, d| n.saturating_mul(10) + i64::from(d - b'0'))
Member

L4 (should fix): The numeric parser saturates multiplication but can still overflow when it adds the next digit.

When: A sufficiently long numeric pad or key value in settings.toml reaches i64::MAX during parsing; adding a nonzero digit overflows, potentially panicking during startup or producing a wrapped value.

Do: Use saturating_add as well, or parse with checked arithmetic and reject out-of-range values.

**L4** (should fix): The numeric parser saturates multiplication but can still overflow when it adds the next digit. *When:* A sufficiently long numeric pad or key value in settings.toml reaches i64::MAX during parsing; adding a nonzero digit overflows, potentially panicking during startup or producing a wrapped value. **Do:** Use saturating_add as well, or parse with checked arithmetic and reject out-of-range values.
@ -593,0 +595,4 @@
*lock(&self.binds) = table;
// (the file's own value: a run's switch writes no bindings)
let saved_on = self.file_line("sprint").is_some_and(|t| options_store::atoi(&t) != 0);
if saved_on && self.with_binds(binds::Table::sprint_unbound) {
Member

L3 (blocking): The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs.

When: A player who leaves Sprint enabled but clears its key and pad slots gets Shift and L3 assigned again at every start; the repair can also move B and LS away from their chosen bindings and saves those changes.

Do: Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs.

**L3** (blocking): The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs. *When:* A player who leaves Sprint enabled but clears its key and pad slots gets Shift and L3 assigned again at every start; the repair can also move B and LS away from their chosen bindings and saves those changes. **Do:** Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs.
@ -604,2 +636,2 @@
pub fn controls_changed(&self) {
if self.put_controls() {
/// The bindings changed by `f` and written: a change the menu or the control bridge makes.
pub(crate) fn change_binds<R>(&self, f: impl FnOnce(&mut binds::Table) -> R) -> R {
Member

L2 (should fix): Binding edits and their serialization are not ordered as one operation.

When: One thread can change the table and copy its lines in put_binds, then pause while a second thread changes and writes a newer table. When the first resumes, it can overwrite the document with its older lines, so the live bindings look correct but a restart restores stale or mixed bindings.

Do: Serialize each table mutation and its complete document update with a shared transaction lock, including binding rules and resets.

**L2** (should fix): Binding edits and their serialization are not ordered as one operation. *When:* One thread can change the table and copy its lines in put_binds, then pause while a second thread changes and writes a newer table. When the first resumes, it can overwrite the document with its older lines, so the live bindings look correct but a restart restores stale or mixed bindings. **Do:** Serialize each table mutation and its complete document update with a shared transaction lock, including binding rules and resets.
@ -1178,0 +1246,4 @@
use binds::{Set, control};
d.with_binds(|t| {
[
t.binding(Set::Pad, control::SPRINT, 0),
Member

L5 (blocking): The fix lacks the repository-required game-free regression test that can demonstrate the failure on the base.

When: The new restart tests depend on the new binding table and do not build on main, as the PR notes, so they cannot demonstrate the reported old host-to-settings failure on the base.

Do: Add a game-free regression harness that exercises the old and new observable save-and-restart behavior and fails on the base while passing here.

**L5** (blocking): The fix lacks the repository-required game-free regression test that can demonstrate the failure on the base. *When:* The new restart tests depend on the new binding table and do not build on main, as the PR notes, so they cannot demonstrate the reported old host-to-settings failure on the base. **Do:** Add a game-free regression harness that exercises the old and new observable save-and-restart behavior and fails on the base while passing here.
host/nn_hid.c Outdated
@ -1549,3 +1197,3 @@
player_used();
}
binds_load(); /* (the keys: key_default's, or longshot_options.ini's; the mouse's buttons once its capture is known) */
binds_load(); /* (the keys; the mouse's buttons once its capture is known) */
Member

L1 (should fix): An input read can replace its bindings after it has started, despite marking the snapshot active.

When: If a binding changes after pad or ocarina inputs have been sampled, the unconditional binds_load here, or the calls in bound_pad_buttons and oc_notes, can load the new table before the rest of the report is built. One report can therefore combine old and new assignments, including consuming an ocarina input under one layout and mapping it under another.

Do: Load once at the start of the report and make every later load respect input_snapshot_active; publish Sprint's setting and its bindings as one coherent input snapshot too.

**L1** (should fix): An input read can replace its bindings after it has started, despite marking the snapshot active. *When:* If a binding changes after pad or ocarina inputs have been sampled, the unconditional binds_load here, or the calls in bound_pad_buttons and oc_notes, can load the new table before the rest of the report is built. One report can therefore combine old and new assignments, including consuming an ocarina input under one layout and mapping it under another. **Do:** Load once at the start of the report and make every later load respect input_snapshot_active; publish Sprint's setting and its bindings as one coherent input snapshot too.
fix(input): the review's points on the bindings move
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
d6d8301a2c
- A read of the controllers keeps one copy of the bindings, with Sprint's row
  and Toggle published in it.
- Each change of the bindings and the writing of its lines are one step under
  the table's lock.
- Sprint is given its layout at the start only when it never got it and the
  file was never written with bindings_saved: inputs cleared stay cleared.
- A number too long for its line no longer overflows the parser.
- A test of the saved file that fails on main.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The repair still cannot distinguish every deliberately cleared legacy Sprint layout from the broken layout, so it can overwrite a player's controls. The migrated input path also needs an in-game run.

The change moves binding ownership and persistence into the game so enabling Sprint saves its buttons across restarts. It also centralizes binding rules, at the cost of a substantial input-path migration and an ambiguous repair of older settings.

Blocking (1): must change before merging.

  1. L3 game/crates/longshot-game/src/settings_now.rs:598: The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs. When: A player who leaves Sprint enabled but clears its key and pad slots gets Shift and L3 assigned again at every start; the repair can also move B and LS away from their chosen bindings and saves those changes. Do: Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L6: The migrated input path has not been exercised in the game. When: The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. Do: Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results.

@fix can do L3.

Since the last review (on e0ce70df5f)
Resolved: L1 (An input read can replace its bindings after it has started, despite marking the snapshot…); L2 (Binding edits and their serialization are not ordered as one operation.); L4 (The numeric parser saturates multiplication but can still overflow when it adds the next d…); L5 (The fix lacks the repository-required game-free regression test that can demonstrate the f…)
Still open: L3 (The repair cannot distinguish the broken saved layout from a player deliberately clearing…); L6 (The migrated input path has not been exercised in the game.)

Checks: Still running: 11 checks.

Also noticed (1; not asked for, not blocking)
  • The pull request description still says every Sprint-on layout with no Sprint input is repaired, while the new marker and layout checks exclude some such files.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the new game-free test exercises the saved bindings, but the change has not been tested in the game. No performance gain is claimed or measured.

Other systems: The migration affects keyboard and controller input, prompts, ocarina controls, presets and saved settings on Windows and Linux. The description reports earlier builds, but no controller or keyboard play test and no Windows game start on this head.

Switches: No switches added, changed or removed.

Reviewed: d6d8301a2c against 76092c5e5a: Read the fix diff, binding publication code, Sprint regression test, relevant host input and binding rules, and the repository contribution rules and PR template. The full PR diff and all changed files were not read in full; other affected code and tests were skimmed.; nothing run (a code review).

Checked and fine:

  • The published host snapshot includes Sprint's row and Toggle alongside the bindings.
  • The numeric parser handles a digit sequence longer than i64 without overflowing its addition.

Testing: No commands that build or run the project were executed. The PR reports no in-game test; its head CI checks are still running.

Overlaps and merge order: The description identifies overlapping pull requests #2753, #1709, #3031 and #3044; merge order is not established.


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

**Recommendation: Request changes.** The repair still cannot distinguish every deliberately cleared legacy Sprint layout from the broken layout, so it can overwrite a player's controls. The migrated input path also needs an in-game run. The change moves binding ownership and persistence into the game so enabling Sprint saves its buttons across restarts. It also centralizes binding rules, at the cost of a substantial input-path migration and an ambiguous repair of older settings. **Blocking (1)**: must change before merging. 1. **L3** `game/crates/longshot-game/src/settings_now.rs:598`: The repair cannot distinguish the broken saved layout from a player deliberately clearing both Sprint inputs. *When:* A player who leaves Sprint enabled but clears its key and pad slots gets Shift and L3 assigned again at every start; the repair can also move B and LS away from their chosen bindings and saves those changes. **Do:** Use a migration marker or another reliable indication that the saved bindings came from the broken automatic move; preserve explicitly cleared inputs. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L6**: The migrated input path has not been exercised in the game. *When:* The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. **Do:** Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results. `@fix` can do L3. **Since the last review** (on e0ce70df5f30) Resolved: L1 (An input read can replace its bindings after it has started, despite marking the snapshot…); L2 (Binding edits and their serialization are not ordered as one operation.); L4 (The numeric parser saturates multiplication but can still overflow when it adds the next d…); L5 (The fix lacks the repository-required game-free regression test that can demonstrate the f…) Still open: L3 (The repair cannot distinguish the broken saved layout from a player deliberately clearing…); L6 (The migrated input path has not been exercised in the game.) **Checks:** Still running: 11 checks. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The pull request description still says every Sprint-on layout with no Sprint input is repaired, while the new marker and layout checks exclude some such files. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the new game-free test exercises the saved bindings, but the change has not been tested in the game. No performance gain is claimed or measured. **Other systems:** The migration affects keyboard and controller input, prompts, ocarina controls, presets and saved settings on Windows and Linux. The description reports earlier builds, but no controller or keyboard play test and no Windows game start on this head. **Switches:** No switches added, changed or removed. **Reviewed:** d6d8301a2c30 against 76092c5e5a3b: Read the fix diff, binding publication code, Sprint regression test, relevant host input and binding rules, and the repository contribution rules and PR template. The full PR diff and all changed files were not read in full; other affected code and tests were skimmed.; nothing run (a code review). **Checked and fine:** - The published host snapshot includes Sprint's row and Toggle alongside the bindings. - The numeric parser handles a digit sequence longer than i64 without overflowing its addition. **Testing:** No commands that build or run the project were executed. The PR reports no in-game test; its head CI checks are still running. **Overlaps and merge order:** The description identifies overlapping pull requests #2753, #1709, #3031 and #3044; merge order is not established. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
fix(input): no repair of Sprint's inputs at the start
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
546130688e
A file a nightly saved with Sprint on and no button reads the same as one whose
player cleared them, so nothing is laid out at a start. Turning Sprint off and
on gives the buttons back and now saves them.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner

Pushed 54613068, answering both reviews.

  • L1: a read takes one copy of the bindings, Sprint's row and Toggle in it, and every later use in that read keeps it.
  • L2: each change of the table and the writing of its lines are one step under the table's lock.
  • L3: the startup repair is removed rather than refined. A broken file and a deliberately cleared one can be identical, so no marker made after the fact tells them apart. Affected players turn Sprint off and on once.
  • L4: the parser saturates the addition too, with a test.
  • L5: tests/sprint_saved.rs reads the saved file through functions main has. Its run on main is still to be done.
  • L6: not run in the game: the person this is for asked to skip it. It stays open.

@review

Pushed 54613068, answering both reviews. - **L1**: a read takes one copy of the bindings, Sprint's row and Toggle in it, and every later use in that read keeps it. - **L2**: each change of the table and the writing of its lines are one step under the table's lock. - **L3**: the startup repair is removed rather than refined. A broken file and a deliberately cleared one can be identical, so no marker made after the fact tells them apart. Affected players turn Sprint off and on once. - **L4**: the parser saturates the addition too, with a test. - **L5**: `tests/sprint_saved.rs` reads the saved file through functions `main` has. Its run on `main` is still to be done. - **L6**: not run in the game: the person this is for asked to skip it. It stays open. @review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The startup repair no longer changes deliberately cleared bindings, but the migrated input path has not yet been exercised in the game. The head's CI checks are also still running. Recommend approval; not approved on the forge.

Sprint binding changes are saved where they are made, and the host reads a consistent copy of the bindings. Removing startup repair preserves deliberate layouts; players with an already broken Sprint layout must turn Sprint off and on once.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L6: The migrated input path has not been exercised in the game. When: The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. Do: Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results.

Since the last review (on d6d8301a2c)
Resolved: L3 (The repair cannot distinguish the broken saved layout from a player deliberately clearing…)
Still open: L6 (The migrated input path has not been exercised in the game.)

Checks: Still running: 11 checks.

Also noticed (1; not asked for, not blocking)
  • The game-free Sprint persistence test has not yet been run against main to confirm that it fails there.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported Rust tests pass on this head, but no keyboard or controller game run has confirmed the fix. The input-read performance change has not been measured.

Other systems: The migration affects keyboard and controller bindings, presets, prompts and input reads on Windows and Linux. No in-game run is reported, and the Windows compile and other CI checks are still running.

Switches: None added, changed or removed.

Reviewed: 546130688e against 76092c5e5a: Read the fix diff, the affected startup loading and binding-write code, the Sprint persistence test, and repository rules. Skimmed the full pull request diff and input documentation; the remaining changed files were not read in full.; nothing run (a code review).

Checked and fine:

  • The new startup test checks that an unbound Sprint layout is preserved and that turning Sprint off and on saves its buttons.
  • Removing startup repair does not remove the persistence fix for subsequent Sprint changes.

Testing: No commands that build or run tests were executed. The author reports passing binds, host-sys and longshot-game tests on this head; in-game testing and CI results remain outstanding.

Overlaps and merge order: The description identifies potential conflicts with #2753, #1709, #3031 and #3044; their current status and merge order were not checked.


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 (a run of the change itself). The startup repair no longer changes deliberately cleared bindings, but the migrated input path has not yet been exercised in the game. The head's CI checks are also still running. Recommend approval; not approved on the forge. Sprint binding changes are saved where they are made, and the host reads a consistent copy of the bindings. Removing startup repair preserves deliberate layouts; players with an already broken Sprint layout must turn Sprint off and on once. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L6**: The migrated input path has not been exercised in the game. *When:* The PR reports no controller or keyboard play, so the restart repair, rebinds and other consumers of the new table have no reported end-to-end result on either supported OS. **Do:** Run the listed Sprint restart, repair, rebind, preset, reset, HUD, ocarina and toggle checks in game on Linux and Windows, and record the results. **Since the last review** (on d6d8301a2c30) Resolved: L3 (The repair cannot distinguish the broken saved layout from a player deliberately clearing…) Still open: L6 (The migrated input path has not been exercised in the game.) **Checks:** Still running: 11 checks. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The game-free Sprint persistence test has not yet been run against main to confirm that it fails there. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Rust tests pass on this head, but no keyboard or controller game run has confirmed the fix. The input-read performance change has not been measured. **Other systems:** The migration affects keyboard and controller bindings, presets, prompts and input reads on Windows and Linux. No in-game run is reported, and the Windows compile and other CI checks are still running. **Switches:** None added, changed or removed. **Reviewed:** 546130688eb6 against 76092c5e5a3b: Read the fix diff, the affected startup loading and binding-write code, the Sprint persistence test, and repository rules. Skimmed the full pull request diff and input documentation; the remaining changed files were not read in full.; nothing run (a code review). **Checked and fine:** - The new startup test checks that an unbound Sprint layout is preserved and that turning Sprint off and on saves its buttons. - Removing startup repair does not remove the persistence fix for subsequent Sprint changes. **Testing:** No commands that build or run tests were executed. The author reports passing binds, host-sys and longshot-game tests on this head; in-game testing and CI results remain outstanding. **Overlaps and merge order:** The description identifies potential conflicts with #2753, #1709, #3031 and #3044; their current status and merge order were not checked. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Author
Owner

On 54613068: the Linux runtime builds and the headless smoke run passes (start, play, menu); tests/sprint_saved.rs fails on plain main for the bug's reason. Sprint and rebinding have still not been tried by a player.

On 54613068: the Linux runtime builds and the headless smoke run passes (start, play, menu); tests/sprint_saved.rs fails on plain main for the bug's reason. Sprint and rebinding have still not been tried by a player.
Author
Owner

Rebased onto main 6318f405, now 159d3ca0. One conflict, in gpu/vk/vk_api.h: #3105 also took MKWVK_API_VERSION 90, so this change is 91. Nothing else changed by hand.

Rebased onto main 6318f405, now 159d3ca0. One conflict, in gpu/vk/vk_api.h: #3105 also took MKWVK_API_VERSION 90, so this change is 91. Nothing else changed by hand.
HumanBean force-pushed push-xlrluxqvxtpy from 546130688e
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
to 159d3ca0e8
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 22s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m30s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 11m21s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 14m30s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m24s
CI / Website build and checks (pull_request) Failing after 55s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 46m7s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m6s
2026-12-03 23:30:24 +00:00
Compare
HumanBean deleted branch push-xlrluxqvxtpy 2026-12-03 23:35:41 +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!3108
No description provided.