hle: VICTORY_KEYS entries can hold a key, so a scripted run can walk #3392

Open
github-bot wants to merge 1 commit from github-bot/gh-3392 into main AGit
Owner

@⁠pes7 on GitHub · 2026-11-26 21:40 UTC · original
pes7:feat/keys-hold → main · +21 −6 · 1 files · 1 commits · open

VICTORY_KEYS=<seconds>:<key> (diagnostics builds) holds each key for 200 ms: enough for a menu press, not for walking. An entry now takes an optional third field, the hold in milliseconds:

VICTORY_KEYS=10:Enter:300,20:Enter:300,200:W:6000
  • Without the third field the hold stays 200 ms, so existing schedules behave exactly as before.
  • Both the keyboard device and the stand-in pad see the keys (Enter is the pad's A, W the left stick up), with or without window focus. A run can be driven while the title's window stays in the background, and nothing steals focus from whoever uses the machine.
  • In use for a while on our prologue runs: with Enter presses and a held W, the title reached the world with no window activation (1 862 draws/frame at 153 s).

Split out of #2936 (the review there asked for its diagnostics as separate PRs). gameinput.rs and the README's switch table only, +22/-7.

Checked: cargo clippy --workspace --all-targets -D warnings (also --all-features, which builds the diagnostics path) clean; cargo test -p victory-hle --all-features 155 passed.

🤖 Generated with Claude Code

**@⁠pes7** on GitHub · 2026-11-26 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/3392) `pes7:feat/keys-hold` → `main` · +21 −6 · 1 files · 1 commits · open `VICTORY_KEYS=<seconds>:<key>` (diagnostics builds) holds each key for 200 ms: enough for a menu press, not for walking. An entry now takes an optional third field, the hold in milliseconds: ``` VICTORY_KEYS=10:Enter:300,20:Enter:300,200:W:6000 ``` - Without the third field the hold stays 200 ms, so existing schedules behave exactly as before. - Both the keyboard device and the stand-in pad see the keys (`Enter` is the pad's A, `W` the left stick up), with or without window focus. A run can be driven while the title's window stays in the background, and nothing steals focus from whoever uses the machine. - In use for a while on our prologue runs: with `Enter` presses and a held `W`, the title reached the world with no window activation (1 862 draws/frame at 153 s). Split out of #2936 (the review there asked for its diagnostics as separate PRs). `gameinput.rs` and the README's switch table only, +22/-7. Checked: `cargo clippy --workspace --all-targets -D warnings` (also `--all-features`, which builds the diagnostics path) clean; `cargo test -p victory-hle --all-features` 155 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`VICTORY_KEYS=<seconds>:<key>` held each key for 200 ms: enough for a menu
press, not for walking. An entry now takes an optional third field, the hold
in milliseconds:

    VICTORY_KEYS=10:Enter:300,20:Enter:300,200:W:6000

Without it the hold stays 200 ms, so existing schedules behave as before.
Both the keyboard device and the stand-in pad see the keys (`Enter` is the
pad's A, `W` the left stick up), with or without window focus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:06:23 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 21:47 UTC · original · approved these changes

LGTM — verified on Windows against origin/main (63bcca4).

  • Allowing VICTORY_KEYS entries to hold a key for a duration cleanly extends scripted input testing without affecting existing entries.
  • cargo test -p victory-hle --lib modules::gameinput:: -- --test-threads=1: 10 passed, 0 failed.
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 21:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/3392#pullrequestreview-6080839216) · **approved these changes** LGTM — verified on Windows against `origin/main` (`63bcca4`). - Allowing `VICTORY_KEYS` entries to hold a key for a duration cleanly extends scripted input testing without affecting existing entries. - `cargo test -p victory-hle --lib modules::gameinput:: -- --test-threads=1`: 10 passed, 0 failed. - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 22:08 UTC · original · approved these changes

Verified on 57233443:

  • cargo xtask policy: 191 files ok.
  • rustfmt --edition 2024 --check: clean on the modified hunks in crates/victory-hle/src/modules/gameinput.rs.
  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings (default, --features diagnostics, and --all-features): clean.
  • cargo test --locked -p victory-hle --lib modules::gameinput:: (default and --features diagnostics): 10 passed, 0 failed.

Clean, backward-compatible extension of VICTORY_KEYS (<seconds>:<key> continues defaulting to 200 ms) with zero overhead when diagnostics is off.

Two small non-blocking suggestions if you touch this again:

  • Using at.saturating_add(hold) instead of at + hold (crates/victory-hle/src/modules/gameinput.rs:1322) avoids a Duration overflow panic if a huge timestamp + hold duration is ever passed in VICTORY_KEYS.
  • Adding a small unit test for the parser (<seconds>:<key> default vs <seconds>:<key>:<hold_ms>, malformed hold fields, and [at, at + hold) timing) would cover the new syntax directly.

LGTM!

**@⁠fuzeofficlal** on GitHub · 2026-11-26 22:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/3392#pullrequestreview-6080999363) · **approved these changes** Verified on `57233443`: - `cargo xtask policy`: `191 files ok`. - `rustfmt --edition 2024 --check`: clean on the modified hunks in `crates/victory-hle/src/modules/gameinput.rs`. - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` (default, `--features diagnostics`, and `--all-features`): clean. - `cargo test --locked -p victory-hle --lib modules::gameinput::` (default and `--features diagnostics`): **10 passed, 0 failed**. Clean, backward-compatible extension of `VICTORY_KEYS` (`<seconds>:<key>` continues defaulting to 200 ms) with zero overhead when `diagnostics` is off. Two small non-blocking suggestions if you touch this again: - Using `at.saturating_add(hold)` instead of `at + hold` (`crates/victory-hle/src/modules/gameinput.rs:1322`) avoids a `Duration` overflow panic if a huge timestamp + hold duration is ever passed in `VICTORY_KEYS`. - Adding a small unit test for the parser (`<seconds>:<key>` default vs `<seconds>:<key>:<hold_ms>`, malformed hold fields, and `[at, at + hold)` timing) would cover the new syntax directly. LGTM!
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 22:32 UTC · original

Windows controlled-clock check at 5723344 against 63bcca4. Both revisions passed all 12 focused GameInput tests, including synthetic input cases. Across 19 exact timestamps, omitted hold stayed at 200 ms, explicit 600 ms and 100 ms holds used inclusive starts and exclusive ends, and overlapping Enter/W and W/Right were delivered together. Enter mapped to pad A and W to left stick Y=1.0.

One edge case in the new parser: 18446744073709549568:W:18446744073709551615 parses successfully, then the first query at elapsed zero panics at at + hold with overflow when adding durations. The parent skips that three-field entry. now.checked_sub(at).is_some_and(|age| age < hold) would implement the same half-open check without adding the durations.

Synthetic fixture

AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-26 22:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/3392#issuecomment-7204777383) Windows controlled-clock check at `5723344` against `63bcca4`. Both revisions passed all 12 focused GameInput tests, including synthetic input cases. Across 19 exact timestamps, omitted hold stayed at 200 ms, explicit 600 ms and 100 ms holds used inclusive starts and exclusive ends, and overlapping Enter/W and W/Right were delivered together. Enter mapped to pad A and W to left stick Y=1.0. One edge case in the new parser: `18446744073709549568:W:18446744073709551615` parses successfully, then the first query at elapsed zero panics at `at + hold` with `overflow when adding durations`. The parent skips that three-field entry. `now.checked_sub(at).is_some_and(|age| age < hold)` would implement the same half-open check without adding the durations. [Synthetic fixture](https://github.com/passerbyyhx/VIctory/commit/0b8e9bb4cb1ef88774aedf429752ba3aec48d1ba) AI-assisted with Codex.
Author
Owner

@⁠Jackster on GitHub · 2026-11-26 22:34 UTC · original

Windows 11, 63bcca4 + this PR, diagnostics build:

  • cargo test -p victory-hle --features diagnostics gameinput::: 10 passed / 0 failed.
  • cargo clippy -p victory-hle --features diagnostics --all-targets -- -D warnings: clean.

No new test: the change is in the VICTORY_KEYS parser (<seconds>:<key>[:<hold ms>]) and its doc comment, so this is compile/regression coverage only. I did not exercise a scripted run with an explicit hold — that needs the title. Synthetic only. AI-assisted.

**@⁠Jackster** on GitHub · 2026-11-26 22:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/3392#issuecomment-7204794894) Windows 11, `63bcca4` + this PR, diagnostics build: - `cargo test -p victory-hle --features diagnostics gameinput::`: 10 passed / 0 failed. - `cargo clippy -p victory-hle --features diagnostics --all-targets -- -D warnings`: clean. No new test: the change is in the `VICTORY_KEYS` parser (`<seconds>:<key>[:<hold ms>]`) and its doc comment, so this is compile/regression coverage only. I did not exercise a scripted run with an explicit hold — that needs the title. Synthetic only. AI-assisted.
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/3392/head:github-bot/gh-3392'
git switch 'github-bot/gh-3392'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3392'
git switch 'github-bot/gh-3392'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3392'
git switch 'github-bot/gh-3392'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3392'
git switch 'main'
git merge --squash 'github-bot/gh-3392'
git switch 'main'
git merge --ff-only 'github-bot/gh-3392'
git switch 'main'
git merge 'github-bot/gh-3392'
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!3392
No description provided.