Diagnostics: VICTORY_KEYS can hold a key longer than 0.2 s #2205

Open
github-bot wants to merge 2 commits from github-bot/gh-2205 into main AGit
Owner

@⁠fiestorra on GitHub · 2026-11-25 07:58 UTC · original
fiestorra:diag/keys-hold → main · +110 −31 · 2 files · 2 commits · open

VICTORY_KEYS could not hold a key for longer than 0.2 s, and that ambiguity cost me a morning

The scripted keys held every key for 0.2 s, hardcoded:

.filter(|&&(at, _)| (at..at + Duration::from_millis(200)).contains(&now))

That is fine for the screens it was written for — it advanced the conditions page and the notices — but it makes one particular failure impossible to tell apart from another: a screen that samples its input slower than the hold behaves exactly like a screen that takes no input. I spent this morning concluding the second about the setup wizard, and it was wrong: the operator advanced that same screen by hand with the keyboard.

An entry may now say how long to hold it:

VICTORY_KEYS=60:Enter:0.8,66:Down,70:Up:0.5

at:key[:hold], the hold in seconds, 0.2 s when omitted, so every existing string behaves exactly as it did. The parse moved into parse_scripted — a function of its own, testable without touching the environment — and the test pins three things: the default, an explicit hold, and a hold that does not parse, which falls back to the default rather than dropping the key, because a run that loses one press is worse than one that presses slightly wrong.

cargo test -p victory-hle --features diagnostics --lib → 143 passed, with the one failure main also has in a session with no desktop; clippy with and without --all-features clean under -D warnings; rustfmt --check shows the same four hunks the file already had on main.

What this does not do is prove that a longer hold gets past the wizard. That is the next run, and it will say either way — the point of the change is that the answer becomes a measurement instead of a guess. If the wizard still ignores a 0.8 s hold, then it genuinely does not take keyboard input, and the next place to look is the pad it might be waiting for, not the length of the press.

No game data is involved: an environment variable and a test.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 07:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205) `fiestorra:diag/keys-hold` → `main` · +110 −31 · 2 files · 2 commits · open **`VICTORY_KEYS` could not hold a key for longer than 0.2 s, and that ambiguity cost me a morning** The scripted keys held every key for 0.2 s, hardcoded: ```rust .filter(|&&(at, _)| (at..at + Duration::from_millis(200)).contains(&now)) ``` That is fine for the screens it was written for — it advanced the conditions page and the notices — but it makes one particular failure impossible to tell apart from another: **a screen that samples its input slower than the hold** behaves exactly like **a screen that takes no input**. I spent this morning concluding the second about the setup wizard, and it was wrong: the operator advanced that same screen by hand with the keyboard. An entry may now say how long to hold it: ``` VICTORY_KEYS=60:Enter:0.8,66:Down,70:Up:0.5 ``` `at:key[:hold]`, the hold in seconds, **0.2 s when omitted**, so every existing string behaves exactly as it did. The parse moved into `parse_scripted` — a function of its own, testable without touching the environment — and the test pins three things: the default, an explicit hold, and **a hold that does not parse**, which falls back to the default rather than dropping the key, because a run that loses one press is worse than one that presses slightly wrong. `cargo test -p victory-hle --features diagnostics --lib` → 143 passed, with the one failure `main` also has in a session with no desktop; clippy with and without `--all-features` clean under `-D warnings`; `rustfmt --check` shows the same four hunks the file already had on `main`. What this does **not** do is prove that a longer hold gets past the wizard. That is the next run, and it will say either way — the point of the change is that the answer becomes a measurement instead of a guess. If the wizard still ignores a 0.8 s hold, then it genuinely does not take keyboard input, and the next place to look is the pad it might be waiting for, not the length of the press. No game data is involved: an environment variable and a test. Written with an AI assistant.
The scripted keys held each key for 0.2 s with no way to change it. A screen
that samples its input more slowly than that ignores the key, and the run
looks exactly like a screen that ignores input - which is what cost me a
morning: I concluded the setup wizard took no input at all, when the operator
advanced the same screen by hand.

An entry may now carry its hold: `at🔑hold`, in seconds, 0.2 when it does
not. The parse is a function of its own so it can be tested; the test pins the
default, an explicit hold, and a hold that does not parse (the key is kept,
because the run matters more than the exact timing).

No behaviour changes for an existing VICTORY_KEYS string.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:58:22 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 08:09 UTC · original

Windows validation on c26291a with diagnostics enabled. All 9 GameInput unit tests passed. I also ran a local probe using the production scripted-key source, a synthetic connected pad holding B in slot 1, and the GameInput current-reading interface. Each row ran in a fresh process.

