Skip to content

GameInput: merge overlapping holds from VICTORY_KEYS - #2499

Closed
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/scripted-key-overlap
Closed

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/scripted-key-overlap

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

VICTORY_KEYS holds each scheduled key for 200 ms. When two events for the same key overlap, the keyboard reading currently contains two copies of that key. The end of the earlier event can also change the ordering of still-held keys.

Build continuous hold intervals once at startup. Overlapping and touching intervals for the same key share one hold, in scheduled press order. A real gap still allows the key to be released and pressed again.

The same synthetic schedule returns A, B, A halfway through the overlap on 940d32f and A, B with this change. It also checks that A, B stays in order past the earlier event's end, that the keys are released at the end of their holds, and that a later A becomes a separate press. The 10 GameInput tests, strict HLE Clippy with diagnostics, and staged asset policy passed on Windows.

Coordination claim

Please retain the Git author when cherry-picking or rebasing. If you fold the change into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.

AI-assisted with Codex.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f):

  • Merging overlapping scripted holds from VICTORY_KEYS into connected host pads is clean and well-tested.
  • cargo test -p victory-hle gameinput: 9/9 passed (including scripted_keys_merge_into_connected_host_pad).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Recommended for a look (not an approval).

In crates/victory-hle/src/modules/gameinput.rs (diagnostics-only VICTORY_KEYS path), scripted() returned one entry per overlapping event, so Host::keys() could report the same key twice in one keyboard reading. The PR builds merged hold intervals once (scheduled_key_holds) and reads them with scripted_at; I checked the merge logic and the test's expected timings (overlap merged, end exclusive, a later press after a gap is separate). Small and contained to the diagnostics feature; CI (check) is passing.


Generated by Claude Code

VlREX added a commit to VlREX/VIREX that referenced this pull request Nov 25, 2026
Merge continuous holds during schedule initialization, including touching intervals. Preserve chronological order with stable ties and avoid Duration overflow. Addresses DrDarkDK's review on Marvisak#2718; overlaps with the approach in Marvisak#2499.
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because the duplicates it merges change nothing: they arise only when a script schedules the same key twice within 0.2 s, and the title ORs key states into its table. It rewrites the same scripted() as #2205 (per-entry hold lengths) and would have to be redone on top of that.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants