feat(libScePad): implement scePadGetControllerType #8350

Merged
adriaespii merged 1 commit from upstream-pr/8350 into main 2026-10-24 11:52:35 +00:00
adriaespii commented 2026-10-20 10:49:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriaespii on 2026-10-20T10:49:41Z.


What

Implement scePadGetControllerType returning PAD_DEVICE_TYPE_DUAL_SENSE for the emulated controller, following scePadGetInfo.

Tested

Windows 11, check_conventions.py passed, GuestPad test coverage added.

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:4934650791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8350). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-10-20T10:49:41Z. --- ### What Implement scePadGetControllerType returning PAD_DEVICE_TYPE_DUAL_SENSE for the emulated controller, following scePadGetInfo. ### Tested Windows 11, check_conventions.py passed, GuestPad test coverage added. ### 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](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
oneandonlydean commented 2026-10-21 02:25:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T02:25:54Z.


@adriaespii thanks. Two things before this can go in: (1) it conflicts with current main in core/libs/tests/GuestPad.cpp, so it needs a rebase. (2) Where does the value 3 come from? It's the scePadGetInfo deviceType constant, but scePadGetControllerType may use its own enum: duaLib's reimplementation of the API (src/include/duaLib.h, s_SceControllerType) has DUALSENSE = 2 there. Could you cite a source for 3 (a firmware read or a console run), or, if there isn't one, add an entry to docs/dev/debt/libScePad.md saying the value is unmeasured?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6306464493 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8350#issuecomment-6306464493). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T02:25:54Z. --- @adriaespii thanks. Two things before this can go in: (1) it conflicts with current main in core/libs/tests/GuestPad.cpp, so it needs a rebase. (2) Where does the value 3 come from? It's the scePadGetInfo deviceType constant, but scePadGetControllerType may use its own enum: duaLib's reimplementation of the API (src/include/duaLib.h, s_SceControllerType) has DUALSENSE = 2 there. Could you cite a source for 3 (a firmware read or a console run), or, if there isn't one, add an entry to docs/dev/debt/libScePad.md saying the value is unmeasured?
adriaespii commented 2026-10-21 06:28:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriaespii on 2026-10-21T06:28:25Z.


Rebased on current main and resolved the conflict in core/libs/tests/GuestPad.cpp.

Regarding the value 3: it is unmeasured on a real console or firmware read; it was borrowed directly from scePadGetInfo's deviceType constant (PAD_DEVICE_TYPE_DUAL_SENSE = 3). I have expanded the entry in docs/dev/debt/libScePad.md to state that the value is unmeasured on hardware and to note duaLib's s_SceControllerType definition where DUALSENSE = 2.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309614378 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8350#issuecomment-6309614378). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-10-21T06:28:25Z. --- Rebased on current `main` and resolved the conflict in `core/libs/tests/GuestPad.cpp`. Regarding the value 3: it is unmeasured on a real console or firmware read; it was borrowed directly from `scePadGetInfo`'s `deviceType` constant (`PAD_DEVICE_TYPE_DUAL_SENSE = 3`). I have expanded the entry in `docs/dev/debt/libScePad.md` to state that the value is unmeasured on hardware and to note duaLib's `s_SceControllerType` definition where `DUALSENSE = 2`.
adriadam10 commented 2026-10-21 11:15:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T11:15:31Z.

Review: CHANGES_REQUESTED


Thanks for the rebase note and the debt entry. Remaining points:

  • core/libs/prx/libScePad/Export.cpp:483: *type = PAD_DEVICE_TYPE_DUAL_SENSE (3) borrows the scePadGetInfo deviceType constant. The only reference for this API, duaLib, declares scePadGetControllerType(int, s_SceControllerType*) with its own enum (UNKNOWN=0, DUALSHOCK_4=1, DUALSENSE=2, src/include/duaLib.h) and returns that enum (src/source/duaLib.cpp:872). With the only source saying 2 and nothing measured for 3, returning 3 is a plausible-but-unverified value. Either return 2 (a named constant for duaLib's DUALSENSE, debt entry saying it is unmeasured on hardware) or keep throwing. Update the test in GuestPad.cpp to pin that value.
  • The PR still reports conflicts with main in core/libs/tests/GuestPad.cpp; please rebase again.
  • The debt text says the validation order follows duaLib, but duaLib returns PAD_ERROR_DEVICE_NOT_CONNECTED for an invalid pad and does not check type == NULL. Please make the wording match what the code does.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5598816782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8350#pullrequestreview-5598816782). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-21T11:15:31Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase note and the debt entry. Remaining points: - `core/libs/prx/libScePad/Export.cpp:483`: `*type = PAD_DEVICE_TYPE_DUAL_SENSE` (3) borrows the `scePadGetInfo` `deviceType` constant. The only reference for this API, duaLib, declares `scePadGetControllerType(int, s_SceControllerType*)` with its own enum (`UNKNOWN=0, DUALSHOCK_4=1, DUALSENSE=2`, `src/include/duaLib.h`) and returns that enum (`src/source/duaLib.cpp:872`). With the only source saying 2 and nothing measured for 3, returning 3 is a plausible-but-unverified value. Either return 2 (a named constant for duaLib's `DUALSENSE`, debt entry saying it is unmeasured on hardware) or keep throwing. Update the test in `GuestPad.cpp` to pin that value. - The PR still reports conflicts with `main` in `core/libs/tests/GuestPad.cpp`; please rebase again. - The debt text says the validation order follows duaLib, but duaLib returns `PAD_ERROR_DEVICE_NOT_CONNECTED` for an invalid pad and does not check `type == NULL`. Please make the wording match what the code does.
adriaespii commented 2026-10-22 07:12:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriaespii on 2026-10-22T07:12:13Z.


Updated:

  • Switched to returning PAD_CONTROLLER_TYPE_DUAL_SENSE (2) following duaLib's s_SceControllerType enum and pinned the value in GuestPad.cpp.
  • Rebased onto latest main and resolved conflicts in GuestPad.cpp, Export.cpp, and libScePad.md.
  • Updated the technical debt entry in docs/dev/debt/libScePad.md to accurately reflect the return value, unmeasured hardware status, and our validation order vs duaLib.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334997725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8350#issuecomment-6334997725). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-10-22T07:12:13Z. --- Updated: - Switched to returning `PAD_CONTROLLER_TYPE_DUAL_SENSE` (2) following duaLib's `s_SceControllerType` enum and pinned the value in `GuestPad.cpp`. - Rebased onto latest `main` and resolved conflicts in `GuestPad.cpp`, `Export.cpp`, and `libScePad.md`. - Updated the technical debt entry in `docs/dev/debt/libScePad.md` to accurately reflect the return value, unmeasured hardware status, and our validation order vs duaLib.
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!8350
No description provided.