libSceVideoOut: while a title reads the mouse, the default mouse bindings still press Square and R2, so High on Life (PPSA15388) re-centres its cursor and menu clicks are lost; fix branch ready #6564

Closed
opened 2026-10-15 20:50:51 +00:00 by Tamalero · 0 comments
Tamalero commented 2026-10-15 20:50:51 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-15T20:50:51Z.


High on Life reads the mouse itself (sceMouseOpen) and draws its own cursor in the menus. On main, left-clicking a menu item doesn't select it: the cursor snaps back to the centre of the screen and the click is lost. That happens on every click, with the default input mapping and nothing toggled.

The cause is the default bindings in INPUT_MAPPING.md: Square = MOUSE:Left and R2 = MOUSE:Right. PadInput::HandleEvent passes every mouse-button press to KeyboardMouse, whether or not the title has the mouse open. So one click reaches the game twice, as a mouse click through libSceMouse and as a Square press on the pad. The game takes the pad press as a switch to gamepad input, re-centres its cursor, and drops the click.

Mouse motion has the same overlap once mouse mode is on (the middle button, ToggleMouse): motion then tilts the right stick while the title also reads it as mouse movement. #6147 covers the capture side of mouse mode.

Title: High on Life (PPSA15388)
Where: the main menu and settings, on main ce991f1ec. #6205's PlayGo setting is needed to start the title until #6236/#6263 land. Linux, RTX 4090, keyboard and mouse, no controller.

Build Left click on a menu item Cursor
main ce991f1ec doesn't select snaps back to the centre
main ce991f1ec + the fix below selects stays where it is

Fix

Branch: https://github.com/Tamalero/AnyPS5/tree/fix/mouse-off-pad-while-title-reads-mouse (one commit on ce991f1ec).

While libSceMouse has a handle open (MouseIsOpen_nid_no_patch, the same check MouseInput uses for capture), KeyboardMouse ignores mouse motion and mouse-button presses. Releases still pass, so a button held before the title opened the mouse is let go. Keys and the wheel are unchanged. PadInput sets the flag next to the existing IME guard (ImeCapturesKeyboard_nid_postfix), which does the same for keys while the IME has the keyboard.

     if (event.type == SDL_KEYDOWN && ImeCapturesKeyboard_nid_postfix()) return;
+    keyboardMouse.SetTitleReadsMouse(MouseIsOpen_nid_no_patch());
     const auto requests = keyboardMouse.HandleEvent(event, std::chrono::steady_clock::now());
...
-        if (mouseMode) mouse.Move(event.motion.xrel, event.motion.yrel);
+        if (mouseMode && !titleReadsMouse) mouse.Move(event.motion.xrel, event.motion.yrel);
...
     if (keyboard && event.key.repeat != 0) return requests;
+    if (event.type == SDL_MOUSEBUTTONDOWN && titleReadsMouse) return requests;

A side effect: while the title reads the mouse, the middle button no longer toggles mouse mode, so it doesn't release the captured cursor either. Leaving the window still releases it (focus loss). Titles that don't open the mouse behave exactly as before: the bindings, mouse mode and the middle-button toggle all still work there.

Tests

pad_keyboard_mouse gains a "title reads the mouse" case:

  • a left click presses Square while the title doesn't read the mouse, and its release still clears Square after the title opens the mouse;
  • left and right clicks press nothing while the title reads the mouse, and the middle click asks for no toggle;
  • keys still tilt the stick;
  • motion in mouse mode leaves the right stick centred, and tilts it again once the title stops reading the mouse.

With the two behaviour lines in KeyboardMouse.cpp reverted and the test kept, pad_keyboard_mouse fails (negative check). pad_keyboard_mouse and video_out_mouse pass. tools/check_conventions.py --base origin/main passes.

