Repository navigation
feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas - #4217
Conversation
9cf712e to
289d2ec
Compare
|
Request for a Windows check: this PR is only tested on Linux (SDL on XWayland, 125 % desktop scaling), and Windows DPI scaling is where the delta scaling can go wrong. SDL reports the window size in logical units there, while relative motion may arrive in physical pixels depending on the DPI-awareness SDL ends up with, so the scale factor the PR computes could be off by the display scale. What to test, with a title that opens the mouse (Minecraft PPSA17221 does, drawing its own cursor from
The log prints one line at startup that shows what the PR computed, for example: On Windows the driver should read |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the PR. Blocking points:
- The existing
mouse_inputtest (core/libs/prx/libSceMouse/CMakeLists.txt:12) compileslibSceVideoOut/src/MouseInput.cppintomouse_testsdirectly.UpdateCapturenow callsSDL_SetRelativeMouseMode,SDL_GetRelativeMouseMode,SDL_GetRelativeMouseStateandSDL_GetError, and that target doesn't link SDL, so it fails with undefined references on the PR head. Link SDL there (or split the capture code out of the file that test compiles) and run the existinglibSceMousetests as well as the new one. - The PR conflicts with
maininVideoOutDriver.cppanddocs/dev/TechnicalDebt.md; please rebase. - Windows: the scale uses the
SDL_GetWindowSizeratio (logical units), while relative-mode motion can be reported in physical pixels under DPI scaling. This is unverified and the body says it isn't tested on Windows. Please attach the[mouse]log line and the cursor-travel check at 125 %/150 % from a Windows run, or a test that pins the scale for a window whose size and drawable size differ, or make the scale independent of that assumption. - The new test covers only the delta arithmetic;
UpdateCapture(mouse open + focus + toggle) has no test.
289d2ec to
13a3239
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the rebase and the SDL link fix; mouse_input and video_out_mouse pass on the merged head, and video_out_mouse fails to build without the change. Two points from the previous review are still open:
- Windows:
SetPresentationis fedSDL_GetWindowSize(logical units) while the relative-modexrel/yrelunits under DPI scaling are unverified, and nobody has run it on Windows. Either attach the[mouse]log line and the cursor-travel check at 125 %/150 % from a Windows run, or add a test that pins the scale when window size and drawable size differ. MouseInput::UpdateCapture(mouse open + focus +MouseModeEnabled()) has no test; the new test only covers the delta arithmetic. A test for the capture decision (e.g.SDL_GetRelativeMouseMode()with the dummy/offscreen video driver) would cover it.
…e their deltas The console's mouse reports relative motion, so the host cursor can never line up with the cursor a title draws. While a title has a mouse open and the window is focused the host cursor is hidden and captured, released on focus loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled from the presented image's size in window units to the title's display resolution with sub-pixel carry, so the title's cursor travels as far as the host pointer would, on scaled desktops and letterboxed windows alike. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
13a3239 to
94087d0
Compare
|
Both open points addressed in 94087d0:
|
adriadam10
left a comment
There was a problem hiding this comment.
Checked on the PR merged onto current main: build and the libSceMouse/libSceVideoOut ctest scope pass (mouse_input, video_out_mouse), and video_out_mouse fails to build without the change. The Windows DPI behaviour of the delta scale stays unverified and is recorded in the technical debt entry; merging.
|
A follow-up from High on Life (PPSA15388), on Linux, after this PR: while the title reads the mouse, Locally I added two guards in // PadInput::Update: no right-stick deltas while the title reads the mouse
if ((deltaX != 0 || deltaY != 0) && !MouseIsOpen_nid_postfix()) { ... }
// PadInput::HandleEvent: mouse buttons bound to pad buttons are skipped while the title reads the mouse
if (mouse && binding.control == Pad::InputControl::Button && MouseIsOpen_nid_postfix()) {
pressed[index] = false;
continue;
}With them, the mouse behaves like the PC version, and the Tested and written by Claude (AI assistant) on a contributor's machine. |
What
The console's mouse reports relative motion only, so a host cursor can never coincide with the cursor a title draws, and on a scaled desktop or a letterboxed window the title's cursor moved a different distance than the pointer. Minecraft (PPSA17221) draws its own cursor from
sceMouseReaddeltas: the host pointer drifted away from it and left the window.MouseInputscalesxrel/yrelfrom the presented image's size in window units to the title's display resolution, with sub-pixel carry so slow motion is not lost (SetPresentation); the presentation loop inVideoOutDriverfeeds it the window size and the letterboxed size it already computes.UpdateCaptureputs SDL in relative mouse mode while the window is focused, a title has a mouse open (sceMouseOpen, exported asMouseIsOpen_nid_postfixfrom libSceMouse) and the pad's mouse-to-stick toggle is off, and releases it otherwise;PadInput::MouseModeEnabled()exposes the toggle.video_out_mouse_tests(video_out_mouse): deltas sum unchanged at 1:1, double at half size, and an empty presentation is ignored.docs/user/INPUT_MAPPING.mddescribes the capture; TechnicalDebt records that the console's deltas are counts, so a title applying its own sensitivity still moves faster than the host pointer would.Tested
Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, Intel Arc Meteor Lake, Mesa 26.2.3), worktree onmain2cf23fc (rebased 2026-10-13: the entry moved to docs/dev/debt/libSceVideoOut.md;video_out_mouseandmouse_inputpass; the latter now links SDL, which the shared mouse source needs for the capture calls;video_out_mousealso covers the capture decision (CaptureWanted: focus lost and regained, another window's focus, mouse closed and reopened, window closed, the pad's mouse-to-stick toggle) and applies the capture under SDL's dummy video driver, whereSDL_GetRelativeMouseModefollows it and is released again):video_out_mousepasses;tools/check_conventions.py --base origin/mainandgit diff --checkpass. Minecraft (PPSA17221) on a 125 % scaled Wayland desktop (SDL on XWayland): the host cursor is hidden while the game has the mouse and returns when another window takes focus, and the in-game cursor now travels as far as the hand does; before, it fell short and the host pointer left the window (Linux). Not tested on Windows.The delta scale takes SDL's relative motion in logical window units, the units of
SDL_GetWindowSize; under Windows DPI scaling SDL may report physical pixels, which no Windows run has checked yet; the debt entry says so.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code