Diagnostics: script gamepad input by frame (VICTORY_SCRIPTED_INPUT) #3293

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

@⁠neonbyte1 on GitHub · 2026-11-26 16:12 UTC · original
neonbyte1:pr/scripted-input → main · +315 −5 · 3 files · 2 commits · open

A diagnostics switch that plays a scripted gamepad timeline, so a headless run can move the character without a real controller or window focus:

VICTORY_SCRIPTED_INPUT='1500:back;1800:look_left;1860:fwd;2400:off'

Each entry sets the pad from that presented frame until the next entry. It's keyed on the frame token that victory_gpu::frame present logs show. The states:

  • left stick: fwd, back, left, right;
  • right stick: look_*;
  • triggers: lt, rt;
  • buttons: a/b/x/y, menu, view, lb/rb/ls/rs, and the d-pad (du/dd/dl/dr);
  • off releases everything.

States combine with + (fwd+look_right). The script overlays a connected pad, or the keyboard stand-in pad when none is connected.

How it relates to VICTORY_KEYS: VICTORY_KEYS (and #3239's holds and repeats) is timed in seconds and goes through the keyboard path. This one is timed in presented frames and sets pad state directly. At about one frame per second, wall-clock timing lands at different points of the game from run to run, while frame-keyed timing is repeatable. The README row says so next to VICTORY_KEYS.

Changes:

  • gameinput.rs: the parser, the timeline lookup, and the overlay in the poll, plus three unit tests: parsing, segment lookup, and the overlaid reading.
  • frame.rs: a diagnostics-only accessor for the frame number.
  • README.md: one row next to VICTORY_KEYS.

All of it is behind diagnostics; when the variable is unset, nothing changes.

In game (GTA VI on Linux, RTX 5090, GE-Proton11-14, headless gamescope, main plus the PRs needed on that setup):

  • The script above walked the character back from the cell window from frame 1500, turned the camera from 1800, and walked forward from 1860.
  • The hints changed to "Approach a cellmate to interact with them", then "Hold … to interact".
  • By frame 2200 the objective was "Go with the prison guard".
  • No faults during the run.

Tested: the gameinput tests pass under cargo xtask wine-test (#1218), 13/13, with and without diagnostics. Clippy -D warnings and cargo xtask policy are clean. Not run on native Windows.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 16:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293) `neonbyte1:pr/scripted-input` → `main` · +315 −5 · 3 files · 2 commits · open A diagnostics switch that plays a scripted gamepad timeline, so a headless run can move the character without a real controller or window focus: ``` VICTORY_SCRIPTED_INPUT='1500:back;1800:look_left;1860:fwd;2400:off' ``` Each entry sets the pad from that presented frame until the next entry. It's keyed on the frame token that `victory_gpu::frame` present logs show. The states: - left stick: `fwd`, `back`, `left`, `right`; - right stick: `look_*`; - triggers: `lt`, `rt`; - buttons: `a`/`b`/`x`/`y`, `menu`, `view`, `lb`/`rb`/`ls`/`rs`, and the d-pad (`du`/`dd`/`dl`/`dr`); - `off` releases everything. States combine with `+` (`fwd+look_right`). The script overlays a connected pad, or the keyboard stand-in pad when none is connected. **How it relates to `VICTORY_KEYS`:** `VICTORY_KEYS` (and #3239's holds and repeats) is timed in seconds and goes through the keyboard path. This one is timed in presented frames and sets pad state directly. At about one frame per second, wall-clock timing lands at different points of the game from run to run, while frame-keyed timing is repeatable. The README row says so next to `VICTORY_KEYS`. **Changes:** - **`gameinput.rs`:** the parser, the timeline lookup, and the overlay in the poll, plus three unit tests: parsing, segment lookup, and the overlaid reading. - **`frame.rs`:** a diagnostics-only accessor for the frame number. - **`README.md`:** one row next to `VICTORY_KEYS`. All of it is behind `diagnostics`; when the variable is unset, nothing changes. **In game** (GTA VI on Linux, RTX 5090, GE-Proton11-14, headless gamescope, `main` plus the PRs needed on that setup): - The script above walked the character back from the cell window from frame 1500, turned the camera from 1800, and walked forward from 1860. - The hints changed to "Approach a cellmate to interact with them", then "Hold … to interact". - By frame 2200 the objective was "Go with the prison guard". - No faults during the run. **Tested:** the `gameinput` tests pass under `cargo xtask wine-test` (#1218), 13/13, with and without `diagnostics`. Clippy `-D warnings` and `cargo xtask policy` are clean. Not run on native Windows. _AI-assisted (Claude); measured on my machine, no game data shared._
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:16:12 +00:00
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-26 16:15 UTC · original · reviewed

Frame-keyed timing is a good complement to VICTORY_KEYS, and the diagnostics forwarding to victory-gpu is already there, so frame::number() resolves.

One trap: unknown tokens are ignored but the entry is still kept, so a typo'd entry (1800:fwrd, look_rigth) becomes a neutral pad and silently acts like off from that frame on. In an unattended run that looks like the character just stopped. A warn! naming the token (once, at parse time) would make that obvious; and scripted_input_timeline_holds_the_last_state could pin it.

**@⁠AurumCarlos** on GitHub · 2026-11-26 16:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#pullrequestreview-6077393313) · **reviewed** Frame-keyed timing is a good complement to `VICTORY_KEYS`, and the `diagnostics` forwarding to `victory-gpu` is already there, so `frame::number()` resolves. One trap: unknown tokens are ignored but the entry is still kept, so a typo'd entry (`1800:fwrd`, `look_rigth`) becomes a neutral pad and silently acts like `off` from that frame on. In an unattended run that looks like the character just stopped. A `warn!` naming the token (once, at parse time) would make that obvious; and `scripted_input_timeline_holds_the_last_state` could pin it.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 16:43 UTC · original

@⁠AurumCarlos good catch, thanks. Fixed in 56dcd63. An entry with an unknown token is now dropped whole, so the last valid state stays active, and the parser warns once per bad token with the entry text (unknown scripted input token; entry ignored).

I chose dropping the whole entry over keeping the recognised tokens: applying fwd from fwd+bogus would invent a state the script never asked for, and a lone typo would still look like off.

The timeline test now includes 40:fwd+bogus and 50:look_rigth, and checks that the previous state (back) is still active at frame 49. A second test checks that a bad token is reported once. The gameinput tests pass under Wine (14/14), and clippy, policy and formatting are clean.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 16:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#issuecomment-7198021706) @⁠AurumCarlos good catch, thanks. Fixed in `56dcd63`. An entry with an unknown token is now dropped whole, so the last valid state stays active, and the parser warns once per bad token with the entry text (`unknown scripted input token; entry ignored`). I chose dropping the whole entry over keeping the recognised tokens: applying `fwd` from `fwd+bogus` would invent a state the script never asked for, and a lone typo would still look like `off`. The timeline test now includes `40:fwd+bogus` and `50:look_rigth`, and checks that the previous state (`back`) is still active at frame 49. A second test checks that a bad token is reported once. The `gameinput` tests pass under Wine (14/14), and clippy, policy and formatting are clean. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-26 16:47 UTC · original · reviewed

56dcd63 resolves it: dropping the whole entry keeps the last valid state, and the warning names the token and the entry once. The two tests cover both. LGTM.

Tiny edge, no change needed: a trailing + (1500:fwd+) now yields an empty token, so that entry is dropped with a warning for "". That's the right outcome, just a slightly cryptic message.

**@⁠AurumCarlos** on GitHub · 2026-11-26 16:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#pullrequestreview-6077788550) · **reviewed** `56dcd63` resolves it: dropping the whole entry keeps the last valid state, and the warning names the token and the entry once. The two tests cover both. LGTM. Tiny edge, no change needed: a trailing `+` (`1500:fwd+`) now yields an empty token, so that entry is dropped with a warning for `""`. That's the right outcome, just a slightly cryptic message.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 16:49 UTC · original

@⁠AurumCarlos thanks for re-checking. Agreed on 1500:fwd+: dropping it is the right outcome, and the "" in the warning is cryptic. I'll leave it as is unless a maintainer would like the message to say "empty token" explicitly; that's a one-line change.

AI-assisted (Claude); no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 16:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#issuecomment-7198143456) @⁠AurumCarlos thanks for re-checking. Agreed on `1500:fwd+`: dropping it is the right outcome, and the `""` in the warning is cryptic. I'll leave it as is unless a maintainer would like the message to say "empty token" explicitly; that's a one-line change. _AI-assisted (Claude); no game data shared._
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 16:50 UTC · original

Independent Windows verification of PR #3293 (head 56dcd63).

  • Environment: Windows, Rust 1.100.0/MSVC, per-worktree CARGO_TARGET_DIR=D:\Victory-Contrib\target-3293, CARGO_BUILD_JOBS=2.
  • Command: cargo test --locked -p victory-hle --lib -- --exact modules::gameinput::tests::scripted_input_timeline_holds_the_last_state modules::gameinput::tests::scripted_pad_reaches_the_stand_in_reading modules::gameinput::tests::scripted_pad_overlays_a_host_pad
  • Result: 3 passed; 0 failed; 153 filtered out, exit 0.
  • git diff --check origin/main HEAD clean.
  • Negative control: none of the three new test names exists on the merge base 63bcca43 (synthetic tests are added by this PR).
  • Scope: CPU/HLE-only synthetic timeline tests; the in-game scripted-input scenario was not replayed.
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only). No game data or assets used.
**@⁠cloph-dsp** on GitHub · 2026-11-26 16:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#issuecomment-7198155214) Independent Windows verification of PR #3293 (head 56dcd63). - Environment: Windows, Rust 1.100.0/MSVC, per-worktree `CARGO_TARGET_DIR=D:\Victory-Contrib\target-3293`, `CARGO_BUILD_JOBS=2`. - Command: `cargo test --locked -p victory-hle --lib -- --exact modules::gameinput::tests::scripted_input_timeline_holds_the_last_state modules::gameinput::tests::scripted_pad_reaches_the_stand_in_reading modules::gameinput::tests::scripted_pad_overlays_a_host_pad` - Result: `3 passed; 0 failed; 153 filtered out`, exit 0. - `git diff --check origin/main HEAD` clean. - Negative control: none of the three new test names exists on the merge base 63bcca43 (synthetic tests are added by this PR). - Scope: CPU/HLE-only synthetic timeline tests; the in-game scripted-input scenario was not replayed. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only). No game data or assets used.
Author
Owner

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

Reviewed and verified locally on Windows 11 x64:

  • VICTORY_SCRIPTED_INPUT cleanly drives frame-indexed gamepad state timelines over both stand-in and connected host pads without affecting normal input when unset.
  • cargo test -p victory-hle --lib modules::gameinput:: -- --test-threads=1: 14 passed, 0 failed (including scripted_input_timeline_holds_the_last_state, scripted_input_warns_once_per_unknown_token, scripted_pad_overlays_a_host_pad, and scripted_pad_reaches_the_stand_in_reading).
  • cargo clippy -p victory-gpu -p victory-hle --all-targets -- -D warnings: clean.
  • cargo clippy -p victory-gpu -p victory-hle --features diagnostics --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 17:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/3293#pullrequestreview-6078418542) · **approved these changes** Reviewed and verified locally on Windows 11 x64: - `VICTORY_SCRIPTED_INPUT` cleanly drives frame-indexed gamepad state timelines over both stand-in and connected host pads without affecting normal input when unset. - `cargo test -p victory-hle --lib modules::gameinput:: -- --test-threads=1`: 14 passed, 0 failed (including `scripted_input_timeline_holds_the_last_state`, `scripted_input_warns_once_per_unknown_token`, `scripted_pad_overlays_a_host_pad`, and `scripted_pad_reaches_the_stand_in_reading`). - `cargo clippy -p victory-gpu -p victory-hle --all-targets -- -D warnings`: clean. - `cargo clippy -p victory-gpu -p victory-hle --features diagnostics --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/3293/head:github-bot/gh-3293'
git switch 'github-bot/gh-3293'

Merge

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