feat(pad): support up to 4 controllers with dynamic user discovery #7881

Merged
slugzero merged 8 commits from upstream-pr/7881 into main 2026-10-24 17:48:54 +00:00
slugzero commented 2026-10-19 12:12:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slugzero on 2026-10-19T12:12:58Z.


What

Before this change, libScePad and libSceVideoOut supported only a single controller handle (handle 1 / port 0). Connecting additional controllers had no effect, and libSceUserService only knew a single initial user ("Player", 0x10000000).

This implements support for up to 4 simultaneous game controllers (PAD_MAX_CONTROLLERS = 4) and dynamic multi-user discovery:

  • libScePad:

    • Replaced the global single pad state with a fixed-size slot array (PadSlot slots[PAD_MAX_CONTROLLERS]) tracking independent input states, queue histories, sensor fusion orientations (quaternion, tilt correction, angular velocity deadband), touch contact IDs, haptic queues, and connection flags per port.
    • Exported port-indexed helpers: PadPublishInputForPort_nid_postfix, PadFetchOutputForPort_nid_postfix, PadSubmitAudioHapticsForPort_nid_postfix, and PadSetPortConnected_nid_postfix. The parameterless legacy exports continue to map to port 0.
    • Updated scePadOpen and scePadGetHandle to allocate handles PAD_HANDLE_BASE + port for user IDs 0x10000000 + port (ports 0 to 3).
    • Updated scePadGetInfo to enumerate all currently connected ports and assign distinct simulated Bluetooth MAC addresses (PAD_BD_ADDRESS with port offset).
  • libSceUserService:

    • Expanded user registry to support 4 users: USER_SERVICE_USER_NAMES ("Player", "Player2", "Player3", "Player4") for user IDs 0x10000000 through 0x10000003.
    • Added UserServiceSetUserConnected_nid_postfix to toggle user connection state and enqueue SceUserServiceEvent login (EventTypeLogin = 0) and logout (EventTypeLogout = 1) events when controllers connect or disconnect at runtime. User 0 remains permanently logged in.
    • Updated sceUserServiceGetLoginUserIdList and sceUserServiceGetRegisteredUserIdList to return active user IDs and fill unused slots with USER_SERVICE_USER_ID_INVALID (-1).
    • Updated sceUserServiceGetUserName, sceUserServiceGetUserNumber (1–4), and sceUserServiceGetUserColor (0: Blue, 1: Red, 2: Green, 3: Pink).
  • libSceVideoOut (PadInput):

    • Replaced the single controller member in PadInput with std::array<ControllerSlot, PAD_MAX_CONTROLLERS> slots.
    • The first connected controller is assigned to slot 0 and composed with Pad::KeyboardMouse, preserving existing keyboard and mouse bindings, mouse-as-right-stick capture, and input configuration behavior without regressions.
    • Additional controllers occupy slots 1 to 3 sequentially. Device addition (SDL_CONTROLLERDEVICEADDED) and removal (SDL_CONTROLLERDEVICEREMOVED) notify PadSetPortConnected_nid_postfix and UserServiceSetUserConnected_nid_postfix.
    • applyOutput fetches and routes rumble, trigger effects, sensor enable flags, and default player LED colors (Blue, Red, Green, Pink) independently per controller slot.
  • Documentation:

    • Updated docs/user/INPUT_MAPPING.md to describe multi-controller input assignment and dynamic hotplugging for players 1 to 4.
    • Updated docs/dev/debt/libScePad.md to note per-port tracking for angular velocity deadbands.
    • Updated docs/dev/debt/libSceUserService.md regarding multi-user color indices and user names.

Tested

