HLE: VICTORY_KEYS repeats and holds, and VICTORY_KEYS_FILE #3239

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

@⁠EgoraWyn on GitHub · 2026-11-26 14:15 UTC · original
EgoraWyn:victory-keys-repeat-hold → main · +174 −31 · 1 files · 1 commits · open

Extends the diagnostic scripted-key list (VICTORY_KEYS, diagnostics feature) in crates/victory-hle/src/modules/gameinput.rs.

What

  • <from>-<to>:<key> holds the key for the whole span.
  • <from>-<to>/<every>:<key> presses it for 0.2 s every <every> seconds in the span.
  • <from>-<to>/<every>+<hold>:<key> holds each press <hold> seconds. <hold> must be > 0 and < <every>, otherwise the entry is rejected.
  • VICTORY_KEYS_FILE=<path>: a key name appended as a new line is pressed once that line appears, so a script that watches the log can press exactly when a screen is ready (Add-Content <path> Enter).

Existing <seconds>:<key> lists parse as before. Nothing changes unless the variables are set.

Why

In unattended smoke runs, fixed timestamps either press too early or wait up to a whole period. Hold-to-skip cutscenes need a long press. For example, 2-200/3+2.5:Enter steps through menus and also holds long enough to skip the cutscene.

Testing

  • New unit test scripts_repeat_and_hold: covers periods, spans and holds, and rejects a zero hold or a hold >= the period.
  • cargo check -p victory-hle with and without --features diagnostics: no new warnings.
  • The original version of this change was used for smoke runs on an RTX 3060 Laptop 6 GB (Windows 11).

🤖 Generated with Claude Code

**@⁠EgoraWyn** on GitHub · 2026-11-26 14:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3239) `EgoraWyn:victory-keys-repeat-hold` → `main` · +174 −31 · 1 files · 1 commits · open Extends the diagnostic scripted-key list (`VICTORY_KEYS`, `diagnostics` feature) in `crates/victory-hle/src/modules/gameinput.rs`. ## What - `<from>-<to>:<key>` holds the key for the whole span. - `<from>-<to>/<every>:<key>` presses it for 0.2 s every `<every>` seconds in the span. - `<from>-<to>/<every>+<hold>:<key>` holds each press `<hold>` seconds. `<hold>` must be > 0 and < `<every>`, otherwise the entry is rejected. - `VICTORY_KEYS_FILE=<path>`: a key name appended as a new line is pressed once that line appears, so a script that watches the log can press exactly when a screen is ready (`Add-Content <path> Enter`). Existing `<seconds>:<key>` lists parse as before. Nothing changes unless the variables are set. ## Why In unattended smoke runs, fixed timestamps either press too early or wait up to a whole period. Hold-to-skip cutscenes need a long press. For example, `2-200/3+2.5:Enter` steps through menus and also holds long enough to skip the cutscene. ## Testing - New unit test `scripts_repeat_and_hold`: covers periods, spans and holds, and rejects a zero hold or a hold >= the period. - `cargo check -p victory-hle` with and without `--features diagnostics`: no new warnings. - The original version of this change was used for smoke runs on an RTX 3060 Laptop 6 GB (Windows 11). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`<from>-<to>:<key>` holds a key for a span, `<from>-<to>/<every>:<key>`
presses it for 0.2 s every `<every>` seconds, and `/<every>+<hold>` holds
each press `<hold>` seconds (0 < hold < every), e.g. `2-200/3+2.5:Enter`
steps through menus and holds through hold-to-skip cutscenes.
VICTORY_KEYS_FILE presses keys named on lines appended to a file, so a
script watching the log can press exactly when a screen is ready.
Plain `<seconds>:<key>` lists parse as before; still behind the
`diagnostics` feature. Unit test: scripts_repeat_and_hold.

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

@⁠cloph-dsp on GitHub · 2026-11-26 14:23 UTC · original

Independent local verification of head 29b45f0 on Windows 11, Rust 1.100.0/MSVC:

  • cargo test --locked -p victory-hle --lib -- modules::gameinput::host::scripts_repeat_and_hold --exact — 1 passed, 0 failed (143 filtered).
  • git diff --check <merge-base 940d32f> HEAD — clean. git diff --check origin/main HEAD flags an unrelated new blank line at EOF in crates/victory-formats/src/xma/tables.rs from newer main, not from this PR.
  • Worktree-local CARGO_TARGET_DIR used.

Synthetic VICTORY_KEYS string fixtures only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash). GPU/driver N/A (CPU-only unit test).

**@⁠cloph-dsp** on GitHub · 2026-11-26 14:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3239#issuecomment-7194747890) Independent local verification of head `29b45f0` on Windows 11, Rust 1.100.0/MSVC: - `cargo test --locked -p victory-hle --lib -- modules::gameinput::host::scripts_repeat_and_hold --exact` — 1 passed, 0 failed (143 filtered). - `git diff --check <merge-base 940d32f> HEAD` — clean. `git diff --check origin/main HEAD` flags an unrelated new blank line at EOF in `crates/victory-formats/src/xma/tables.rs` from newer main, not from this PR. - Worktree-local `CARGO_TARGET_DIR` used. Synthetic `VICTORY_KEYS` string fixtures only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash). GPU/driver N/A (CPU-only unit test).
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-26 14:24 UTC · original · reviewed

