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

Open
Zayfway wants to merge 2 commits from upstream-pr/1027 into main
Zayfway commented 2026-11-25 16:39:58 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Zayfway on 2026-11-25T16:39:58Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6609138660 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1027). Originally posted by [Zayfway](https://github.com/Zayfway) on 2026-11-25T16:39:58Z. --- ## 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)
Zayfway commented 2026-11-25 22:07:22 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Zayfway on 2026-11-25T21:21:13Z.


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).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7174962286 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1027#issuecomment-7174962286). Originally posted by [Zayfway](https://github.com/Zayfway) on 2026-11-25T21:21:13Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1027:upstream-pr/1027'
git switch 'upstream-pr/1027'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1027'
git switch 'upstream-pr/1027'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1027'
git switch 'upstream-pr/1027'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1027'
git switch 'main'
git merge --squash 'upstream-pr/1027'
git switch 'main'
git merge --ff-only 'upstream-pr/1027'
git switch 'main'
git merge 'upstream-pr/1027'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!1025
No description provided.