fix(pad): keep a latched press for one and a half read intervals #9919
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9919"
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?
Imported from boykopovar/AnyPS5. Originally posted by zaidhawk on 2026-10-22T21:47:53Z.
What
A press that starts and ends between two
scePadReadStatecalls is latched (#7059), but dropped after a fixed 100 ms (kLatchExpiry). A title that reads the pad less often than every 100 ms loses most quick taps. Persona 3 Reload (PPSA10872, #9692) reads only throughscePadReadState, about every 170 ms on its title screen and menus, and needed several presses per menu step.The latch now lasts 1.5 × the interval between the title's two previous reads, clamped to 100–500 ms (
LatchExpiry()), as the #7059 review suggested ("about one read interval"). The interval is the one from before the current read, so a pause in reading (a load screen) keeps the window of the cadence before it, and an older press is still dropped. A title reading at 60 FPS keeps the 100 ms window.Tests:
CheckLatchedPressAtSlowReadsreads 170 ms apart, then expects a tap made 150 ms before the next read to be reported, and one made 400 ms before to be dropped. Without the change it fails at the first of these.CheckLatchedPressPerPortreads ports 0 and 1 back to back, 170 ms apart, then taps Cross on port 0 and expects it at a read 150 ms later. With one interval shared by all ports, the port 1 read right after port 0's sets it to about 0 and the window to 100 ms, so the tap is dropped.CheckLatchedPressLifetime's third case (X, 150 ms, O) came right after a read 150 ms after the previous one, which now gives a 225 ms window. It reads once more right before X, so it still models a title that was reading every frame and then paused.Limit: a single long frame after fast reads (80 ms, then 200 ms) still uses the fast cadence's window, so a tap early in that frame can be dropped.
Since #7881 the read interval is kept per controller (
PadSlot::lastReadAtandreadInterval), so a title that reads several ports in a row doesn't shrink any port's window.Tested
main5357acd69(after #7881; head98e1c3765):ctest -R pad15/15, 3 runs.guest_padwith the new tests andmain'sPadState.cppfails at the slow-read "tap is reported" check; with one read interval shared by all ports it fails at the new per-port check (3 of 3 runs each). Earlier heads onmain001d132f4and0db47b263passed the same way.tools/check_conventions.py --base origin/main: passed.scePadReadStateabout every 170 ms), 30 Down key taps of 40 ms, one per second, sent with keybd_event to the focused window:main10 of 30 lost, this PR 0 of 30.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:48:36Z.
Review: COMMENTED
The timing formula and regression cases match the observed ~170 ms menu-read cadence; the author reports 15/15 pad tests across three runs and a 30-tap P3 Reload A/B (10/30 lost on main, 0/30 on this change). Current-main whitespace and conventions pass. Current sync shows a clean merge but a shared
GuestPad.cppedit from merged #9664 adding tracker-device coverage. Please refresh the test file and rerun the focused pad suite on the integrated head, preserving those tests. The #7881 per-controller and #6337 timestamp coordination remains explicit and no dependency is needed if either can rebase independently.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:48:37Z.
Review: DISMISSED
Please refresh onto current main and rerun the focused pad tests: the branch is 439 commits behind and current main has added tracker-device cases to the same
GuestPad.cppfile (#9664). The merge is clean, but the submitted test run predates that integration. Keep the current latch interval/lifetime assertions and preserve the new tracker tests. The implementation and reported title A/B otherwise look well supported; current-main conventions and diff-check pass.