fix(libScePad): answer scePadOpen's user, index and port checks as measured on a PS5 #10361
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10361"
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 orezraey on 2026-10-23T19:17:30Z.
What
scePadOpen's argument checks measured on a retail PS5 (firmware 13.60) throughlibScePad.sprxfrom a payload process. The sources and console logs are in this gist (ppad,ppad2). A payload process cannot open a port even for its logged-in user (it gets 0x809b0081, unknown user), so only the checks the console makes before that were reached.The console:
INVALID_ARG(0x80920001) whatever the user, so the type is checked first;ppad, where the payload had no initial user), and index 1 of the standard port with 0x809b0003 for a logged-in user (ppad2).AnyPS5 answered index 1 with
INVALID_ARG, gave user -1 a handle, and failed types 3 and 4 withINVALID_ARG. It now answers user -1 and a non-zero index with the measured codes. Types 3 and 4 throw after the type and user checks, since the console accepts them and what they open is unknown; a title that probes them will stop here instead of getting a made-up error, which the new debt entry records.Tested
Windows 11, MinGW (winlibs).
guest_padchecks user -1 on types 0, 2, 3 and 4 and on index 1, index 1 of a logged-in user and the invalid types. The pad tests pass three runs in a row.199fd82e3d(main merged after its 4-controller pad change, which limits the standard port to logged-in users):scePadOpenchecks the port type alone first, then user -1 and the index, and leaves the standard port's user lookup toPortForUser;libScePad.mdkeeps main's deadband, legacy haptics and controller information entries with this PR'sscePadOpenentries.guest_padandguest_pad_vibration_modepass three runs in a row on Windows 11 (WinLibs GCC 15.2) and on Linux (WSL2, GCC 16.2); a plain merge without the type-only check failsguest_pad.7844bbb5e1(main merged after #9178):guest_padandguest_pad_vibration_modepass three runs in a row on Windows 11 (WinLibs GCC 15.2) and on Linux (WSL2 6.18, GCC 16.2).guest_padalso checks that type 16 fails withINVALID_ARGfor a user other than the system user, as measured.tools/check_conventions.pypasses.tools/pr_overlap.py: #7881, #10119 touch nearby lines; whichever lands second keeps both.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:18:27Z.
Review: CHANGES_REQUESTED
The measured ordering for types 3 and 4 is not preserved for an invalid user. The report says these types pass the port-type check, then the payload process receives
0x809b0081because it cannot open a port for its logged-in user; it separately reports that user-1returns0x809b0001on a valid port type. In the implementation,type == 3 || type == 4throws beforeuserIdis checked, soscePadOpen(-1, 3, 0, nullptr)andscePadOpen(-1, 4, 0, nullptr)throw instead of returning the measured invalid-user result. Please preserve the known argument validation before throwing for the unsupported open behavior, and add regression assertions for those combinations. The existing test currently covers invalid user only with type 0.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:55:24Z.
Review: APPROVED
Reviewed current head
ddcc81887f. The follow-up preserves the measured ordering: unsupported port types 3/4 reach the invalid-user result for user -1 before the unimplemented path throws, while invalid types and the measured standard-port index case retain their results. GuestPad now covers the previously missing type 3/4 invalid-user cases and relevant invalid-type/index combinations; the debt entry records that type 3/4 index-1 behavior remains unknown. The author reports three passing Windows guest_pad runs. Hosted eligibility, conventions, labels and report checks pass; product jobs are skipped by policy. I did not run guest_pad locally: syntax compilation is blocked by the absent SDL2 submodule headerSDL_scancode.h.