feat(libSceMouse): implement the absolute position calls as firmware 13.42 does #12958
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12958"
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 zaryabzip on 2026-10-29T17:30:16Z.
What
Implements the three libSceMouse absolute-position calls that stop Mewgenics (PPSA37318) at mouse init, plus a storing
sceMouseResetAbsolutePosition. The library side follows firmware 13.42'slibSceMouse.sprx, which @BunnyFl read and ran natively with the driver stubbed (#11477 comment). The host-side design follows @XatiX's version tested with the title, which gets past mouse init to the first battle. The title's arguments are from XatiX's call sites.From the firmware run:
sceMouseSetAbsoluteVirtualScreenSize(handle, size): picks 1280×720, 1920×1080 (the size after open), 2560×1440 or 3840×2160. Anything above 3, compared unsigned, isINVALID_ARG, checked before the handle. Changing the size rescales the stored position with truncation, so (1000, 500) becomes (2000, 1000), then (666, 333).sceMouseSetAbsoluteHighPrecisionMode(handle, mode): stores the low byte ofmode.sceMouseReadAbsolutePosition(handle, buf, num):INVALID_ARGfor a null buffer ornumoutside 1–64, checked before the handle.u16x/y at +0x10/+0x12, wheel and tilt. Bytes +0x09–0x0B and +0x1C–0x27 are left alone, as the module does.sceMouseResetAbsolutePosition: checks against the current size and stores the position, which starts at (0, 0) after open.Host choices (the driver wasn't measured; listed in the debt entry):
MouseInputnow passesxrel/yrelalongside the window-scaled deltas thatsceMouseReadkeeps.sceMouseReadreports. So the curve and the clamp see every sample, and neither kind of read takes the other's samples.num, neighbours with the same buttons share a record, and each still moves the pointer. Only the lastnumrecords are kept, as the module keeps the lastnumdriver samples.Tests:
tests/MouseAbsolute.cpplooks the calls up at runtime, because the base declares them without parameters. It covers the checks, sizes, mode byte, curve, records and merging (BunnyFl's 101/103/107).tests/Mouse.cppdrivesMouseInputat a 2× presentation scale.sceMouseReadgets the scaled delta, while the absolute pointer moves by the raw count.Stacked on #9982 (Tamalero, approved): both change
mouse_impl.cpp's includes andPublish, and the debt file's Functional section. The branch is #9982's head merged withmain, plus one commit.Tested
Windows 11 Home 10.0.26200 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) at
26d7585cfb, and Ubuntu 24.04.5 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1) with it merged intomainbb04a4f1ea. With the title: @XatiX ran Mewgenics (PPSA37318 01.121.220) at this head on Windows 11 with a physical mouse. The game gets past mouse init with no libSceMouse errors, the cursor follows at the right speed, and hovers and clicks work through the menus to the first battle. Entering the battle then stops on the AGC refusal #7048 addresses, which happens onmaintoo.tests/Mouse.cpp's function-pointer cast is also clean under-Wextra -Wcast-function-type.ctest -R "^mouse_":mouse_absolute_positionandmouse_input(with #9982's cases) pass on both hosts, and each passes 3 of 3 on--repeat until-fail:3.video_out_mousepasses too.MouseInput.cpp/PadInput.cppand its mouse test. Each changed header also builds on its own.dbd29271bf(#9982 merged withmain) with only the two test files and theCMakeLists.txtblock, both tests build.mouse_absolute_positionthen aborts withsceMouseSetAbsoluteVirtualScreenSize not implemented.mouse_inputpasses all of #9982's checks and aborts at its first absolute read withsceMouseReadAbsolutePosition not implemented. Both happen on both hosts (Windows exit 0xc0000409, Linux SIGABRT).tools/check_conventions.pypasses. Overlap: #9982 (stacked on, see above). #12379 changes the mouse test's link line andMouseInput.cpp's motion condition, and merges cleanly with this branch.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)