Skip to content

feat(libScePad): answer the co-pilot and Move model controller queries - #15074

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
xecedemon:feat/libScePad-pending-exports
Nov 7, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
xecedemon:feat/libScePad-pending-exports

Conversation

@xecedemon

@xecedemon xecedemon commented Nov 2, 2026 •

Copy link
Copy Markdown

What

Answers the two unclaimed libScePad controller-model queries, scePadIsCoPilot and scePadIsMoveReproductionModel. Per the firmware 13.42 disassembly from the review, both return 0x80920005 before scePadInit, so both now check initialisation first with the scePadGetBluetoothAddress idiom. After init the console asks the kernel (ioctl 0xc0184853, sub-command 0x0a, handle passed through, no module-side handle validation); this host has one DualSense behind every handle and no co-pilot pairing or Move, so both answer false for every handle after init — a host choice, recorded in the debt entry in the scePadIsDS4Connected wording.

Adds 14 debt entries covering every other unclaimed pending export (idle counters, device-id queries, Mbus/port management, device-id opens, connection/BC/remote-play injection, feature report 2, button remapping, the Lotus IR family, the extended trigger effect, profile-edit and indicator family, Leonardo controller type, recording, the collaboration input manager): what is recovered, why no complete semantics source exists (each attributed only to what the cited reimplementations actually export), and why they keep throwing. No behaviour was invented.

Skipped as claimed by open PRs: the VR-controller/report batch (#5038), light-bar tracker (#8260), scePadOpen port probes (#10935), scePadSetConnection (#14840), LED setters (#12311), power/process setters (#12312), feature toggles (#12310), bond (#12308) and controller-update (#12309) families.

Tested

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
  • 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

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed build docs prx labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5038 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 8260 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 12310 core/libs/prx/libScePad/CMakeLists.txt
core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 12311 core/libs/prx/libScePad/CMakeLists.txt
core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 12312 core/libs/prx/libScePad/CMakeLists.txt
core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 14124 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 14212 docs/dev/debt/libScePad.md
PR 16463 docs/dev/debt/libScePad.md

BunnyFl
BunnyFl previously requested changes Nov 2, 2026

@BunnyFl BunnyFl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The firmware contradicts one part of the new behaviour: the initialisation check.

Firmware 13.42's libScePad.sprx (sha256 57eab7054e10d95ba0028dbd4808f94eb34c7663333a2b7ca9f68dc90cf62c60), read from disassembly only, not measured on a console:

0x158e0 scePadIsCoPilot (rZiqk1bQwr4)
  158f9: cmpl [0x24018], 0 ; je 1594d   ; 1594d: eax = 0x80920005 (NOT_INITIALIZED)
  1590b: call 0x1abf0                   ; lock
  15914: edi = [0x2401c] ; esi = 0xc0184853 ; [rbp-0x30] = {0x0a, handle}
  1592c: call 0x1abd0                   ; ioctl on the pad device
  1593a: call 0x1ac10                   ; unlock ; returns the ioctl result
  1. Before scePadInit, scePadIsCoPilot returns 0x80920005, not 0. The new test asserts scePadIsCoPilot(handle) == 0 for every handle before init, so it pins behaviour the console doesn't have. main already has Pad::IsInitialized() and PAD_ERROR_NOT_INITIALIZED, used the same way by scePadGetBluetoothAddress and others. Could both functions start with if (!Pad::IsInitialized()) return PAD_ERROR_NOT_INITIALIZED;, and could the test expect that before init?
  2. scePadIsMoveReproductionModel (0x11310) tests the same initialisation flag (0x24018) and has its own 0x80920005 path, at 11586. I didn't trace the rest of that larger function, so I can't say more about its handle handling.
  3. After init, the answer comes from the kernel (ioctl 0xc0184853, sub-command 0x0a), so the module doesn't validate the handle itself. Answering 0 for every handle, including closed and invalid ones, is a host choice. Please say so in the debt entry, worded like the scePadIsDS4Connected precedent, rather than leaving the console's answers as only "not measured".

The debt-only entries for the other exports read fine. I haven't checked each of their recovered-register claims against the module.

oneandonlydean added a commit to xecedemon/AnyPS5 that referenced this pull request Nov 2, 2026
libScePad/CMakeLists.txt: this branch's guest_pad_device_model_queries test
block and main's controller_queries and audio_route blocks were added at the
same place; keep all three.
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Progress report (d1ae628 → 28d1bf8)

📈 System libraries: 26.48% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libScePad scePadIsCoPilot
libScePad scePadIsMoveReproductionModel

Changed libraries (implemented exports)

Library Before After Change
libScePad 52/213 (24.41%) 54/213 (25.35%) +0.94%

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@maskym

maskym commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Windows result for head c384085e40, merged alone into main a4eca2a056 (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

guest_pad_device_model_queries, the test this PR adds or extends, passes 3 of 3 runs. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@xecedemon
xecedemon force-pushed the feat/libScePad-pending-exports branch from c384085 to 28d1bf8 Compare November 3, 2026 07:36
@xecedemon

Copy link
Copy Markdown
Author

Thank you for the disassembly — that pins exactly what could not be measured.

Both scePadIsCoPilot and scePadIsMoveReproductionModel now start with the scePadGetBluetoothAddress idiom (if (!Pad::IsInitialized()) return PAD_ERROR_NOT_INITIALIZED;), and guest_pad_device_model_queries expects 0x80920005 for every handle before scePadInit (it aborts against the previous revision, so the pin is real).

The debt entry now records what you traced: the pre-init 0x80920005 from both (0x158e0 / 0x11310), and that after init scePadIsCoPilot passes the handle to the kernel through ioctl 0xc0184853 sub-command 0x0a with no module-side handle validation, the rest of scePadIsMoveReproductionModel being untraced. The entry states in the scePadIsDS4Connected wording that answering false for every handle after init is this host's choice (one DualSense behind every handle, no co-pilot pairing, no Move), not a console measurement.

Nothing else changed: the same 7 Pad tests pass, conventions pass, and the entry is under 1000 characters again. The branch is rebased onto current main (d1ae628), replacing the merge commit.

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
@adriadam10
adriadam10 dismissed BunnyFl’s stale review November 7, 2026 02:56

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit f794394 into boykopovar:main Nov 7, 2026
13 of 14 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the init gate against BunnyFl's firmware 13.42 trace (0x80920005 before scePadInit for both queries), the new guest_pad_device_model_queries pins it for every handle (it fails on main and on the first revision), and the debt entries state what is recovered and what is a host choice; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants