Report overlapping VICTORY_KEYS holds as one active key #2718

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

@⁠VlREX on GitHub · 2026-11-25 18:46 UTC · original
VlREX:fix/duplicate-scripted-keys → main · +69 −6 · 1 files · 2 commits · open

With VICTORY_KEYS=0:W,0.05:A,0.1:W the diagnostics keyboard reported W, A, W at 100 ms. Report each active virtual key once, releasing it only after its last hold expires. A deterministic regression test exercises overlapping intervals, another simultaneously held key, and the release boundary. It failed before the fix and passed afterward, alongside seven existing fake-host input tests in an isolated Windows GNU run. No game assets or physical keyboard required.

**@⁠VlREX** on GitHub · 2026-11-25 18:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2718) `VlREX:fix/duplicate-scripted-keys` → `main` · +69 −6 · 1 files · 2 commits · open With VICTORY_KEYS=0:W,0.05:A,0.1:W the diagnostics keyboard reported W, A, W at 100 ms. Report each active virtual key once, releasing it only after its last hold expires. A deterministic regression test exercises overlapping intervals, another simultaneously held key, and the release boundary. It failed before the fix and passed afterward, alongside seven existing fake-host input tests in an isolated Windows GNU run. No game assets or physical keyboard required.
Merge continuous holds during schedule initialization, including touching intervals. Preserve chronological order with stable ties and avoid Duration overflow. Addresses DrDarkDK's review on #2718; overlaps with the approach in #2499.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:42 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 18:50 UTC · original

The .len() check at 249 ms misses an order change in this fixture. active_scripted_keys returns WA at 199 ms and AW at 200 ms. The first W interval expires, but the second still holds W, so neither key was released or pressed at that boundary.

Could the test assert WA at 249 ms? The earlier #2499 covers the same overlap and preserves the order by merging holds before polling.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2718#issuecomment-7171469522) The `.len()` check at 249 ms misses an order change in this fixture. `active_scripted_keys` returns `WA` at 199 ms and `AW` at 200 ms. The first W interval expires, but the second still holds W, so neither key was released or pressed at that boundary. Could the test assert `WA` at 249 ms? The earlier #2499 covers the same overlap and preserves the order by merging holds before polling. *AI-assisted with Codex.*
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:51 UTC · original

Correct - dedupe keeps first-occurrence order and a key survives until its last overlapping hold expires; checked_sub also avoids the subtraction-underflow the old window check would hit before t=0. Boundary tests at exactly 200/250ms pin the half-open interval.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2718#issuecomment-7171504452) Correct - dedupe keeps first-occurrence order and a key survives until its last overlapping hold expires; checked_sub also avoids the subtraction-underflow the old window check would hit before t=0. Boundary tests at exactly 200/250ms pin the half-open interval.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:18 UTC · original

Automated triage for the maintainers.

This PR merges overlapping holds of the same key in the diagnostics-only VICTORY_KEYS path (scripted() in crates/victory-hle/src/modules/gameinput.rs, via scheduled_key_holds / active_scripted_keys). The merge logic reads correctly. However, #2499 made the same change and was closed on review today. Duplicates only appear when a script schedules the same key twice within 0.2 s, and the title ORs key states into its table, so a repeated key changes nothing it sees. This PR also rewrites the same scripted() as the open #2205 (per-entry hold lengths) and would need to be redone on top of it. To change this, show a case where the duplicate or the order change alters what the title does.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2718#issuecomment-7177398155) <!-- victory-triage v1 head=ee868cd01b7be2518309458013bbdc743f984bcd verdict=proposed-close at=2026-11-25T23:18:48Z --> Automated triage for the maintainers. This PR merges overlapping holds of the same key in the diagnostics-only `VICTORY_KEYS` path (`scripted()` in `crates/victory-hle/src/modules/gameinput.rs`, via `scheduled_key_holds` / `active_scripted_keys`). The merge logic reads correctly. However, #2499 made the same change and was closed on review today. Duplicates only appear when a script schedules the same key twice within 0.2 s, and the title ORs key states into its table, so a repeated key changes nothing it sees. This PR also rewrites the same `scripted()` as the open #2205 (per-entry hold lengths) and would need to be redone on top of it. To change this, show a case where the duplicate or the order change alters what the title does. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/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/2718/head:github-bot/gh-2718'
git switch 'github-bot/gh-2718'

Merge

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