Input: VICTORY_KEYS_LIVE presses the lines appended to a file while the title runs #1027

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

@⁠Zayfway on GitHub · 2026-11-25 16:39 UTC · original
Zayfway:input/keys-live → main · +275 −17 · 2 files · 2 commits · open

What

VICTORY_KEYS_LIVE=<file> (diagnostics builds): lines appended to the file while the title runs are pressed in order. The syntax per line:

  • a key name, as in VICTORY_KEYS;
  • several names joined by +, held together (W+J:1500 walks and turns);
  • an optional hold in ms after : (200 by default);
  • wait:<ms>, which holds nothing.

150 ms of nothing follows each line, so the same key twice is two presses. Lines already in the file at start are not pressed, and a line counts only once its newline is written. An unknown key name is logged and skipped, not pressed as nothing.

It goes through the same path as VICTORY_KEYS (scripted()), so it works without focus and drives the stand-in pad. key_code is shared by both; Space and Shift are added. One row is added to the README's debugging table.

Why

VICTORY_KEYS needs every press timed before the run starts. Several screens come at different times from run to run (warm or cold shader cache, a loaded machine):

  • the first-boot screens;
  • the legal pages with their countdown;
  • the loading screens.

An unattended run (an agent, a script) that has to get through them, or into the world and move there, needs to decide the next press after it has seen the last screen. This PR adds that.

From outside, SendInput / SetForegroundWindow are often refused (no focus from a background process, a system dialog on top). VICTORY_KEYS_ANYWHERE (#839) reads the real keyboard, which still needs something to press it.

Tested

RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, 16 GB RAM, Windows 11 26300, Series X profile.

  • cargo test -p victory-hle --features diagnostics --lib: 100 passed, 0 failed, including the 2 new tests (line parsing; one line after another, with the gap).
  • cargo clippy -p victory-hle --features diagnostics --all-targets: nothing in the changed code. rustfmt --check is clean on the changed blocks; the 4 differences left in gameinput.rs are on main already.
  • In the game, this commit (c4eeebb, on 465b94f): Bogus then Enter written to the file on the profile screen gave line not understood ... line="Bogus" then pressed line="Enter". The title went from the profile screen (frame 900) to its loading screens (frames 1200, 1500).
  • An earlier form of the same code (on 0b0074e) drove whole runs from a fresh data folder: first boot, legal pages, the policy checkboxes, profile, into the world and the opening cutscene. 7 runs, no missed or doubled press.

Not tested

Holding stick keys in gameplay (W+J:…) on this exact commit; only the menu path above was run on it.

🤖 Generated with Claude Code

**@⁠Zayfway** on GitHub · 2026-11-25 16:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/1027) `Zayfway:input/keys-live` → `main` · +275 −17 · 2 files · 2 commits · open ## What `VICTORY_KEYS_LIVE=<file>` (diagnostics builds): lines appended to the file while the title runs are pressed in order. The syntax per line: - a key name, as in `VICTORY_KEYS`; - several names joined by `+`, held together (`W+J:1500` walks and turns); - an optional hold in ms after `:` (200 by default); - `wait:<ms>`, which holds nothing. 150 ms of nothing follows each line, so the same key twice is two presses. Lines already in the file at start are not pressed, and a line counts only once its newline is written. An unknown key name is logged and skipped, not pressed as nothing. It goes through the same path as `VICTORY_KEYS` (`scripted()`), so it works without focus and drives the stand-in pad. `key_code` is shared by both; `Space` and `Shift` are added. One row is added to the README's debugging table. ## Why `VICTORY_KEYS` needs every press timed before the run starts. Several screens come at different times from run to run (warm or cold shader cache, a loaded machine): - the first-boot screens; - the legal pages with their countdown; - the loading screens. An unattended run (an agent, a script) that has to get through them, or into the world and move there, needs to decide the next press after it has seen the last screen. This PR adds that. From outside, `SendInput` / `SetForegroundWindow` are often refused (no focus from a background process, a system dialog on top). `VICTORY_KEYS_ANYWHERE` (#839) reads the real keyboard, which still needs something to press it. ## Tested RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, 16 GB RAM, Windows 11 26300, Series X profile. - `cargo test -p victory-hle --features diagnostics --lib`: 100 passed, 0 failed, including the 2 new tests (line parsing; one line after another, with the gap). - `cargo clippy -p victory-hle --features diagnostics --all-targets`: nothing in the changed code. `rustfmt --check` is clean on the changed blocks; the 4 differences left in `gameinput.rs` are on `main` already. - **In the game, this commit (`c4eeebb`, on `465b94f`):** `Bogus` then `Enter` written to the file on the profile screen gave `line not understood ... line="Bogus"` then `pressed line="Enter"`. The title went from the profile screen (frame 900) to its loading screens (frames 1200, 1500). - An earlier form of the same code (on `0b0074e`) drove whole runs from a fresh data folder: first boot, legal pages, the policy checkboxes, profile, into the world and the opening cutscene. 7 runs, no missed or doubled press. ## Not tested Holding stick keys in gameplay (`W+J:…`) on this exact commit; only the menu path above was run on it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VICTORY_KEYS needs every press timed before the run starts. The first-boot
screens, the legal pages with their countdown and the loading screens come
at different times from run to run (warm or cold shader cache, a loaded
machine), so an unattended run that has to get through them, or into the
world and move there, needs the next press decided after the last screen
was seen.

With VICTORY_KEYS_LIVE=<file> (diagnostics builds), a thread follows the
file; each complete line appended is pressed in order: a key name of
VICTORY_KEYS, several joined by + to be held together (W+J:1500), an
optional hold in ms (200 by default), or wait:<ms>. 150 ms of nothing
follows each line so that the same key twice is two presses. Lines already
in the file at the start are not pressed; a line with a key name it does
not know is logged and skipped. It goes through the same path as
VICTORY_KEYS, so it works without focus and drives the stand-in pad.

key_code is shared by both; Space and Shift (sprint) are added to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
follow() kept no file position and read the whole file every 100 ms. It
now seeks to the offset already read and reads only the new bytes; an
incomplete last line is kept for the next look (complete_lines). Emptying
the file, or replacing it with a shorter one, starts over; the append-only
contract is in the doc. A key press held 0 ms is refused.

Tests: polls_far_apart_lose_no_press, lines_are_taken_only_once_complete.
In the game: "Ent" and "er\n" appended one second apart on the profile
screen gave one press of Enter, and the title left its profile screen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:14 +00:00
Author
Owner

@⁠Zayfway on GitHub · 2026-11-25 21:21 UTC · original

Updated (input/keys-live head, on top of c4eeebb), same contract.

  • follow() now reads only the bytes appended since its last look: it keeps the offset, seeks to it, and buffers an incomplete last line until its newline comes (complete_lines). Before, it read the whole file every 100 ms.
  • Emptying the file, or replacing it with a shorter one, starts over; the append-only contract is in the doc.
  • A key press held 0 ms is refused, since the title could never see it.

Tests. cargo test -p victory-hle --features diagnostics --lib: 102 passed. That includes two new tests:

  • polls_far_apart_lose_no_press: three presses, polls 10 s apart, all three seen in order;
  • lines_are_taken_only_once_complete.

In the game, same machine as in the description: on the profile screen, Bogus\n, then Ent, then one second later er\n gave line not understood … "Bogus" followed by one pressed line="Enter". The title left its profile screen.

AI-assisted (Claude Code).

**@⁠Zayfway** on GitHub · 2026-11-25 21:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/1027#issuecomment-7174962286) Updated (`input/keys-live` head, on top of `c4eeebb`), same contract. - `follow()` now reads only the bytes appended since its last look: it keeps the offset, seeks to it, and buffers an incomplete last line until its newline comes (`complete_lines`). Before, it read the whole file every 100 ms. - Emptying the file, or replacing it with a shorter one, starts over; the append-only contract is in the doc. - A key press held 0 ms is refused, since the title could never see it. **Tests.** `cargo test -p victory-hle --features diagnostics --lib`: 102 passed. That includes two new tests: - `polls_far_apart_lose_no_press`: three presses, polls 10 s apart, all three seen in order; - `lines_are_taken_only_once_complete`. **In the game,** same machine as in the description: on the profile screen, `Bogus\n`, then `Ent`, then one second later `er\n` gave `line not understood … "Bogus"` followed by one `pressed line="Enter"`. The title left its profile screen. *AI-assisted (Claude Code).*
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1027/head:github-bot/gh-1027'
git switch 'github-bot/gh-1027'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1027'
git switch 'github-bot/gh-1027'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1027'
git switch 'github-bot/gh-1027'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1027'
git switch 'main'
git merge --squash 'github-bot/gh-1027'
git switch 'main'
git merge --ff-only 'github-bot/gh-1027'
git switch 'main'
git merge 'github-bot/gh-1027'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.