HLE: VICTORY_KEYS repeats and holds, and VICTORY_KEYS_FILE #3237

Open
EgoraWyn wants to merge 1 commit from upstream-pr/3239 into main
EgoraWyn commented 2026-11-26 14:15:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by EgoraWyn on 2026-11-26T14:15:35Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:5511632735 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3239). Originally posted by [EgoraWyn](https://github.com/EgoraWyn) on 2026-11-26T14:15:35Z. --- 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)
AurumCarlos commented 2026-11-26 14:24:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-26T14:24:53Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6075775772 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3239#pullrequestreview-6075775772). Originally posted by [AurumCarlos](https://github.com/AurumCarlos) on 2026-11-26T14:24:53Z. **Review:** COMMENTED --- 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.
cloph-dsp commented 2026-11-26 15:02:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T14:23:17Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7194747890 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3239#issuecomment-7194747890). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-26T14:23:17Z. --- 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).
evan-kolberg commented 2026-11-26 16:20:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by evan-kolberg on 2026-11-26T16:20:53Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197522204 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3239#issuecomment-7197522204). Originally posted by [evan-kolberg](https://github.com/evan-kolberg) on 2026-11-26T16:20:53Z. --- 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.
futurepro62 commented 2026-11-27 23:02:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T23:02:57Z.


NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head 29b45f0 (on its base 940d32f).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 697 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: scripts_repeat_and_hold.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7229829119 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3239#issuecomment-7229829119). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-27T23:02:57Z. --- NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head `29b45f0` (on its base `940d32f`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **697 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `scripts_repeat_and_hold`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
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/3239:upstream-pr/3239'
git switch 'upstream-pr/3239'

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/3239'
git switch 'upstream-pr/3239'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3239'
git switch 'upstream-pr/3239'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3239'
git switch 'main'
git merge --squash 'upstream-pr/3239'
git switch 'main'
git merge --ff-only 'upstream-pr/3239'
git switch 'main'
git merge 'upstream-pr/3239'
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
Marvisak/VIctory!3237
No description provided.