Revision VICTORY_KEYS At 0 ms At 350 ms At 1000 ms
Parent 940d32f 0:Enter A+B B B
Parent 940d32f 0:Enter:0.8 B stopped at first mismatch —
PR c26291a 0:Enter:0.8 A+B A+B B

The extended hold reached the consumer past the old 200 ms default, then released while preserving B. Synthetic input only. AI-assisted validation.

**@⁠Dathinel** on GitHub · 2026-11-25 08:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#issuecomment-7156677534) Windows validation on c26291a with diagnostics enabled. All 9 GameInput unit tests passed. I also ran a local probe using the production scripted-key source, a synthetic connected pad holding B in slot 1, and the GameInput current-reading interface. Each row ran in a fresh process. | Revision | VICTORY_KEYS | At 0 ms | At 350 ms | At 1000 ms | |---|---|---|---|---| | Parent 940d32f | 0:Enter | A+B | B | B | | Parent 940d32f | 0:Enter:0.8 | B | stopped at first mismatch | — | | PR c26291a | 0:Enter:0.8 | A+B | A+B | B | The extended hold reached the consumer past the old 200 ms default, then released while preserving B. Synthetic input only. AI-assisted validation.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:29 UTC · original

Automated triage for the maintainers.

This lets the diagnostics-only VICTORY_KEYS script give each key an optional hold (at:key[:hold], still 0.2 s by default). It moves the parser out of host::scripted into a testable parse_scripted in gameinput.rs, with a unit test covering the default, a bad hold and malformed entries. I checked that the key table and the default behaviour match main and that the change is only compiled under test/diagnostics. CI passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#issuecomment-7163844237) <!-- victory-triage v1 head=c26291a329d5a3ac588bb8f1680ec1aa1a5f322f verdict=merge-candidate at=2026-11-25T13:29:20Z --> Automated triage for the maintainers. This lets the diagnostics-only `VICTORY_KEYS` script give each key an optional hold (`at:key[:hold]`, still 0.2 s by default). It moves the parser out of `host::scripted` into a testable `parse_scripted` in `gameinput.rs`, with a unit test covering the default, a bad hold and malformed entries. I checked that the key table and the default behaviour match `main` and that the change is only compiled under `test`/`diagnostics`. CI passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:56 UTC · original

Code review and Windows 11 verification at head c26291a329d5 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-hle/src/modules/gameinput.rs:276-308, 1322-1331):
    • Properly gated behind #[cfg(any(test, feature = "diagnostics"))] / #[cfg(feature = "diagnostics")] (zero default-build impact). parse_scripted drops malformed/negative/NaN/Inf at entries cleanly, falls back to DEFAULT_HOLD = 200 ms on omitted or invalid hold, and treats hold == 0.0 as an empty range.
    • Minor non-blocking note (gameinput.rs:1331): (at..at + hold).contains(&now) can panic with Duration addition overflow if someone passes two very large values in VICTORY_KEYS (e.g. 1e19:Enter:1e19); using at.saturating_add(hold) avoids that cleanly.
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-hle --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • cargo test --locked -p victory-hle -- gameinput: 11/11 passed on both default and --features diagnostics.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#issuecomment-7179266038) Code review and Windows 11 verification at head `c26291a329d5` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-hle/src/modules/gameinput.rs:276-308, 1322-1331`)**: - Properly gated behind `#[cfg(any(test, feature = "diagnostics"))]` / `#[cfg(feature = "diagnostics")]` (zero default-build impact). `parse_scripted` drops malformed/negative/NaN/Inf `at` entries cleanly, falls back to `DEFAULT_HOLD = 200 ms` on omitted or invalid `hold`, and treats `hold == 0.0` as an empty range. - Minor non-blocking note (`gameinput.rs:1331`): `(at..at + hold).contains(&now)` can panic with `Duration` addition overflow if someone passes two very large values in `VICTORY_KEYS` (e.g. `1e19:Enter:1e19`); using `at.saturating_add(hold)` avoids that cleanly. - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-hle --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - `cargo test --locked -p victory-hle -- gameinput`: **11/11 passed** on both default and `--features diagnostics`. LGTM.
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 01:23 UTC · original

Tried the hold syntax on the fxceless fork. With 50:Enter:4.4 the first room was visible by 80 seconds on the RX 7900 XT. Ordinary taps still showed the cutscene at 100 seconds in the control run. I kept your commit credit in the port.

