Input: a tap is kept until the title has read it (taps were lost at a few frames a second) #640
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!640
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-640"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@sagouindupm on GitHub · 2026-11-25 03:45 UTC · original
sagouindupm:input-latch-pr→main· +154 −14 · 1 files · 2 commits · openWhat
A key or pad button that is pressed and released between two of the title's input readings is now reported as down until the title has read it.
Why
The host is polled every 8 ms, and the title takes the current reading about once a frame. On a slow card a frame is far longer than a tap, so the press is down and up again before the title looks, and it is lost. On my 8 GB card (Series S profile, about 370 ms a frame in the world) the menu key only answered when held for a frame or more.
#23 (history 32 to 256) helps a title that walks the history, but here the title takes the current reading, so a longer history alone is not enough: see the numbers below.
How
crates/victory-hle/src/modules/gameinput.rsonly:current_readingcounts the title's readings (LOOKS).Latchkeeps each press from when it begins until the title has taken 2 current readings since (2, because a pad reading and a keyboard reading of the same frame are separate calls), or 2 s for a title that is not reading at all. A key that is still held is untouched, and is released as soon as it is let go once the title has seen it.Cost when nothing is tapped: nothing changes. Cost of a tap: it lasts at most 2 title readings longer than the finger.
Measured
RTX 3050 8 GB, i5-12400F, Windows 11, release build, Series S profile, first room of the world (about 370 ms a frame). A script presses the menu key for 60 ms; the pause menu opening shows as the window title falling from about 4600 draws to about 90 draws a frame.
main(c96b4f2+ the Series S PRs)A 1.5 s hold opens the menu on all three.
cargo test --release -p victory-hleon310c6eb+ this commit: 100 passed, 0 failed (4 new tests of the latch: a tap between two readings is kept, a held key is released when let go, a tap is dropped after 2 s without readings, keys are latched one by one).Not tested: a real pad (the button path uses the same latch, but I only have a keyboard here), Series X, Linux/Proton.
AI-assisted: Claude Code (Claude Fable 5.2) wrote the change and ran the measurements, under my direction.
@ryotdev on GitHub · 2026-11-25 03:54 UTC · original
I reproduced one way a tap can still disappear on
f0fecd2. In a Windows test I queued a short keyboard press, then calledGetCurrentReadingtwice for a disconnected pad before the next host poll. Both calls returnedDEVICE_DISCONNECTED. The next poll released the key before the title received any keyboard reading. Successful reads of a different physical controller can also consume the same global count.One-file follow-up with regression test. It counts successful deliveries per input source, with the stand-in pad and keyboard sharing their sampled keys. The test covers a disconnected slot, a separate connected pad and returns through both keyboard-backed devices. The disconnected case failed on the original PR. The updated Windows HLE suite passed 101/101 using a simulated controller. I haven't tested a physical controller. AI-assisted.
@sagouindupm on GitHub · 2026-11-25 04:44 UTC · original
@ryotdev thank you, you are right on both counts: a failed read and a read of another controller should not count. Taken as
91d9e53on this branch (your317d7a4cherry-picked with-x, your authorship kept).Here on Windows:
cargo test --release -p victory-hle101 passed, 0 failed, withonly_successful_reads_from_the_input_source_count_toward_a_tapamong them. The in-game count in the description (5 of 5 taps) was made onf0fecd2; I have not repeated it on91d9e53yet.AI-assisted: Claude Code (Claude Fable 5.2) reviewed and tested the follow-up.
@sagouindupm on GitHub · 2026-11-25 04:56 UTC · original
In-game count repeated on
91d9e53(same card and scene, about 340 ms a frame): 5 of 5 taps of 60 ms opened the pause menu, as onf0fecd2.AI-assisted: Claude Code (Claude Fable 5.2) ran the test.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.