fix(libScePad): smooth a slow-reporting mouse over its measured report interval #7498
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7498"
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 AlxcBTW on 2026-10-18T09:35:49Z.
What
The mouse-to-stick filter (
Pad::MouseStick) smooths with a fixed 10 ms time constant (MouseSmoothingMs). A 125 Hz mouse reports every 8 ms and a 250 Hz mouse every 4 ms; the window loop runs at a different rate, so one update sees one report, the next two, and the stick wavers at constant hand speed. SDL2 cannot supply better timing:SDL_PushEventstamps events withSDL_GetTicks()when they are queued, and WM_INPUT is handled insideSDL_PumpEvents, so a whole update shares one millisecond. The event count, however, does carry the report rate.Pad::MouseSticknow counts the motion events and the time they span (gaps over 50 ms are cut to 50 ms) over windows of 0.25 s. Windows with at least 10 reports whose mean size is at least 2 counts set a measured report rate. The smoothing time constant is thenmax(MouseSmoothingMs, min(3 / rate, 30 ms)), that is, at least three report intervals up to 30 ms. A mouse at 300 reports per second or more, and a setting ofMouseSmoothingMs = 0, behave exactly as before. Single-count reports (a mouse moving at its sensor's smallest step) are not taken for a slow mouse.The behaviour is documented on the
MouseSmoothingMsrow ofdocs/user/INPUT_MAPPING.md.Tested
06ca6a066plus the CI scaffolding commit; run 39113861695, ctest-R '^(pad_|guest_pad|video_out_mouse|mouse_input|keyboard_input)'): 9 of 9 passed, among thempad_keyboard_mouse. Not run on Windows.pad_keyboard_mouse:slow reporting mouse: 125, 250 and 1000 Hz mice at a steady half-tilt speed, polled every 16.7, 8.3, 6.9 and 1 ms. The stick's spread between its lowest and highest value over a second stays under 0.125 and its mid-point within 0.05 of the expected tilt.report rate smoothing: the measured rate is within 10 % of 125, 250 and 1000 Hz, the smoothing ismax(10 ms, 3 / rate), very slow reports (40 Hz) stop at 30 ms,MouseSmoothingMs = 0stays 0, and single-count reports are not taken for a slow mouse.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pylists #6353 (KeyboardMouse.hpp, the constants at the top; no shared function) and could not compare #674 and #4891 (docs/user/INPUT_MAPPING.md). Based oncdb7ed035.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 github-actions[bot] on 2026-10-18T10:31:38Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/user/INPUT_MAPPING.mddocs/user/INPUT_MAPPING.mdcore/libs/prx/libScePad/include/KeyboardMouse.hppcore/libs/prx/libSceVideoOut/src/KeyboardMouse.cppcore/libs/prx/libSceVideoOut/tests/KeyboardMouse.cppdocs/user/INPUT_MAPPING.mdImported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T16:44:35Z.
Windows run, since the description lists Windows as not run. Windows 11 26300, Ryzen AI 7 350, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON. Build:main6efb7261bwith #6648, #7559, #7496, #7497 and #7498 merged together (each merge clean, built once).pad_keyboard_mouseandpad_input_mappingpass 3 runs of 3. The output includes this PR'sslow reporting mouseandreport rate smoothingline, so the new checks ran on Windows.AI-assisted