Skip to content

libScePad: replace NotImplemented stubs and fix return-0 consistency - #5038

Open
coptergui-ops wants to merge 2 commits into
boykopovar:mainfrom
coptergui-ops:main
Open

coptergui-ops wants to merge 2 commits into
boykopovar:mainfrom
coptergui-ops:main

Conversation

@coptergui-ops

Copy link
Copy Markdown

Replace all remaining NotImplemented_nid_no_patch stubs in libScePad with proper return values, and fix two functions returning bare 0 instead of PAD_OK.

Changes to core/libs/prx/libScePad/Export.cpp

17 NotImplemented stubs replaced with proper error codes:

  • scePadOpenExt accepts all port types, returns DEVICE_NOT_CONNECTED instead of throwing on non-special ports (PPSA01317)
  • scePadReadExt, GetFeatureReport, SetFeatureReport, OutputReport return DEVICE_NOT_CONNECTED (imported by PPSA01317)
  • All 8 scePadVrController* functions return DEVICE_NOT_CONNECTED (imported by PPSA99177 for PS VR2)
  • scePadUnknown_n3kSX62fgNo returns 0 as the console does (imported by PPSA01317)
  • scePadSetAngularVelocityBiasCorrectionState accepts enabled value without throwing (bias correction not modelled, no-op)

Consistency fix:

  • scePadReadState and scePadIsRemoteController return PAD_OK explicitly instead of bare 0

Changes to docs/dev/debt/libScePad.md

Each function's new behaviour documented with PPSA references. "Other port types throw" changed to "all port types return DEVICE_NOT_CONNECTED". Added entries for each previously-thrown function.

State

  • 0 NotImplemented stubs remaining (was 17)
  • All functions return proper error codes or PAD_OK
  • Conventions check passes clean

…TED returns

Replace 17 NotImplemented_nid_no_patch calls in libScePad with
DEVICE_NOT_CONNECTED (0x80920007), matching console behaviour where
the host has no special controller at any port type.

Changes:
- scePadOpenExt: accept all port types, return DEVICE_NOT_CONNECTED
  instead of throwing on non-special ports
- scePadReadExt, GetFeatureReport, SetFeatureReport, OutputReport:
  return DEVICE_NOT_CONNECTED (imported by PPSA01317)
- All scePadVrController* functions: return DEVICE_NOT_CONNECTED
  (imported by PPSA99177 for PS VR2)
- scePadUnknown_n3kSX62fgNo: return 0 (imported by PPSA01317)
- scePadSetAngularVelocityBiasCorrectionState: accept enabled value
  without throwing (bias correction not modelled)

Update docs/dev/debt/libScePad.md to reflect each function's new
behaviour and cite the PPSA references.

Signed-off-by: Sebastian <coptergui@gmail.com>
scePadReadState and scePadIsRemoteController returned bare 0 instead of
PAD_OK, inconsistent with the rest of the library. Both now return PAD_OK
explicitly. All other functions already use proper error/success codes.
@github-actions

Copy link
Copy Markdown

Progress report (2a2a3dc → 3dadad7)

📈 System libraries: 88.85% (+0.47%, +17 implemented functions)