Details
  • Linux (CachyOS), GCC, Release, RTX 4090, i9-14900K. The title was relinked with --to-intel by the relinker at ce991f1ec. Same executable for every run.
  • Three runs on the same day, menus only:
    1. main + the PlayGo setting: clicks lost and cursor re-centred. With the middle button, the capture was released but the motion was still tracked.
    2. The same plus a hand-ported version of the guard in PadInput: clicks work.
    3. The same plus this branch: clicks work, and the middle button does nothing while the menu reads the mouse.
  • Not tested: Windows, macOS, a controller plugged in alongside the mouse, and titles that open the mouse only for part of the game.
  • Related: #6147 (mouse mode and capture), #4704 (mouse-to-stick tilt), #4217 (guest mouse capture), #5936 (MouseIsOpen kept out of NID exports).
  • I have fewer than 10 merged PRs, so this is an issue with the branch rather than a PR.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5873722783 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6564). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-15T20:50:51Z. --- High on Life reads the mouse itself (`sceMouseOpen`) and draws its own cursor in the menus. On `main`, left-clicking a menu item doesn't select it: the cursor snaps back to the centre of the screen and the click is lost. That happens on every click, with the default input mapping and nothing toggled. The cause is the default bindings in `INPUT_MAPPING.md`: `Square = MOUSE:Left` and `R2 = MOUSE:Right`. `PadInput::HandleEvent` passes every mouse-button press to `KeyboardMouse`, whether or not the title has the mouse open. So one click reaches the game twice, as a mouse click through libSceMouse and as a Square press on the pad. The game takes the pad press as a switch to gamepad input, re-centres its cursor, and drops the click. Mouse motion has the same overlap once mouse mode is on (the middle button, `ToggleMouse`): motion then tilts the right stick while the title also reads it as mouse movement. #6147 covers the capture side of mouse mode. **Title:** High on Life (PPSA15388) **Where:** the main menu and settings, on `main` `ce991f1ec`. #6205's PlayGo setting is needed to start the title until #6236/#6263 land. Linux, RTX 4090, keyboard and mouse, no controller. | Build | Left click on a menu item | Cursor | |---|---|---| | `main` `ce991f1ec` | doesn't select | snaps back to the centre | | `main` `ce991f1ec` + the fix below | selects | stays where it is | ### Fix Branch: https://github.com/Tamalero/AnyPS5/tree/fix/mouse-off-pad-while-title-reads-mouse (one commit on `ce991f1ec`). While libSceMouse has a handle open (`MouseIsOpen_nid_no_patch`, the same check `MouseInput` uses for capture), `KeyboardMouse` ignores mouse motion and mouse-button presses. Releases still pass, so a button held before the title opened the mouse is let go. Keys and the wheel are unchanged. `PadInput` sets the flag next to the existing IME guard (`ImeCapturesKeyboard_nid_postfix`), which does the same for keys while the IME has the keyboard. ```diff if (event.type == SDL_KEYDOWN && ImeCapturesKeyboard_nid_postfix()) return; + keyboardMouse.SetTitleReadsMouse(MouseIsOpen_nid_no_patch()); const auto requests = keyboardMouse.HandleEvent(event, std::chrono::steady_clock::now()); ... - if (mouseMode) mouse.Move(event.motion.xrel, event.motion.yrel); + if (mouseMode && !titleReadsMouse) mouse.Move(event.motion.xrel, event.motion.yrel); ... if (keyboard && event.key.repeat != 0) return requests; + if (event.type == SDL_MOUSEBUTTONDOWN && titleReadsMouse) return requests; ``` A side effect: while the title reads the mouse, the middle button no longer toggles mouse mode, so it doesn't release the captured cursor either. Leaving the window still releases it (focus loss). Titles that don't open the mouse behave exactly as before: the bindings, mouse mode and the middle-button toggle all still work there. ### Tests `pad_keyboard_mouse` gains a "title reads the mouse" case: - a left click presses Square while the title doesn't read the mouse, and its release still clears Square after the title opens the mouse; - left and right clicks press nothing while the title reads the mouse, and the middle click asks for no toggle; - keys still tilt the stick; - motion in mouse mode leaves the right stick centred, and tilts it again once the title stops reading the mouse. With the two behaviour lines in `KeyboardMouse.cpp` reverted and the test kept, `pad_keyboard_mouse` fails (negative check). `pad_keyboard_mouse` and `video_out_mouse` pass. `tools/check_conventions.py --base origin/main` passes. <details><summary>Details</summary> - Linux (CachyOS), GCC, Release, RTX 4090, i9-14900K. The title was relinked with `--to-intel` by the relinker at `ce991f1ec`. Same executable for every run. - Three runs on the same day, menus only: 1. `main` + the PlayGo setting: clicks lost and cursor re-centred. With the middle button, the capture was released but the motion was still tracked. 2. The same plus a hand-ported version of the guard in `PadInput`: clicks work. 3. The same plus this branch: clicks work, and the middle button does nothing while the menu reads the mouse. - Not tested: Windows, macOS, a controller plugged in alongside the mouse, and titles that open the mouse only for part of the game. - Related: #6147 (mouse mode and capture), #4704 (mouse-to-stick tilt), #4217 (guest mouse capture), #5936 (`MouseIsOpen` kept out of NID exports). - I have fewer than 10 merged PRs, so this is an issue with the branch rather than a PR. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
Sign in to join this conversation.
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#6564
No description provided.