fix(pad): report special ports as not connected in scePadOpen #3838

Merged
gookie-dev merged 1 commit from upstream-pr/3838 into main 2026-10-11 22:09:03 +00:00
gookie-dev commented 2026-10-11 17:40:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gookie-dev on 2026-10-11T17:40:30Z.


What

scePadOpen returned the standard pad's handle for a special port (type 2) as well, and scePadGetHandle found it there. Both ports then read the same input queue, so a press queued between two frames could be drained by the special port's scePadRead and never reach the standard port.

PPSA16827 (Harmony's Odyssey) opens both ports for the initial user and, every frame, reads both and polls scePadGetControllerInformation and scePadDeviceClassParseData for the special one.

Special ports now return DEVICE_NOT_CONNECTED (0x80920007) from scePadOpen, as scePadOpenExt already does because the host has no special controller, and scePadGetHandle has no handle for them. The existing TechnicalDebt entry for scePadOpenExt now covers both calls (console behaviour for a disconnected special port is unknown).

Tested

Ubuntu 24.04, GCC 13.3, Release.

  • guest_pad opens a special port before and after the standard one and expects DEVICE_NOT_CONNECTED, and DEVICE_NO_HANDLE from scePadGetHandle for the special port while the standard handle stays valid. It aborts on main and passes with this change.
  • PPSA16827 (relinked with --to-intel), 130 s on its title screen, pad calls traced under gdb: 6812 scePadRead, 3408 scePadGetControllerInformation and 3406 scePadDeviceClassParseData before (two reads of the same queue per frame); 2702 reads, 1 information call and no parse calls after.
  • The title still does not react to input on its title screen; that has another cause and is not addressed here.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821015018 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3838). Originally posted by [gookie-dev](https://github.com/gookie-dev) on 2026-10-11T17:40:30Z. --- ### What `scePadOpen` returned the standard pad's handle for a special port (type 2) as well, and `scePadGetHandle` found it there. Both ports then read the same input queue, so a press queued between two frames could be drained by the special port's `scePadRead` and never reach the standard port. PPSA16827 (Harmony's Odyssey) opens both ports for the initial user and, every frame, reads both and polls `scePadGetControllerInformation` and `scePadDeviceClassParseData` for the special one. Special ports now return `DEVICE_NOT_CONNECTED` (0x80920007) from `scePadOpen`, as `scePadOpenExt` already does because the host has no special controller, and `scePadGetHandle` has no handle for them. The existing TechnicalDebt entry for `scePadOpenExt` now covers both calls (console behaviour for a disconnected special port is unknown). ### Tested Ubuntu 24.04, GCC 13.3, Release. - `guest_pad` opens a special port before and after the standard one and expects `DEVICE_NOT_CONNECTED`, and `DEVICE_NO_HANDLE` from `scePadGetHandle` for the special port while the standard handle stays valid. It aborts on `main` and passes with this change. - PPSA16827 (relinked with `--to-intel`), 130 s on its title screen, pad calls traced under gdb: 6812 `scePadRead`, 3408 `scePadGetControllerInformation` and 3406 `scePadDeviceClassParseData` before (two reads of the same queue per frame); 2702 reads, 1 information call and no parse calls after. - The title still does not react to input on its title screen; that has another cause and is not addressed here. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [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] AI-assisted: yes
adriadam10 commented 2026-10-11 22:09:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:09:00Z.


Checked on the PR merged onto main: guest_pad and the libScePad/libs ctest scope pass (20/20), and the new guest_pad checks fail without the Export.cpp change. The TechnicalDebt entry covers both calls; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114392937 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3838#issuecomment-6114392937). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:09:00Z. --- Checked on the PR merged onto main: `guest_pad` and the libScePad/libs ctest scope pass (20/20), and the new `guest_pad` checks fail without the `Export.cpp` change. The TechnicalDebt entry covers both calls; merging.
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!3838
No description provided.