✅ 17 implemented
Library Name
libScePad scePadGetFeatureReport
libScePad scePadOpenExt
libScePad scePadOutputReport
libScePad scePadReadExt
libScePad scePadSetAngularVelocityBiasCorrectionState
libScePad scePadSetFeatureReport
libScePad scePadUnknown_n3kSX62fgNo
libScePad scePadVrControllerGetDeviceInformation
libScePad scePadVrControllerGetTriggerEffectState
libScePad scePadVrControllerGetTriggerEffectStates
libScePad scePadVrControllerRead
libScePad scePadVrControllerReadCombinedState
libScePad scePadVrControllerReadState
libScePad scePadVrControllerSetTriggerEffect
libScePad scePadVrControllerSetTriggerEffects
libScePad scePadVrControllerSetVibration
libScePad scePadVrControllerSetVibrationMode
⚪ 15 behaviourally empty (constant return or throw)
Library Name
libScePad scePadGetFeatureReport
libScePad scePadOutputReport
libScePad scePadReadExt
libScePad scePadSetFeatureReport
libScePad scePadUnknown_n3kSX62fgNo
libScePad scePadVrControllerGetDeviceInformation
libScePad scePadVrControllerGetTriggerEffectState
libScePad scePadVrControllerGetTriggerEffectStates
libScePad scePadVrControllerRead
libScePad scePadVrControllerReadCombinedState
libScePad scePadVrControllerReadState
libScePad scePadVrControllerSetTriggerEffect
libScePad scePadVrControllerSetTriggerEffects
libScePad scePadVrControllerSetVibration
libScePad scePadVrControllerSetVibrationMode

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR. Not mergeable as is, these need fixing:

  • Conventions CI is red: title IDs (PPSA99177, PPSA01317, PPSA25971) appear in core/libs/prx/libScePad/Export.cpp comments and docs/dev/debt/libScePad.md. Implement the general behaviour; cite titles only where the check allows it.
  • "console returns DEVICE_NOT_CONNECTED" (Export.cpp:171, 176, 181, 186, 281-309, 334) has no source. For exports whose signature is unknown (scePadReadExt, scePadGetFeatureReport, scePadSetFeatureReport, scePadOutputReport, scePadVrController*), a plausible return value where main throws hides the gap. Keep throwing unless you cite a reference (KytyPS5, shadPS4, prosper, SharpProspero) or a measurement.
  • scePadSetAngularVelocityBiasCorrectionState(enabled=true) (Export.cpp:321-324) changes from throw to a silent no-op although bias correction isn't modelled. Mode/state writes must throw for what isn't modelled.
  • scePadOpenExt (Export.cpp:163-167): the comment says "console behaviour" without a source; same for scePadUnknown_n3kSX62fgNo "returns 0 as the console does".
  • docs/dev/debt/libScePad.md:6 links https://github.com/boykopovar/AnyPS5/discussions/25971, which returns 404, and claims a measurement on firmware 13.60. Remove it or give the real source.
  • No test covers any new behaviour. Add a registered guest test, with values taken from a reference.
  • Code comments: the project doesn't use them; drop them from Export.cpp.
  • The PR body lacks the template sections (### What, ### Tested, ### Checklist).

Feel free to push the fixes to this PR.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

There is now a console measurement for n3kSX62fgNo (firmware 13.60, #3177 (comment)): it returns 0x80920005 before scePadInit and 0x809200FF after, in every case tried, never 0. Please use those values (with a guest test) instead of 0, or drop this function from the PR.

@xXPBSXx

xXPBSXx commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Tested on head 3dadad70c (the current head of this pull request on GitHub, same SHA).

Title evidence for scePadUnknown_n3kSX62fgNo returning 0: PPSA13356 (Raiden III) stops on it, and with this pull request merged it gets past it.

  • Without this pull request: main e46c69505, 126 core/libs/libs/*.prx and relinker.exe built from that tree (relinker.exe 2026-10-14 07:21:30, 128 .prx files), app.exe relinked 07:42:01 with relink_title.ps1 -Id PPSA13356 -ModuleDir @() -Repo <that tree> (relinker.exe --windows --registry). The run (PPSA13356_rH/run_085314.err, 35 lines) ends at line 4: what(): scePadUnknown_n3kSX62fgNo not implemented. The same stop appeared in an earlier run on main f919033ac (PPSA13356_rB/run_070149.err, 35 lines, line 4).
  • With this pull request: tree 9afcf7dfb = main cd936f637 + 3dadad70c. The run (PPSA13356_rU/run_081948.err, 305 lines) contains no scePadUnknown line (0 of 305). It stops later, at line 8: what(): sceVideoOutSetFlipRate: VIDEO_OUT_ERROR_INVALID_VALUE (the title calls sceVideoOutSetFlipRate(handle, 60); that stop is not related to this pull request). A second tree, main 1e7272196 + 3dadad70c (merge 6a4d76b8e), gives the same result: no scePadUnknown line in 353 lines, the title passes SetFlipRate with an unrelated change applied and stops at line 29 on NGS2: invalid voice handle (PPSA13356_rV/run_083704.err).

Test conditions

  • With-runs: ninja -C build -j4 relinker plus all 126 core/libs/libs/*.prx of the merged tree (rU: finished 08:19:42 local time, libSceAgcDriver.prx 08:19:34, libkernel.prx 08:19:42; rV: finished 08:36:53, libSceAgcDriver.prx 08:36:23, libkernel.prx 08:36:52); relinker.exe 2026-10-14 07:35:29. Relink: relink_title_trace.ps1 -Id PPSA13356 -Repo <tree> = relinker.exe --windows --registry --trace-imports in\eboot.elf app.exe, no -ModuleDir. Run: run_title.ps1 -Seconds 90.
  • Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release. The two runs without this pull request (rH, rB) were made by another session on the same machine; their relink command and library build are recorded in that session's log, not rechecked by me beyond the file dates above.

Limits

  • One title, one run per tree. What the console returns from this call is not known to me; the title stopping here and passing with return 0 shows that returning 0 is enough for the title to go on, not that it is the console's behaviour.
  • This pull request currently conflicts with main: git merge-tree of 3dadad70c against main a3aeaf884 reports a content conflict in docs/dev/debt/libScePad.md (the merges above were made on the earlier main SHAs listed).
  • The log lines were counted with a script; the runs ended at line 4 / 8 / 29 as stated.

AI-assisted (Claude Code).

@xXPBSXx

xXPBSXx commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Addendum to my Windows test above: this pull request now conflicts with #5676, which changes the same function (scePadUnknown_n3kSX62fgNo) and returns statuses measured on a PS5 instead of 0. PPSA13356 passes the pad call with either change: with #5676 (merge tree on current main, plus a local flip-rate change from #5691) there is no scePadUnknown line in 353 lines of PPSA13356_rY1/run_115406.err, and the title stops at the same later place (NGS2: invalid voice handle) as with this pull request. git merge-tree of this head 3dadad70c against current main also reports a conflict in docs/dev/debt/libScePad.md.

AI-assisted (Claude Code).

@github-actions

github-actions Bot commented Oct 15, 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 6337 docs/dev/debt/libScePad.md
PR 7064 docs/dev/debt/libScePad.md
PR 7881 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 7965 core/libs/prx/libScePad/Export.cpp
PR 8138 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 8307 core/libs/prx/libScePad/Export.cpp
PR 8350 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Conflicts with main in core/libs/prx/libScePad/Export.cpp: #5676 has since merged and makes scePadUnknown_n3kSX62fgNo return the console-measured statuses. Please rebase. Still open from 2026-10-14: drop that function from this PR (main now has the measured values) and keep the other stubs.

This branch has not been deployed

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

Labels

docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants