fix(libScePad): open the system remote control port as a disconnected device #9178
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9178"
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 norton62 on 2026-10-21T14:24:09Z.
What
scePadOpenfor the system user's remote control port (type 16) returned the DualSense handle, soscePadReadStateon the "remote" reported the controller's buttons withconnectedset. SDL's PS5 video driver (SDL_ps5remote.c) opens that port and maps its buttons to keys, so every Cross also arrived as Return, Circle as Escape and the D-pad as arrow keys.In Raptor: Call of the Shadows (PPSA94002), the on-screen keyboard injects the selected key and the remote's Return overwrites it in
lastscanbefore the name field reads it, so no character can be typed (gdb watchpoint onlastscan:2from the keyboard, then28from SDL's event queue). Circle closed the registration dialog instead of the keyboard for the same reason.The remote control port now opens a handle of its own (
PAD_REMOTE_HANDLE,0x10, outside the special port range) that reads one zeroed entry with no buttons andconnectedfalse, andscePadClose/scePadGetHandletrack it independently of the DualSense handle. Unlike the special port handles it stays out ofKnownHandle, so the calls that act on the DualSense (light bar, vibration and the rest) reject it withINVALID_HANDLE. The unmeasured console behaviour is recorded indocs/dev/debt/libScePad.md.Overlap: #7881 (up to 4 controllers) changes the same lines, and its
PortForUsermaps the system remote port to controller slot 0, which would restore this bug. Agreed with its author (https://github.com/boykopovar/AnyPS5/pull/9178#issuecomment-6341429190): whichever of the two lands second keeps the remote port out of the per-port slots, on its own disconnected handle outsidePAD_HANDLE_BASE + port. This PR is rebased on currentmaininstead of waiting for #7881, as the reviews asked.#10361 records a PS5 payload measurement where
scePadOpenrejects type 16 withINVALID_ARGbefore looking at the user; it is not stated whether that covers the system user (0xff). If it does, the remote port should fail to open rather than open a disconnected handle. SDL's remote code treats a failed open the same way (it stops reading the port), so either result fixes the title; whichever lands second can switch the remote open to that measured error.Tested
main4221f82dc. Windows 11, WinLibs GCC 15.2.0 r7, Release:guest_padandguest_pad_vibration_modepass.guest_padaborts withExport.cppandPad.hppreverted tomain(newCheckSystemRemote, which also checks that the remote handle cannot set the DualSense light bar).--windows, RTX 5070 Ti: on the pilot registration screen the on-screen keyboard now types into NAME (1SDtyped with injected pad input on the rebased build, relinked with its relinker and run against its libraries; before: nothing typed; the same failure was reproduced by hand with a physical DualSense before the fix), and the overlay keeps redrawing. On the earlier base (27bcd6a29with this fix) the first mission was played through by hand with a DualSense at 60 FPS (#9687).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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T16:44:17Z.
Linux data point for
fb628dcbb5: WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal Linux), GCC 13.3.0, Release,BUILD_TESTING=ON, PR head alone (not merged ontomain; its merge-base is27bcd6a29).ctest -R '^guest_pad$'passes 3 of 3.libScePad/Export.cpp and libScePad/include/Pad.hpprestored to the merge-base (the PR's tests kept): fails (Subprocess aborted).Not tested: macOS, Windows, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:16:33Z.
Review: DISMISSED
Thanks for providing the SDL/game reproduction and the isolated Windows and WSL test results. I reviewed head
fb628dcbb50572f3a3e41a31f812359e495f43d5; the focusedguest_pad_teststarget builds locally. Its CTest process aborts before assertions at this host's mandatory CPU-feature check (Xeon E5-1620 v2 lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA), so I could not run the test assertions here. The reported Windows and WSL runs remain useful, but they are against the old branch base.Please address these repository requirements before approval:
The checklist says this is based on current
main, but the head's merge base is27bcd6a29eand currentmainis 633 commits ahead. The current merge preview conflicts indocs/dev/debt/libScePad.md, and the PR already has theneeds rebaselabel. Please rebase/update onto currentmain, correct the checklist, and rerun the focused pad tests on the updated head. Current hosted checks are conventions/intake/labels; no product build or test job ran.The title checklist says
Unblocks: PPSA94002but also says there is no Game bring-up discussion yet. CONTRIBUTING.md requires the Game bring-up discussion to list the open PRs and local changes the title still needs. Please provide the appropriate discussion link and keep it updated with this PR and any remaining title work.Please coordinate the integration with open #7881. Its current
PortForUsermaps the system remote port to controller slot 0, and itsscePadOpenreturnsPAD_HANDLE_BASE + port; this PR instead gives that port a separate disconnected handle. If #7881 lands unchanged after this, it restores the bug this PR fixes. That is a behavioral interaction, not just a textual rebase. The two changes are distinct, but please confirm with the #7881 author how the multi-controller change will preserve the remote-port behavior and update the overlap notes accordingly. I checked #9664's adjacent tracker-query changes as well; they do not duplicate this implementation.git diff --checkpassed andtools/check_conventions.py --base upstream/main --head refs/review/9178passed.guest_pad_testscompiled successfully; its local runtime was blocked by the host CPU guard described above.Imported from boykopovar/AnyPS5. Originally posted by slugzero on 2026-10-22T13:03:08Z.
Author of #7881 here - thanks @norton62 for making me aware of this dependency. Fully on board with the proposed coordination as stated in the description: once #7881 merges, rebase #9178 onto it and keep the system remote
control port on its own disconnected handle.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T20:20:44Z.
Review: CHANGES_REQUESTED
Thanks for the fix and the SDL/title analysis; the diff matches the description and
CheckSystemRemotepins the new behaviour (own handle, no buttons,connectedfalse, independent close andscePadGetHandle).libScePad/Export.cpp,include/Pad.hpp,tests/GuestPad.cppanddocs/dev/debt/libScePad.mdall conflict with currentmain(Export.cpp was reworked there), so the checklist line "Based on currentmain" no longer holds. Please rebase, adapt the remote-port handling to the current file, and rerunguest_padon the updated head.PAD_HANDLE_BASE + port; keep that in the rebase and keep the overlap note in the body up to date.Unblocks); please add it.Happy to look again on the rebased head.