Useful for unattended runs. Pulling parse_script/held_at out of the LazyLock makes the timing testable, and old <seconds>:<key> lists still give a 0.2 s press. I checked the test rows by hand: 5.1 hits both 5:Enter and Down's fourth period (3.1 % 1 < 0.2), 10.05 is outside 2-10 (the end is exclusive), and 7/0.1 is rejected because its default 0.2 s hold isn't shorter than the period. All as expected.

On VICTORY_KEYS_FILE:

1. A line read before it's complete is consumed. asked() re-reads the file and takes lines().nth(done), but lines() also yields a last line with no trailing newline yet. If the poll happens while a writer is midway through (Ent of Enter), key_named returns None, done still advances, and that key is never pressed. The log line even says a key "was asked for". Add-Content usually writes the line and newline together, but an editor or a different script may not. Counting only lines terminated by \n, i.e. taking text.split_inclusive('\n'), skipping a last piece without '\n', and leaving done alone in that case, would make this robust.

2. Unknown names fail silently. A typo (enter, Space) is logged as asked and then dropped. A warn! naming the line when key_named returns None would save a confusing unattended run.

3. Append-only, worth one doc line. Since done indexes lines, a script that truncates or rewrites the file (instead of appending) stops all further presses. The doc comment could say "append one line per key".

A minor point: <at>/<every> without a -<to> parses (the span becomes at..at + 0.2 s), so the period never applies. Rejecting a period without a span would catch that mistake too.

**@⁠AurumCarlos** on GitHub · 2026-11-26 14:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3239#pullrequestreview-6075775772) · **reviewed** Useful for unattended runs. Pulling `parse_script`/`held_at` out of the `LazyLock` makes the timing testable, and old `<seconds>:<key>` lists still give a 0.2 s press. I checked the test rows by hand: `5.1` hits both `5:Enter` and `Down`'s fourth period (`3.1 % 1 < 0.2`), `10.05` is outside `2-10` (the end is exclusive), and `7/0.1` is rejected because its default 0.2 s hold isn't shorter than the period. All as expected. On `VICTORY_KEYS_FILE`: **1. A line read before it's complete is consumed.** `asked()` re-reads the file and takes `lines().nth(done)`, but `lines()` also yields a last line with no trailing newline yet. If the poll happens while a writer is midway through (`Ent` of `Enter`), `key_named` returns `None`, `done` still advances, and that key is never pressed. The log line even says a key "was asked for". `Add-Content` usually writes the line and newline together, but an editor or a different script may not. Counting only lines terminated by `\n`, i.e. taking `text.split_inclusive('\n')`, skipping a last piece without `'\n'`, and leaving `done` alone in that case, would make this robust. **2. Unknown names fail silently.** A typo (`enter`, `Space`) is logged as asked and then dropped. A `warn!` naming the line when `key_named` returns `None` would save a confusing unattended run. **3. Append-only, worth one doc line.** Since `done` indexes lines, a script that truncates or rewrites the file (instead of appending) stops all further presses. The doc comment could say "append one line per key". A minor point: `<at>/<every>` without a `-<to>` parses (the span becomes `at..at + 0.2 s`), so the period never applies. Rejecting a period without a span would catch that mistake too.
Author
Owner

@⁠evan-kolberg on GitHub · 2026-11-26 16:20 UTC · original

On an M4 Pro with CrossOver 26.3.0.39832, a headless Rust probe read only the first 4,890 characters of a generated 37,658-character ASCII VICTORY_KEYS value. Both the reported length and the digest matched that exact prefix. Equivalent schedules of 18,464 characters in the existing pulse format and 404 characters in a duration encoding both arrived byte-for-byte. This matches the 16-bit byte count in Wine 11's environment query and gives a practical use for @⁠EgoraWyn's compact hold ranges.

Prepared and tested with Codex.

**@⁠evan-kolberg** on GitHub · 2026-11-26 16:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/3239#issuecomment-7197522204) On an M4 Pro with CrossOver 26.3.0.39832, a headless Rust probe read only the first **4,890 characters** of a generated 37,658-character ASCII `VICTORY_KEYS` value. Both the reported length and the digest matched that exact prefix. Equivalent schedules of 18,464 characters in the existing pulse format and 404 characters in a duration encoding both arrived byte-for-byte. This matches the 16-bit byte count in [Wine 11's environment query](https://github.com/wine-mirror/wine/blob/wine-11.0/dlls/ntdll/env.c) and gives a practical use for [@⁠EgoraWyn's compact hold ranges](https://github.com/Marvisak/VIctory/commit/29b45f01240ca447e332f50e9258c5c068b25c29). Prepared and tested with Codex.
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/3239/head:github-bot/gh-3239'
git switch 'github-bot/gh-3239'

Merge

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