Linux x86_64 (Kernel 6.8, GCC 13.3):

  • Built all PRX libraries (ninja -C build libs) and test targets cleanly.
  • guest_pad_tests: verified multi-controller open (user = 0x10000001 -> handle 2), independent input publication on port 1 (Triangle) without altering port 0 state, per-handle vibration mode setting, multi-port enumeration in scePadGetInfo (verifying connectedCount[0] == 2 and port indices 0 and 1), and handle validation across opened and unopened slots.
  • guest_user_service_tests: verified sceUserServiceGetUserName ("Player" for initial user, "Player2" for second user, error on buffer too short or invalid ID), sceUserServiceGetUserNumber (1 and 2), sceUserServiceGetUserColor (0 and 1), and dynamic registration list updates on UserServiceSetUserConnected_nid_postfix(1, true) and disconnect.
  • guest_user_service_lifecycle_tests: verified login event queueing on initialize, dynamic EventTypeLogin event delivery upon connecting user 2, sceUserServiceGetLoginUserIdList reporting both users, EventTypeLogout delivery upon disconnecting user 2, and list updating.
  • Regression test suite: guest_pad_vibration_mode_tests, pad_sdl_tests, pad_input_mapping_tests, pad_keyboard_mouse_tests, and video_out_mouse_tests all pass without errors.
  • Full repository unit tests: python3 -m unittest discover tools/tests passes (596 tests passed, 14 skipped).
  • python3 tools/check_conventions.py --base origin/main passes with zero errors.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4920737300 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881). Originally posted by [slugzero](https://github.com/slugzero) on 2026-10-19T12:12:58Z. --- ### What Before this change, `libScePad` and `libSceVideoOut` supported only a single controller handle (handle 1 / port 0). Connecting additional controllers had no effect, and `libSceUserService` only knew a single initial user ("Player", `0x10000000`). This implements support for up to 4 simultaneous game controllers (`PAD_MAX_CONTROLLERS = 4`) and dynamic multi-user discovery: - **`libScePad`**: - Replaced the global single pad state with a fixed-size slot array (`PadSlot slots[PAD_MAX_CONTROLLERS]`) tracking independent input states, queue histories, sensor fusion orientations (quaternion, tilt correction, angular velocity deadband), touch contact IDs, haptic queues, and connection flags per port. - Exported port-indexed helpers: `PadPublishInputForPort_nid_postfix`, `PadFetchOutputForPort_nid_postfix`, `PadSubmitAudioHapticsForPort_nid_postfix`, and `PadSetPortConnected_nid_postfix`. The parameterless legacy exports continue to map to port 0. - Updated `scePadOpen` and `scePadGetHandle` to allocate handles `PAD_HANDLE_BASE + port` for user IDs `0x10000000 + port` (ports 0 to 3). - Updated `scePadGetInfo` to enumerate all currently connected ports and assign distinct simulated Bluetooth MAC addresses (`PAD_BD_ADDRESS` with port offset). - **`libSceUserService`**: - Expanded user registry to support 4 users: `USER_SERVICE_USER_NAMES` ("Player", "Player2", "Player3", "Player4") for user IDs `0x10000000` through `0x10000003`. - Added `UserServiceSetUserConnected_nid_postfix` to toggle user connection state and enqueue `SceUserServiceEvent` login (`EventTypeLogin = 0`) and logout (`EventTypeLogout = 1`) events when controllers connect or disconnect at runtime. User 0 remains permanently logged in. - Updated `sceUserServiceGetLoginUserIdList` and `sceUserServiceGetRegisteredUserIdList` to return active user IDs and fill unused slots with `USER_SERVICE_USER_ID_INVALID` (-1). - Updated `sceUserServiceGetUserName`, `sceUserServiceGetUserNumber` (1–4), and `sceUserServiceGetUserColor` (0: Blue, 1: Red, 2: Green, 3: Pink). - **`libSceVideoOut` (`PadInput`)**: - Replaced the single controller member in `PadInput` with `std::array<ControllerSlot, PAD_MAX_CONTROLLERS> slots`. - The first connected controller is assigned to slot 0 and composed with `Pad::KeyboardMouse`, preserving existing keyboard and mouse bindings, mouse-as-right-stick capture, and input configuration behavior without regressions. - Additional controllers occupy slots 1 to 3 sequentially. Device addition (`SDL_CONTROLLERDEVICEADDED`) and removal (`SDL_CONTROLLERDEVICEREMOVED`) notify `PadSetPortConnected_nid_postfix` and `UserServiceSetUserConnected_nid_postfix`. - `applyOutput` fetches and routes rumble, trigger effects, sensor enable flags, and default player LED colors (Blue, Red, Green, Pink) independently per controller slot. - **Documentation**: - Updated `docs/user/INPUT_MAPPING.md` to describe multi-controller input assignment and dynamic hotplugging for players 1 to 4. - Updated `docs/dev/debt/libScePad.md` to note per-port tracking for angular velocity deadbands. - Updated `docs/dev/debt/libSceUserService.md` regarding multi-user color indices and user names. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux x86_64 (Kernel 6.8, GCC 13.3): - Built all PRX libraries (`ninja -C build libs`) and test targets cleanly. - `guest_pad_tests`: verified multi-controller open (`user = 0x10000001` -> handle 2), independent input publication on port 1 (Triangle) without altering port 0 state, per-handle vibration mode setting, multi-port enumeration in `scePadGetInfo` (verifying `connectedCount[0] == 2` and port indices 0 and 1), and handle validation across opened and unopened slots. - `guest_user_service_tests`: verified `sceUserServiceGetUserName` ("Player" for initial user, "Player2" for second user, error on buffer too short or invalid ID), `sceUserServiceGetUserNumber` (1 and 2), `sceUserServiceGetUserColor` (0 and 1), and dynamic registration list updates on `UserServiceSetUserConnected_nid_postfix(1, true)` and disconnect. - `guest_user_service_lifecycle_tests`: verified login event queueing on initialize, dynamic `EventTypeLogin` event delivery upon connecting user 2, `sceUserServiceGetLoginUserIdList` reporting both users, `EventTypeLogout` delivery upon disconnecting user 2, and list updating. - Regression test suite: `guest_pad_vibration_mode_tests`, `pad_sdl_tests`, `pad_input_mapping_tests`, `pad_keyboard_mouse_tests`, and `video_out_mouse_tests` all pass without errors. - Full repository unit tests: `python3 -m unittest discover tools/tests` passes (596 tests passed, 14 skipped). - `python3 tools/check_conventions.py --base origin/main` passes with zero errors. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
adriadam10 commented 2026-10-19 18:01:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T18:01:29Z.

Review: CHANGES_REQUESTED


Thanks for the multi-controller work. Points to fix before this can merge:

  • Diff noise: libScePad/Export.cpp and libSceUserService/Export.cpp re-indent (1 → 4 spaces) every function the PR does not change, and existing comments are deleted (sceUserServiceGetEvent, sceUserServiceGetGamePresets, sceUserServiceGetPlatformPrivacyWs1, APS5_NO_PAD_INPUT in PadInput.cpp). Keep the original formatting and only touch the lines that change; this also reduces conflicts with #6337, #7059, #6990 and #7298, which touch the same lines of PadState.cpp, PadInput.cpp/.hpp and libSceUserService/Export.cpp. List them under Depends on or rebase after they land.
  • Port 1+ can start disconnected: Pad::Initialize (PadState.cpp) resets slots[i].connected = (i == 0), but PadInput::openController calls PadSetPortConnected_nid_postfix(slot, true) when the window is created, which can be before the title calls scePadInit. The second pad then reports connected == false until a hotplug event, while userConnected in libSceUserService is not reset, so the two disagree. Don't reset connected in Initialize, and add a test that connects the port first and then calls scePadInit.
  • Unverified values need TechnicalDebt lines: user names "Player2..4", colours 1/2/3, and the login/logout events on hotplug have no source. Say in docs/dev/debt/libSceUserService.md that they are assumed, not measured. PadQueueLegacyAudioHaptics/PadClearLegacyAudioHaptics still go only to port 0, which also needs a line in libScePad.md. scePadGetControllerInformation still reports connectedCount = 1.
  • Bound the event queue: eventQueue in libSceUserService grows with every connect/disconnect if the title never calls sceUserServiceGetEvent. Cap it (or collapse login/logout pairs for the same user).
  • Tests: nothing exercises PadInput (slot assignment, removal of slot 0 while slot 1 stays, the same device added twice). info.connectedCount[0] >= 1 in GuestPad.cpp pins nothing; assert the exact count for the state before PadSetPortConnected_nid_postfix(1, true).
  • Minor: the Initialize/Initialize2 login-queue code is duplicated; use one helper.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5575638015 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#pullrequestreview-5575638015). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T18:01:29Z. **Review:** CHANGES_REQUESTED --- Thanks for the multi-controller work. Points to fix before this can merge: - **Diff noise**: `libScePad/Export.cpp` and `libSceUserService/Export.cpp` re-indent (1 → 4 spaces) every function the PR does not change, and existing comments are deleted (`sceUserServiceGetEvent`, `sceUserServiceGetGamePresets`, `sceUserServiceGetPlatformPrivacyWs1`, `APS5_NO_PAD_INPUT` in `PadInput.cpp`). Keep the original formatting and only touch the lines that change; this also reduces conflicts with #6337, #7059, #6990 and #7298, which touch the same lines of `PadState.cpp`, `PadInput.cpp/.hpp` and `libSceUserService/Export.cpp`. List them under **Depends on** or rebase after they land. - **Port 1+ can start disconnected**: `Pad::Initialize` (`PadState.cpp`) resets `slots[i].connected = (i == 0)`, but `PadInput::openController` calls `PadSetPortConnected_nid_postfix(slot, true)` when the window is created, which can be before the title calls `scePadInit`. The second pad then reports `connected == false` until a hotplug event, while `userConnected` in libSceUserService is not reset, so the two disagree. Don't reset `connected` in `Initialize`, and add a test that connects the port first and then calls `scePadInit`. - **Unverified values need TechnicalDebt lines**: user names "Player2..4", colours 1/2/3, and the login/logout events on hotplug have no source. Say in `docs/dev/debt/libSceUserService.md` that they are assumed, not measured. `PadQueueLegacyAudioHaptics`/`PadClearLegacyAudioHaptics` still go only to port 0, which also needs a line in `libScePad.md`. `scePadGetControllerInformation` still reports `connectedCount = 1`. - **Bound the event queue**: `eventQueue` in libSceUserService grows with every connect/disconnect if the title never calls `sceUserServiceGetEvent`. Cap it (or collapse login/logout pairs for the same user). - **Tests**: nothing exercises `PadInput` (slot assignment, removal of slot 0 while slot 1 stays, the same device added twice). `info.connectedCount[0] >= 1` in `GuestPad.cpp` pins nothing; assert the exact count for the state before `PadSetPortConnected_nid_postfix(1, true)`. - Minor: the `Initialize`/`Initialize2` login-queue code is duplicated; use one helper.
alexpournaras commented 2026-10-20 16:52:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alexpournaras on 2026-10-20T16:52:35Z.


Tested this PR with Call of Duty: Black Ops (PPSA34501) in local multiplayer split-screen.

All four controllers were detected, and 4-player split-screen gameplay worked successfully!

Great work!

Screenshot 2026-10-20 194307
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6296292188 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6296292188). Originally posted by [alexpournaras](https://github.com/alexpournaras) on 2026-10-20T16:52:35Z. --- Tested this PR with [Call of Duty: Black Ops (PPSA34501)](https://github.com/boykopovar/AnyPS5/discussions/5389) in local multiplayer split-screen. All four controllers were detected, and 4-player split-screen gameplay worked successfully! Great work! <img width="1110" height="661" alt="Screenshot 2026-10-20 194307" src="https://github.com/user-attachments/assets/ca5f88bb-ec88-4bb0-b376-0a8c558cb747" />
slugzero commented 2026-10-20 22:03:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slugzero on 2026-10-20T22:03:56Z.


Thank you a lot @adriadam10 for your review and for the detailed feedback. I will fix the points and update the PR accordingly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302767114 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6302767114). Originally posted by [slugzero](https://github.com/slugzero) on 2026-10-20T22:03:56Z. --- Thank you a lot @adriadam10 for your review and for the detailed feedback. I will fix the points and update the PR accordingly.
mehmetbayoglu commented 2026-10-20 22:17:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mehmetbayoglu on 2026-10-20T22:17:53Z.


Thanks for this. I wrote the same change independently for Call of Duty: Black Ops (PPSA34501) before I found this PR, so I'll drop mine and build on yours. Two additions I can send as a follow-up PR with Depends on: #7881, if that suits you:

  • APS5_KEYBOARD_USER=2 to 4: the keyboard and mouse play as that user instead of user 1, and that user is logged in at startup, so split screen works with one controller. Tested in Black Ops Zombies split screen with a DualSense as player 1 and the keyboard as player 2.
  • APS5_PAD_SKIP_CONTROLLERS=N: a copy leaves the first N host controllers to another copy, so two copies on one computer (a LAN party) don't both read the same controller.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6303026688 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6303026688). Originally posted by [mehmetbayoglu](https://github.com/mehmetbayoglu) on 2026-10-20T22:17:53Z. --- Thanks for this. I wrote the same change independently for Call of Duty: Black Ops (PPSA34501) before I found this PR, so I'll drop mine and build on yours. Two additions I can send as a follow-up PR with `Depends on: #7881`, if that suits you: - `APS5_KEYBOARD_USER=2` to `4`: the keyboard and mouse play as that user instead of user 1, and that user is logged in at startup, so split screen works with one controller. Tested in Black Ops Zombies split screen with a DualSense as player 1 and the keyboard as player 2. - `APS5_PAD_SKIP_CONTROLLERS=N`: a copy leaves the first N host controllers to another copy, so two copies on one computer (a LAN party) don't both read the same controller.
norton62 commented 2026-10-21 14:52:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by norton62 on 2026-10-21T14:52:00Z.


Heads-up: #9178 touches the same lines in libScePad/Export.cpp. It gives the system remote-control port (type 16) its own disconnected handle (0x10) instead of mapping it to port 0, because mapping it to the DualSense makes SDL titles see every Cross press as Return (it broke Raptor's on-screen keyboard). Happy to rebase onto yours.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6319005661 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6319005661). Originally posted by [norton62](https://github.com/norton62) on 2026-10-21T14:52:00Z. --- Heads-up: #9178 touches the same lines in `libScePad/Export.cpp`. It gives the system remote-control port (type 16) its own disconnected handle (`0x10`) instead of mapping it to port 0, because mapping it to the DualSense makes SDL titles see every Cross press as Return (it broke Raptor's on-screen keyboard). Happy to rebase onto yours.
slugzero commented 2026-10-21 21:20:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slugzero on 2026-10-21T21:20:15Z.


Thanks everyone!

@adriadam10 Thanks for the review and approval! For reference, all review items were addressed in dedicated atomic commits and rebased cleanly onto latest main:

  • Port 1+ pre-init connection state preserved across Pad::Initialize() with test coverage.
  • Technical debt documented in libSceUserService.md (assumed usernames/colors/hotplug events) and libScePad.md (port-0 legacy audio haptics & single pad count).
  • eventQueue bounded to ≤ 4 by collapsing unconsumed opposite events.
  • Added virtual controller lifecycle tests in PadSdl.cpp and pinned exact connected count.
  • Login queue population helper deduplicated.

@alexpournaras Appreciate you testing 4-player split-screen and confirming!

@norton62 Thanks for the heads-up on #9178!

@mehmetbayoglu Both follow-ups sound like great additions!

  • For APS5_KEYBOARD_USER=2..4: Keeping keyboard/mouse composed with Player 1 by default and having APS5_KEYBOARD_USER opt-in to assign it to a dedicated player slot makes total sense for split-screen.
  • For APS5_PAD_SKIP_CONTROLLERS=N: My understanding (though correct me if I'm mistaken) is that Instance 1 would still grab all controllers up to 4 unless it has a matching cap, and in SDL2 device_index shifts when a controller disconnects, which might scramble the skip offset on hotplug/unplug. Maybe an explicit device list/range on both instances (e.g. APS5_PAD_DEVICES=0,1 and 2,3) or slot caps would be more resilient? Happy to see your thoughts and review your PR once this merges!
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326808807 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6326808807). Originally posted by [slugzero](https://github.com/slugzero) on 2026-10-21T21:20:15Z. --- Thanks everyone! @adriadam10 Thanks for the review and approval! For reference, all review items were addressed in dedicated atomic commits and rebased cleanly onto latest `main`: - Port 1+ pre-init connection state preserved across `Pad::Initialize()` with test coverage. - Technical debt documented in `libSceUserService.md` (assumed usernames/colors/hotplug events) and `libScePad.md` (port-0 legacy audio haptics & single pad count). - `eventQueue` bounded to ≤ 4 by collapsing unconsumed opposite events. - Added virtual controller lifecycle tests in `PadSdl.cpp` and pinned exact connected count. - Login queue population helper deduplicated. @alexpournaras Appreciate you testing 4-player split-screen and confirming! @norton62 Thanks for the heads-up on #9178! @mehmetbayoglu Both follow-ups sound like great additions! - For `APS5_KEYBOARD_USER=2..4`: Keeping keyboard/mouse composed with Player 1 by default and having `APS5_KEYBOARD_USER` opt-in to assign it to a dedicated player slot makes total sense for split-screen. - For `APS5_PAD_SKIP_CONTROLLERS=N`: My understanding (though correct me if I'm mistaken) is that Instance 1 would still grab all controllers up to 4 unless it has a matching cap, and in SDL2 `device_index` shifts when a controller disconnects, which might scramble the skip offset on hotplug/unplug. Maybe an explicit device list/range on both instances (e.g. `APS5_PAD_DEVICES=0,1` and `2,3`) or slot caps would be more resilient? Happy to see your thoughts and review your PR once this merges!
mehmetbayoglu commented 2026-10-21 21:53:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mehmetbayoglu on 2026-10-21T21:53:34Z.


@slugzero Thanks, you are right on both points. With only a skip count, the first copy still opens every controller, and the offset follows SDL's device index, which shifts on unplug, so a reconnected controller can land in the other copy.

I'll drop APS5_PAD_SKIP_CONTROLLERS and do it by identity instead: APS5_PAD_DEVICES takes a list of controllers by their serial (or HID path when a controller reports no serial), which AnyPS5 prints when each controller connects. A copy opens only the listed controllers, in list order for users 1 to 4, so each copy gets its own list and a controller that reconnects goes back to the same copy and user. APS5_KEYBOARD_USER stays as described. I'll send both as one follow-up with Depends on: #7881 once this merges.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6327383111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6327383111). Originally posted by [mehmetbayoglu](https://github.com/mehmetbayoglu) on 2026-10-21T21:53:34Z. --- @slugzero Thanks, you are right on both points. With only a skip count, the first copy still opens every controller, and the offset follows SDL's device index, which shifts on unplug, so a reconnected controller can land in the other copy. I'll drop `APS5_PAD_SKIP_CONTROLLERS` and do it by identity instead: `APS5_PAD_DEVICES` takes a list of controllers by their serial (or HID path when a controller reports no serial), which AnyPS5 prints when each controller connects. A copy opens only the listed controllers, in list order for users 1 to 4, so each copy gets its own list and a controller that reconnects goes back to the same copy and user. `APS5_KEYBOARD_USER` stays as described. I'll send both as one follow-up with `Depends on: #7881` once this merges.
norton62 commented 2026-10-22 08:28:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by norton62 on 2026-10-22T08:28:12Z.


@slugzero thanks! One concrete point from the review on #9178: PortForUser still maps the system remote port (user 0xff, type 16) to slot 0, so once both land the remote would read the DualSense again. Since #7881 is approved and will likely merge first, I'll rebase #9178 onto it and keep the remote port out of the per-port slots (its own disconnected handle outside PAD_HANDLE_BASE + port). Does that work for you?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336314213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6336314213). Originally posted by [norton62](https://github.com/norton62) on 2026-10-22T08:28:12Z. --- @slugzero thanks! One concrete point from the review on #9178: `PortForUser` still maps the system remote port (user 0xff, type 16) to slot 0, so once both land the remote would read the DualSense again. Since #7881 is approved and will likely merge first, I'll rebase #9178 onto it and keep the remote port out of the per-port slots (its own disconnected handle outside `PAD_HANDLE_BASE + port`). Does that work for you?
slugzero commented 2026-10-22 13:04:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slugzero on 2026-10-22T13:04:49Z.


@norton62 understood, thanks. And sure, that works for me! Left an approving comment in your PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341463274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7881#issuecomment-6341463274). Originally posted by [slugzero](https://github.com/slugzero) on 2026-10-22T13:04:49Z. --- @norton62 understood, thanks. And sure, that works for me! Left an approving comment in your PR.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7881
No description provided.