Files
AnyPS5/docs/dev/debt/libSceMouse.md
T
akkadbakkad89 71780c4eaf feat(libs): implement debug device-id getters for mouse and keyboard
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-06 11:06:03 +05:30

5.6 KiB

libSceMouse technical debt

Unknown function info

Functional

  • sceMouseGetHandle, sceMouseExtensionSetConfig and sceMouseExtensionScalePosition (libSceMouse) - follow the same 13.42 disassembly, not a console; none reaches the driver.

    • GetHandle(userId, type, index) returns the handle sceMouseOpen gave that user and type, or 0x80df0008. The console skips slots whose +0xc8 field is 1 when index is non-zero; that field's meaning is unknown, and no slot here has it.
    • ExtensionSetConfig(handle, config) refuses a null or a non-zero byte in 5..0x1f, then stores the u32 at 0 and the byte at 4; nothing here reads them yet.
    • ExtensionScalePosition(uint16* position, uint16 scale) rounds *position * (scale - 1) / 65535 up. The console divides with a multiply by 0x80008001 and a shift by 47, which is the floor, and adds 1 when the remainder isn't 0, through a compare of -(product * 65537) with 0x10002 (@BunnyFl's emulation).
  • Publish (libSceMouse) - consecutive motion-only reports with the same buttons are summed into the newest unread entry, so a title that reads a few entries per frame gets current motion instead of a full queue of old reports. Reports with no motion and no button, wheel, tilt or connection change are dropped. Per-report granularity and the console's own report rate are not reproduced

  • sceMouseResetAbsolutePosition, sceMouseSetAbsoluteVirtualScreenSize, sceMouseSetAbsoluteHighPrecisionMode, sceMouseReadAbsolutePosition (libSceMouse) - follow firmware 13.42 run natively with the driver stubbed: checks and order, screen sizes and rescale, the mode byte, the curve with its fraction, the 40-byte record. Host choices, after XatiX's title-tested version: each host event is one sample with unscaled counts, in its own queue, so sceMouseRead's motion merging does not feed the curve. A read takes all pending samples; past num, same-button neighbours share a record, each still moving the pointer, and the last num records are kept. Speed is taken as 4, the hand swap and flagged bit never apply, and a disconnected mouse stands in for a zero driver status

  • sceMouseDebugGetDeviceId - validation order and the empty/live-slot split follow the retail 11.00 dump decode: not-initialized first, then null output, -1 written up front, a match on a port handle with an empty slot returns success leaving -1, a live slot writes the device id, and no match returns INVALID_HANDLE. A closed handle returns INVALID_HANDLE like the other mouse functions; whether the console treats the port handle as valid after sceMouseClose is not covered by the decode. The reported device id is a model constant for the single emulated device; the console's device-id assignment is not decoded.