fix(libSceMouse): sum consecutive motion into the newest unread report #9982

Merged
Tamalero merged 3 commits from upstream-pr/9982 into main 2026-11-02 17:26:01 +00:00
Tamalero commented 2026-10-23 02:11:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-23T02:11:18Z.


What

High on Life (PPSA15388) reads the mouse through sceMouseRead. At its in-game frame rates (2–9 FPS here), the view follows the mouse 2–4 s late. It keeps turning after the hand stops, and new movement is ignored for 1–2 s until the backlog drains.

Cause: Mouse::Publish enqueues one MouseData per host motion event, into the 64-entry queue. The title calls sceMouseRead(handle, data, 8) once per frame. A gaming mouse sends hundreds of reports a second, so between two frames the queue fills, and enqueue drops the oldest entry for every new one. The title therefore always reads the eight oldest reports still queued, about eight frames behind. Local logging of one session on main (not part of this PR): 83 reads found the queue full at 64 entries, and 3,862 of 8,179 motion reports were dropped.

Fix: when a report carries motion only (no button change, wheel, tilt or connection change) and the newest unread entry is also motion only with the same buttons and connection state, Publish adds the deltas to that entry, saturating at the int32 limits, and moves its timestamp forward. Every other report starts an entry as before. The queue then grows only when the state changes, and the title reads current motion. Total motion is unchanged. Per-report granularity is not reproduced, and that is noted under Functional in docs/dev/debt/libSceMouse.md.

Tested

Linux (CachyOS), GCC 16.2.1, Release. Written and tested in game on main 895f47f4e, then rebased onto main b7a451d62, where mouse_input and both convention checks were rerun.

  • mouse_input (tests/Mouse.cpp), new cases:

    • 300 motion reports are read back as one entry carrying the exact total (−300, 150);
    • motion, press, motion, wheel, motion, release, motion keep their order as 7 entries, with the motion around each state change summed separately;
    • two INT32_MAX reports saturate instead of wrapping;
    • 70 alternating clicks still keep the newest 64, as before.
    • a 0,0 report with no state change adds nothing, and 300 reports alternating x = 0 and 1 (a guest shown larger than its render size) read back as one entry with x = 150 (35ee90267, from review).
    • motion, zero, press, zero, motion, zero, release, zero reads back as exactly four entries in order, with the zero reports gone (3bfc1c11d, from review).

    The earlier case that expected 70 motion reports to keep the newest 64 now expects one summed entry.

  • Negative check: with mouse_impl.cpp restored to main, mouse_input aborts.

  • The 47 tests matching mouse|pad|keyboard|video_out pass. video_out_hdr_present failed once in the parallel run and passes on its own; this change does not touch it.

  • tools/check_conventions.py and tools/check_test_registration.py pass.

  • PPSA15388 in Blim City, mouse look while panning and stopping, with the same local logging:

main 895f47f4e This change
Motion reports received 8,179 32,490
Reads that found the queue full (64) 83 0
Reports dropped 3,862 0
Most entries queued at a read 64 5
Mouse look 2–4 s behind, keeps turning after the hand stops follows the hand

Both runs come from the same session on the same machine, the same save and the same spot. Each build had a local commit (not in this PR) that only logs motion events, queue depth at each read, and drops. An earlier session on main showed the same pattern: 106 reads at a full queue and 5,426 reports dropped.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA15388 #9981
  • GPUs tested: n/a
  • AI-assisted: yes

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4976775437 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9982). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-23T02:11:18Z. --- ### What High on Life (PPSA15388) reads the mouse through `sceMouseRead`. At its in-game frame rates (2–9 FPS here), the view follows the mouse 2–4 s late. It keeps turning after the hand stops, and new movement is ignored for 1–2 s until the backlog drains. **Cause:** `Mouse::Publish` enqueues one `MouseData` per host motion event, into the 64-entry queue. The title calls `sceMouseRead(handle, data, 8)` once per frame. A gaming mouse sends hundreds of reports a second, so between two frames the queue fills, and `enqueue` drops the oldest entry for every new one. The title therefore always reads the eight oldest reports still queued, about eight frames behind. Local logging of one session on `main` (not part of this PR): 83 reads found the queue full at 64 entries, and 3,862 of 8,179 motion reports were dropped. **Fix:** when a report carries motion only (no button change, wheel, tilt or connection change) and the newest unread entry is also motion only with the same buttons and connection state, `Publish` adds the deltas to that entry, saturating at the `int32` limits, and moves its timestamp forward. Every other report starts an entry as before. The queue then grows only when the state changes, and the title reads current motion. Total motion is unchanged. Per-report granularity is not reproduced, and that is noted under Functional in `docs/dev/debt/libSceMouse.md`. ### Tested Linux (CachyOS), GCC 16.2.1, Release. Written and tested in game on `main` 895f47f4e, then rebased onto `main` b7a451d62, where `mouse_input` and both convention checks were rerun. - `mouse_input` (`tests/Mouse.cpp`), new cases: - 300 motion reports are read back as one entry carrying the exact total (−300, 150); - motion, press, motion, wheel, motion, release, motion keep their order as 7 entries, with the motion around each state change summed separately; - two `INT32_MAX` reports saturate instead of wrapping; - 70 alternating clicks still keep the newest 64, as before. - a 0,0 report with no state change adds nothing, and 300 reports alternating x = 0 and 1 (a guest shown larger than its render size) read back as one entry with x = 150 (35ee90267, from review). - motion, zero, press, zero, motion, zero, release, zero reads back as exactly four entries in order, with the zero reports gone (3bfc1c11d, from review). The earlier case that expected 70 motion reports to keep the newest 64 now expects one summed entry. - **Negative check:** with `mouse_impl.cpp` restored to `main`, `mouse_input` aborts. - The 47 tests matching `mouse|pad|keyboard|video_out` pass. `video_out_hdr_present` failed once in the parallel run and passes on its own; this change does not touch it. - `tools/check_conventions.py` and `tools/check_test_registration.py` pass. - **PPSA15388 in Blim City**, mouse look while panning and stopping, with the same local logging: | | `main` 895f47f4e | This change | |---|---|---| | Motion reports received | 8,179 | 32,490 | | Reads that found the queue full (64) | 83 | 0 | | Reports dropped | 3,862 | 0 | | Most entries queued at a read | 64 | 5 | | Mouse look | 2–4 s behind, keeps turning after the hand stops | follows the hand | Both runs come from the same session on the same machine, the same save and the same spot. Each build had a local commit (not in this PR) that only logs motion events, queue depth at each read, and drops. An earlier session on `main` showed the same pattern: 106 reads at a full queue and 5,426 reports dropped. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA15388 #9981 - [x] GPUs tested: n/a - [x] AI-assisted: yes *Tested and written by Claude (AI assistant) on a contributor's machine.*
harisibrar1 commented 2026-10-23 03:19:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-23T03:19:08Z.

Review: COMMENTED


Checked against main 3875f8c8ff and shadPS4 a6025d3 (src/core/libraries/mouse/sdl_mouse.cpp):

  • It merges cleanly. Button, wheel, tilt and connection changes are never merged across, since they carry zero motion and the buttons must match. The int64 clamp is correct for the int32 axes, and everything runs under mouseMutex, as Read does. Thanks for the clear A/B numbers.
  • One gap: MouseInput::scaled can emit motion reports with x=y=0 when the guest is presented larger than its source size (scale < 1, e.g. 1080p shown at 4K, where xrel=1 alternates 0,1,0,1). A 0,0 report isn't motionOnly (mouse_impl.cpp:28-30), so it gets its own entry and also stops the next report from merging (:39). Simulating the merge logic with 300 such events, the queue still ends full at 64 entries and 32 of 150 units arrive, the same as main. Could zero-delta reports with no state change be dropped or merged too, with a test for that case?
  • For the record: shadPS4 also queues one entry per SDL motion event, so the summing is AnyPS5's own heuristic rather than measured console behaviour. The debt entry under Functional covers that. A console probe of how many entries a fast mouse produces per frame would settle it, if anyone has the hardware.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5623501819 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9982#pullrequestreview-5623501819). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-23T03:19:08Z. **Review:** COMMENTED --- Checked against main 3875f8c8ff and shadPS4 a6025d3 (`src/core/libraries/mouse/sdl_mouse.cpp`): - It merges cleanly. Button, wheel, tilt and connection changes are never merged across, since they carry zero motion and the buttons must match. The int64 clamp is correct for the `int32` axes, and everything runs under `mouseMutex`, as `Read` does. Thanks for the clear A/B numbers. - One gap: `MouseInput::scaled` can emit motion reports with x=y=0 when the guest is presented larger than its source size (scale < 1, e.g. 1080p shown at 4K, where `xrel=1` alternates 0,1,0,1). A 0,0 report isn't `motionOnly` (mouse_impl.cpp:28-30), so it gets its own entry and also stops the next report from merging (:39). Simulating the merge logic with 300 such events, the queue still ends full at 64 entries and 32 of 150 units arrive, the same as main. Could zero-delta reports with no state change be dropped or merged too, with a test for that case? - For the record: shadPS4 also queues one entry per SDL motion event, so the summing is AnyPS5's own heuristic rather than measured console behaviour. The debt entry under Functional covers that. A console probe of how many entries a fast mouse produces per frame would settle it, if anyone has the hardware. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-10-23 04:12:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T04:12:59Z.

Review: CHANGES_REQUESTED


I reviewed exact head 014d9de4b6. Blocking edge case: motionOnly requires at least one nonzero axis. When host-to-guest scaling rounds a motion event to (0, 0), mergeMotion rejects it and Publish enqueues it as a separate entry. That zero entry then sits between two otherwise mergeable motion reports, so the next report cannot merge with the earlier tail; repeated scaled events can still fill the 64-entry queue and drop the oldest motion. This defeats the fix for common fractional scale factors.

Please handle zero-delta reports that carry no button/wheel/tilt/connection change without consuming a queue slot or breaking adjacent motion coalescing, and add a regression that alternates zero and nonzero scaled deltas (for example 0, 1, 0, 1) while checking the accumulated total and queue depth. Preserve ordering around actual state-change events.

Hosted eligibility, conventions, intake, labels and report checks pass; product builds are skipped by policy. The PR reports Linux mouse_input and input-family tests plus an in-game A/B. I could not run the local test binary because this workspace has no configured AnyPS5 build. I have not approved this head because the zero-delta path can still reproduce the reported backlog/drop behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5623799685 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9982#pullrequestreview-5623799685). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T04:12:59Z. **Review:** CHANGES_REQUESTED --- I reviewed exact head 014d9de4b6f5db6574fb276aa52b5ba62e8e8afa. Blocking edge case: `motionOnly` requires at least one nonzero axis. When host-to-guest scaling rounds a motion event to `(0, 0)`, `mergeMotion` rejects it and `Publish` enqueues it as a separate entry. That zero entry then sits between two otherwise mergeable motion reports, so the next report cannot merge with the earlier tail; repeated scaled events can still fill the 64-entry queue and drop the oldest motion. This defeats the fix for common fractional scale factors. Please handle zero-delta reports that carry no button/wheel/tilt/connection change without consuming a queue slot or breaking adjacent motion coalescing, and add a regression that alternates zero and nonzero scaled deltas (for example `0, 1, 0, 1`) while checking the accumulated total and queue depth. Preserve ordering around actual state-change events. Hosted eligibility, conventions, intake, labels and report checks pass; product builds are skipped by policy. The PR reports Linux `mouse_input` and input-family tests plus an in-game A/B. I could not run the local test binary because this workspace has no configured AnyPS5 build. I have not approved this head because the zero-delta path can still reproduce the reported backlog/drop behavior.
MarcZX10 commented 2026-10-29 10:17:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T10:17:08Z.

Review: APPROVED


Re-reviewed exact head 3bfc1c11d0af53b202032aa2929be6c59b0a4cf5 against current main f99d7fece316e31878f0195f8bbc2ad2fbe635e4.

The earlier zero-delta blocker is resolved. Publish now drops a report with no motion or state change before it can occupy a queue slot, and the new tests cover alternating zero/nonzero scaled motion, accumulated totals, queue depth, ordering across button/wheel changes, and saturation. Connection changes and button resets remain separate entries; the debt entry discloses that per-report granularity is an emulator heuristic.

Current-main merge preview is clean. The only current-main change in the PR's paths is the test's consolidation onto Api.hpp; the merged preview contains the header and removes the duplicate local declarations. git diff --check and tools/check_conventions.py pass. The author reports the focused Linux test and 47 input-family tests passing on the rebased head; independent Windows reports cover the focused test and its negative control. Hosted product test jobs are skipped, and I did not run a local build or physical-console test.

No remaining actionable finding in this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696094485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9982#pullrequestreview-5696094485). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T10:17:08Z. **Review:** APPROVED --- Re-reviewed exact head `3bfc1c11d0af53b202032aa2929be6c59b0a4cf5` against current `main` `f99d7fece316e31878f0195f8bbc2ad2fbe635e4`. The earlier zero-delta blocker is resolved. `Publish` now drops a report with no motion or state change before it can occupy a queue slot, and the new tests cover alternating zero/nonzero scaled motion, accumulated totals, queue depth, ordering across button/wheel changes, and saturation. Connection changes and button resets remain separate entries; the debt entry discloses that per-report granularity is an emulator heuristic. Current-main merge preview is clean. The only current-main change in the PR's paths is the test's consolidation onto `Api.hpp`; the merged preview contains the header and removes the duplicate local declarations. `git diff --check` and `tools/check_conventions.py` pass. The author reports the focused Linux test and 47 input-family tests passing on the rebased head; independent Windows reports cover the focused test and its negative control. Hosted product test jobs are skipped, and I did not run a local build or physical-console test. No remaining actionable finding in this review.
XairRrR commented 2026-10-29 10:29:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:29:59Z.

Review: APPROVED


Reviewed — approved

The coalescing of consecutive motion-only reports is correct, it merges cleanly into current main, the input-family tests pass, and the new mouse_input cases fail without the production change.

What I ran

  • PR head: 3bfc1c11d0af53b202032aa2929be6c59b0a4cf5
  • main: f48ef6a076b68c07c6c22bad6f609080a36e10ed
  • Host: Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, Release, Ninja, BUILD_TESTING=ON, in a clean worktree.
git fetch -q origin main pull/9982/head:refs/review/9982
git checkout -q --detach origin/main
git merge -q --no-ff --no-edit refs/review/9982
git diff --check origin/main...refs/review/9982
python3 tools/check_conventions.py --base origin/main
python3 tools/check_test_registration.py
cmake --build build -j10 --target mouse_tests libs
cmake --build build -j10
ctest --test-dir build -j4 -R 'mouse|keyboard|pad_' --output-on-failure
# negative control
git checkout origin/main -- core/libs/prx/libSceMouse/src/mouse_impl.cpp
cmake --build build -j10 --target mouse_tests
ctest --test-dir build -R '^mouse_input$' --output-on-failure
git checkout HEAD -- core/libs/prx/libSceMouse/src/mouse_impl.cpp
cmake --build build -j10 --target mouse_tests
ctest --test-dir build -R '^mouse_input$'

Results

Check Result
Merge into main f48ef6a07 Clean (auto-merge of tests/Mouse.cpp)
git diff --check Clean
tools/check_conventions.py --base origin/main All conventions checks passed
tools/check_test_registration.py No unregistered tests
Build (libs and full tree) OK
mouse_input, video_out_mouse, pad_keyboard_mouse and the other 15 tests matching mouse|keyboard|pad_ 18/18 passed, longest 0.38 s
Negative control (mouse_impl.cpp from main) mouse_input aborts
ctest, merged tree
 1/18 Test #2315: video_out_mouse    Passed    0.09 sec
 2/18 Test   #91: pad_input    Passed    0.11 sec
 3/18 Test #2338: pad_sdl    Passed    0.03 sec
 4/18 Test  #850: agc_keyboard_overlay    Passed    0.00 sec
 5/18 Test #2341: pad_keyboard_mouse    Passed    0.01 sec
 6/18 Test #2339: pad_input_mapping    Passed    0.00 sec
 7/18 Test #1988: guest_ime_pad_route    Passed    0.00 sec
 8/18 Test #2203: guest_pad_vibration_mode    Passed    0.00 sec
 9/18 Test #1989: guest_ime_keyboard    Passed    0.00 sec
10/18 Test #1849: audio_out_vibration_pad_control    Passed    0.00 sec
11/18 Test #2095: mouse_input    Passed    0.00 sec
12/18 Test #2340: pad_output_pacing    Passed    0.00 sec
13/18 Test #2041: keyboard_input    Passed    0.00 sec
14/18 Test #1992: ime_dialog_pad_keyboard    Passed    0.00 sec
15/18 Test #1855: audio_out2_pad_mix    Passed    0.00 sec
16/18 Test    #4: pad_command_file    Passed    0.00 sec
17/18 Test #1856: audio_out_mix_level_pad_spk    Passed    0.29 sec
18/18 Test   #92: pad_timeline    Passed    0.38 sec
100% tests passed out of 18
ctest, negative control
0% tests passed, 1 tests failed out of 1
The following tests FAILED:
	2095 - mouse_input (Subprocess aborted)

Negative control

I restored only core/libs/prx/libSceMouse/src/mouse_impl.cpp from main, kept the new tests/Mouse.cpp, rebuilt mouse_tests and ran mouse_input: it aborts. With the PR's file restored it passes again. This matches the author's Linux result and the Windows results posted in the comments.

Findings

Blocking

None.

Non-blocking

None.

Notes from reading the code, for the record:

  • The zero-delta gap raised in the earlier reviews of 014d9de4b is closed. A report with no motion and no button, wheel, tilt, reset or connection change returns before it reaches the queue (mouse_impl.cpp:122). The test that alternates x = 0 and 1 (tests/Mouse.cpp:118-125) covers it. No motion is lost by dropping these reports, because MouseInput::scaled keeps the fractional remainder in remainderX/remainderY.
  • mergeMotion (mouse_impl.cpp:36-44) only touches the newest unread entry, under mouseMutex, the same lock Read takes. Read advances head and decrements count, so the tail can never be an entry the title has already consumed. The initial entry from Open has zero motion, so motion never merges into it. Button, wheel, tilt, reset and connection entries also have zero motion or a non-zero wheel/tilt, so motion never merges across them. The ordering test (tests/Mouse.cpp:137-142) covers this.
  • The int64 clamp in saturatedSum is correct for the int32 axes. The debt entry in docs/dev/debt/libSceMouse.md discloses that per-report granularity is an AnyPS5 heuristic and not measured console behaviour, which is the right place for it.
  • Checklist: Depends on, Fixes, Unblocks (discussion #9981, High on Life PPSA15388), GPUs tested (n/a, correct for a libSceMouse change) and AI-assisted are all filled.

Not verified

  • The in-game A/B in High on Life (PPSA15388). I did not launch titles.
  • Console behaviour: how many entries a real PS5 returns per sceMouseRead with a fast mouse. As the earlier reviews note, nobody has measured this.
  • Windows and macOS. I ran Linux only; two Windows runs are posted in the comments.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696240590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9982#pullrequestreview-5696240590). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T10:29:59Z. **Review:** APPROVED --- # Reviewed — approved The coalescing of consecutive motion-only reports is correct, it merges cleanly into current `main`, the input-family tests pass, and the new `mouse_input` cases fail without the production change. ## What I ran - PR head: `3bfc1c11d0af53b202032aa2929be6c59b0a4cf5` - `main`: `f48ef6a076b68c07c6c22bad6f609080a36e10ed` - Host: Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, Release, Ninja, `BUILD_TESTING=ON`, in a clean worktree. ```sh git fetch -q origin main pull/9982/head:refs/review/9982 git checkout -q --detach origin/main git merge -q --no-ff --no-edit refs/review/9982 git diff --check origin/main...refs/review/9982 python3 tools/check_conventions.py --base origin/main python3 tools/check_test_registration.py cmake --build build -j10 --target mouse_tests libs cmake --build build -j10 ctest --test-dir build -j4 -R 'mouse|keyboard|pad_' --output-on-failure # negative control git checkout origin/main -- core/libs/prx/libSceMouse/src/mouse_impl.cpp cmake --build build -j10 --target mouse_tests ctest --test-dir build -R '^mouse_input$' --output-on-failure git checkout HEAD -- core/libs/prx/libSceMouse/src/mouse_impl.cpp cmake --build build -j10 --target mouse_tests ctest --test-dir build -R '^mouse_input$' ``` ## Results | Check | Result | |---|---| | Merge into `main` `f48ef6a07` | Clean (auto-merge of `tests/Mouse.cpp`) | | `git diff --check` | Clean | | `tools/check_conventions.py --base origin/main` | All conventions checks passed | | `tools/check_test_registration.py` | No unregistered tests | | Build (`libs` and full tree) | OK | | `mouse_input`, `video_out_mouse`, `pad_keyboard_mouse` and the other 15 tests matching `mouse\|keyboard\|pad_` | 18/18 passed, longest 0.38 s | | Negative control (`mouse_impl.cpp` from `main`) | `mouse_input` aborts | <details><summary>ctest, merged tree</summary> ``` 1/18 Test #2315: video_out_mouse Passed 0.09 sec 2/18 Test #91: pad_input Passed 0.11 sec 3/18 Test #2338: pad_sdl Passed 0.03 sec 4/18 Test #850: agc_keyboard_overlay Passed 0.00 sec 5/18 Test #2341: pad_keyboard_mouse Passed 0.01 sec 6/18 Test #2339: pad_input_mapping Passed 0.00 sec 7/18 Test #1988: guest_ime_pad_route Passed 0.00 sec 8/18 Test #2203: guest_pad_vibration_mode Passed 0.00 sec 9/18 Test #1989: guest_ime_keyboard Passed 0.00 sec 10/18 Test #1849: audio_out_vibration_pad_control Passed 0.00 sec 11/18 Test #2095: mouse_input Passed 0.00 sec 12/18 Test #2340: pad_output_pacing Passed 0.00 sec 13/18 Test #2041: keyboard_input Passed 0.00 sec 14/18 Test #1992: ime_dialog_pad_keyboard Passed 0.00 sec 15/18 Test #1855: audio_out2_pad_mix Passed 0.00 sec 16/18 Test #4: pad_command_file Passed 0.00 sec 17/18 Test #1856: audio_out_mix_level_pad_spk Passed 0.29 sec 18/18 Test #92: pad_timeline Passed 0.38 sec 100% tests passed out of 18 ``` </details> <details><summary>ctest, negative control</summary> ``` 0% tests passed, 1 tests failed out of 1 The following tests FAILED: 2095 - mouse_input (Subprocess aborted) ``` </details> ## Negative control I restored only `core/libs/prx/libSceMouse/src/mouse_impl.cpp` from `main`, kept the new `tests/Mouse.cpp`, rebuilt `mouse_tests` and ran `mouse_input`: it aborts. With the PR's file restored it passes again. This matches the author's Linux result and the Windows results posted in the comments. ## Findings ### Blocking None. ### Non-blocking None. Notes from reading the code, for the record: - The zero-delta gap raised in the earlier reviews of `014d9de4b` is closed. A report with no motion and no button, wheel, tilt, reset or connection change returns before it reaches the queue ([mouse_impl.cpp:122](https://github.com/boykopovar/AnyPS5/blob/3bfc1c11d0af53b202032aa2929be6c59b0a4cf5/core/libs/prx/libSceMouse/src/mouse_impl.cpp#L122-L122)). The test that alternates x = 0 and 1 ([tests/Mouse.cpp:118-125](https://github.com/boykopovar/AnyPS5/blob/3bfc1c11d0af53b202032aa2929be6c59b0a4cf5/core/libs/prx/libSceMouse/tests/Mouse.cpp#L118-L125)) covers it. No motion is lost by dropping these reports, because `MouseInput::scaled` keeps the fractional remainder in `remainderX`/`remainderY`. - `mergeMotion` ([mouse_impl.cpp:36-44](https://github.com/boykopovar/AnyPS5/blob/3bfc1c11d0af53b202032aa2929be6c59b0a4cf5/core/libs/prx/libSceMouse/src/mouse_impl.cpp#L36-L44)) only touches the newest unread entry, under `mouseMutex`, the same lock `Read` takes. `Read` advances `head` and decrements `count`, so the tail can never be an entry the title has already consumed. The initial entry from `Open` has zero motion, so motion never merges into it. Button, wheel, tilt, reset and connection entries also have zero motion or a non-zero wheel/tilt, so motion never merges across them. The ordering test ([tests/Mouse.cpp:137-142](https://github.com/boykopovar/AnyPS5/blob/3bfc1c11d0af53b202032aa2929be6c59b0a4cf5/core/libs/prx/libSceMouse/tests/Mouse.cpp#L137-L142)) covers this. - The `int64` clamp in `saturatedSum` is correct for the `int32` axes. The debt entry in `docs/dev/debt/libSceMouse.md` discloses that per-report granularity is an AnyPS5 heuristic and not measured console behaviour, which is the right place for it. - Checklist: Depends on, Fixes, Unblocks ([discussion #9981](https://github.com/boykopovar/AnyPS5/discussions/9981), High on Life PPSA15388), GPUs tested (n/a, correct for a libSceMouse change) and AI-assisted are all filled. ## Not verified - The in-game A/B in High on Life (PPSA15388). I did not launch titles. - Console behaviour: how many entries a real PS5 returns per `sceMouseRead` with a fast mouse. As the earlier reviews note, nobody has measured this. - Windows and macOS. I ran Linux only; two Windows runs are posted in the comments.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
boykopovar/AnyPS5!9982
No description provided.