One edge case I found while adding the boundary test: checking now.checked_sub(at) against hold also handles a valid start and hold whose sum is outside Duration’s range. Port and tests

**@⁠UwUCammie** on GitHub · 2026-11-26 01:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#issuecomment-7179722675) Tried the hold syntax on the fxceless fork. With `50:Enter:4.4` the first room was visible by 80 seconds on the RX 7900 XT. Ordinary taps still showed the cutscene at 100 seconds in the control run. I kept your commit credit in the port. One edge case I found while adding the boundary test: checking `now.checked_sub(at)` against `hold` also handles a valid start and hold whose sum is outside `Duration`’s range. [Port and tests](https://github.com/fxceless/victory-fork/pull/1236)
github-bot force-pushed github-bot/gh-2205 from c26291a329 to 6c9548f06f 2026-11-26 12:38:52 +00:00 Compare
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 08:03 UTC · original · reviewed

Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

VICTORY_KEYS can hold a key longer than 0.2s — input-timing fix for diagnostics; relates to #2114's stand-in pad.

**@⁠catminou4** on GitHub · 2026-11-25 08:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#pullrequestreview-6053837312) · **reviewed** Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. VICTORY_KEYS can hold a key longer than 0.2s — input-timing fix for diagnostics; relates to #2114's stand-in pad.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-26 12:37 UTC · original

The window is what gets tested now, and the two edge cases are fixed

Head 6c9548f0, rebased onto 63bcca43 first.

  • The overflow: the window no longer adds. held(keys, now) compares now.checked_sub(at) with the hold, so a pair whose sum leaves Duration's range cannot panic — and at in the future is simply not held. That is the shape @⁠UwUCammie suggested, taken rather than my own saturating_add.
  • A hold of zero falls back to the 0.2 s default instead of producing an empty window and silently dropping the key, which is the failure this switch exists to rule out.
  • The window, not just the parse, is tested: a_scripted_key_is_held_exactly_its_window asserts down at +0.35 s and up at +0.8 s for a 0.8 s hold, the zero-hold default at +0.1 s and released at +0.25 s, and no panic on a 1e19 hold. scripted() now just calls held, so the tested function is the one the runtime uses.
  • README: the VICTORY_KEYS row shows 30:Enter,35:X:0.8 and says the time after the second colon is the hold, 0.2 s when omitted.

Measured here: cargo test -p victory-hle --features diagnostics --lib → 153 passed, 1 failed; the failure is lifecycle::tests::showing_a_title_window_shows_its_stand_in, which fails the same way on a clean 63bcca43 in this desktop-less session. cargo clippy -p victory-hle --features diagnostics --all-targets -- -D warnings is clean.

Not verified: a run of the title with a long hold — this machine's session 0 cannot present, so the click that motivated the change has not been re-shot through the menu.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-26 12:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2205#issuecomment-7192245396) **The window is what gets tested now, and the two edge cases are fixed** Head `6c9548f0`, rebased onto `63bcca43` first. - **The overflow**: the window no longer adds. `held(keys, now)` compares `now.checked_sub(at)` with the hold, so a pair whose sum leaves `Duration`'s range cannot panic — and `at` in the future is simply not held. That is the shape @⁠UwUCammie suggested, taken rather than my own `saturating_add`. - **A hold of zero** falls back to the 0.2 s default instead of producing an empty window and silently dropping the key, which is the failure this switch exists to rule out. - **The window, not just the parse**, is tested: `a_scripted_key_is_held_exactly_its_window` asserts down at +0.35 s and up at +0.8 s for a 0.8 s hold, the zero-hold default at +0.1 s and released at +0.25 s, and no panic on a `1e19` hold. `scripted()` now just calls `held`, so the tested function is the one the runtime uses. - **README**: the `VICTORY_KEYS` row shows `30:Enter,35:X:0.8` and says the time after the second colon is the hold, 0.2 s when omitted. Measured here: `cargo test -p victory-hle --features diagnostics --lib` → 153 passed, 1 failed; the failure is `lifecycle::tests::showing_a_title_window_shows_its_stand_in`, which fails the same way on a clean `63bcca43` in this desktop-less session. `cargo clippy -p victory-hle --features diagnostics --all-targets -- -D warnings` is clean. Not verified: a run of the title with a long hold — this machine's session 0 cannot present, so the click that motivated the change has not been re-shot through the menu. Written with an AI assistant.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2205/head:github-bot/gh-2205'
git switch 'github-bot/gh-2205'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'main'
git merge --squash 'github-bot/gh-2205'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'main'
git merge 'github-bot/gh-2205'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2205
No description provided.