fix(libScePad): return measured status for unknown Pad NID #5676
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5676"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T06:00:54Z.
What
Implements the measured behavior for libScePad NID
n3kSX62fgNo: it returns0x80920005beforescePadInitand0x809200ffafter initialization while no controller is open. A PS5 probe found no memory access through the tested argument values. The NID's name and signature remain unknown. Calls with an open controller remain unmeasured and throw rather than assuming the post-init status applies. This removes the observed startup abort without pretending the underlying API is understood. Resolves the measured portion of #3177.Tested
main2fab88d10.python3 tools/check_conventions.py --base 2fab88d10andgit diff --checkpass.guest_ppsa01530_exportstest only asserted that this export threw as an unimplemented stub. It is removed because this PR now implements the two measured return states;guest_padcovers the before-init, after-init/no-handle, and open-controller states.guest_pad_testsand the then-existingguest_ppsa01530_exports_tests. CTest stopped before assertions because this host's Xeon E5-1620 v2 lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA. I have not rerun the emulator tests on a compatible host after rebasing.Checklist
main; no other open PR implements the same functionsdocs/dev/debt/libScePad.md.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by AlexOfTheForest on 2026-10-14T06:06:17Z.
CONTRIBUTING allows code comments only for technical debt, so the three comment lines in scePadUnknown_n3kSX62fgNo should move to the debt entry. That entry is the right place to record "firmware 13.60, before/after scePadInit, no argument pointers read or written", which is currently in the code.
0x80920005 and 0x809200ff look like the known pad error codes NOT_INITIALIZED and FATAL (the same values other PS4/PS5 projects use). Naming the constants PAD_ERROR_NOT_INITIALIZED / PAD_ERROR_FATAL instead of PAD_UNKNOWN_N3KSX62FGNO_BEFORE/AFTER_INIT would say what they mean, and the before-init value could be reused by other exports that check initialization.
Imported from boykopovar/AnyPS5. Originally posted by eliasbruno124-dev on 2026-10-14T06:29:39Z.
Additional title evidence for the controller-open limitation: Castlevania Dominus Collection (PPSA15645, 01.003.000) calls this import after opening a pad.
On Windows with GCC 15.2, I built and tested the exact Pad change from 9e6dba8 on the frozen
0aa4cb1cbase. Bothguest_padandguest_ppsa01530_exportspassed; the new Pad test fails at the original unimplemented export when using the old module.Separately, read-only debugger observation of the original title using the baseline Pad runtime established this order:
scePadInitonce.scePadOpen(user=0x10000000, type=0, index=0, param=NULL)once.scePadClosebefore the unknown call at original executable VA0xff.g_openedbyte is1at that call. The caller forwards its existing argument registers and does not inspect the return value afterwards.I stopped before the unknown call rather than treating this as covered by the #3177 probe, where PadOpen failed. No return was substituted. This does not demonstrate title progress or correct input behavior, and it is not a current-main gameplay test.
Correction to my initial wording: the behavioral tests used the new unpatched module, but the title observation loaded the old packaged module. The packaging check caught this; the observation therefore establishes the baseline open-controller state, not execution of this PR.
A hardware measurement with a successfully opened controller would cover a state this title actually uses. The current measured scope is useful, but cannot yet establish the result or side effects for that state.
Prepared with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T06:35:52Z.
Moved the probe details from the code comments into
docs/dev/debt/libScePad.mdand recorded PPSA15645’s opened-controller call site as an unmeasured state. I kept the constants named by the observed NID and initialization state: the supplied evidence establishes the numeric returns, but does not independently confirm their semantic labels, and the title observation stopped before the call. Targeted Linux CTest (guest_pad,guest_ppsa01530_exports) passes 2/2; the hosted conventions check also passes on this revision.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T10:05:49Z.
Title evidence for this pull request: Raiden III x MIKADO MANIAX (PPSA13356), Windows 10 (19045), RTX 4080 SUPER, one 90 s run.
Without a change to
scePadUnknown_n3kSX62fgNothe title stops at it:PPSA13356_rH/run_085314.errline 4what(): scePadUnknown_n3kSX62fgNo not implemented(maine46c69505).With this pull request (head
5dd44a89c) in a local merge treeab5a5501c= currentmain(checked out 11:49:03) + this head + a local change that makessceVideoOutSetFlipRatereturn its error code instead of throwing (that is the change of #5691, the title callssceVideoOutSetFlipRate(handle, 60)): 0 of 353 lines inPPSA13356_rY1/run_115406.errcontainscePadUnknown, and the title gets past it. It then stops at line 29,what(): NGS2: invalid voice handle(FATAL in line 30), which is not related to this pull request.With #5038 (
return 0for the same function) the same title stops at the same place, so for this title both pull requests pass the pad call equally; this one has the console measurement as its source. #5038 and this pull request conflict inlibScePad/Export.cpp.Test conditions:
ninja -j 4 relinkerplus all 126core/libs/libs/*.prxof the merged tree, finished 11:54:01 local time (libSceAgcDriver.prx11:53:53,libkernel.prx11:54:00),relinker.exe11:53:53; relinkrelink_title_trace.ps1 -Repo K:\AnyPS5\wt-sockets(relinker.exe --windows --registry --trace-imports), run throughrun_title.ps1, 90 s, one game at a time.Not tested: Linux, other GPUs, a second run, the title without the local flip-rate change.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T14:31:19Z.
Rebased onto current
main(066b58fa1) and refreshed the integration with the current not-implemented export audit.Validation on Linux:
guest_pad_testsandguest_ppsa01530_exports_testsbuild successfully.conventions,eligibilityandreportchecks pass. The Linux/Windows full builds and the platform-specific suites were skipped by path filtering.The earlier focused CTest pass was on the previous revision; this rebase's runtime result is limited by the host CPU.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T16:30:51Z.
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.
core/libs/CMakeLists.txtcore/libs/prx/libScePad/Export.cppdocs/dev/debt/libScePad.mdcore/libs/CMakeLists.txtcore/libs/tests/GuestPPSA01530Exports.cppcore/libs/tests/GuestPad.cppcore/libs/CMakeLists.txtcore/libs/prx/libScePad/Export.cppdocs/dev/debt/libScePad.mddocs/dev/debt/libScePad.mdImported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-14T17:13:04Z.
The rebase's CTest run could not reach the assertions, so here is a runtime result for the current head (
1c7a09d1fmerged ontomaine34c47921, WSL Ubuntu, GCC 15.2.0, Release). The new assertions fail before the change and pass after it:guest_padguest_ppsa01530_exportsmainmainlibrary with this PR's two test fileswhat(): scePadUnknown_n3kSX62fgNo not implementedmain+ this PROne gap: the after-init assertion (GuestPad.cpp#L102-L104) runs inside
CheckTiltCorrection, whichmain()calls afterscePadOpenhas returned a handle (L285, L291). So the test pins0x809200ffwith a handle open, the state @hugodearaujo's probe could not reach becausescePadOpenfailed in the payload with0x809b0081(#3177 comment). The state the probe did measure, initialized with no handle, is not asserted. The export ignoresg_opened(Export.cpp#L317-L319), so in the open-handle state, where @eliasbruno124-dev traced PPSA15645's call (g_opened= 1, comment), it returns0x809200ffinstead of throwing, although the debt entry calls that state unknown. A small probe that calls the export in each state:mainscePadInit0x80920005scePadInit, no handle0x809200ffscePadOpen(0x10000000, 0, 0, NULL)returned 10x809200ffscePadClose0x809200ffThe change below returns the measured statuses while no handle is open and keeps throwing while one is. With it on
main,guest_pad(10 of 10 repeats) andguest_ppsa01530_exportspass, itsguest_padaborts when built against this head'sExport.cpp, and the conventions check passes.diff against 1c7a09d1f
The trade-off: PPSA15645 keeps stopping at this call, and PPSA13356, which gets past it with this PR in @xXPBSXx's run (comment), would stop here again if it also calls it with a handle open. @xXPBSXx, would a run on
mainrelinked with--trace-importsandAPS5_TRACE_CALLS=libScePadshow the order? The abort report lists the last traced calls (USAGE.md). Ifxk0AcarP3V4(scePadOpen) comes beforen3kSX62fgNo, the maintainers have to choose between this PR's value for that state and a probe from a game process that can open a pad.AI-assisted: written with Claude Code; I checked the head's export and test against the #3177 probe and the PPSA15645 trace, and ran
guest_padandguest_ppsa01530_exportsonmain, onmainwith this PR's tests, onmain+ this PR and onmain+ the change above (WSL Ubuntu, GCC 15.2.0, Release), plus the state probe on each tree andtools/check_conventions.pyon the change.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T20:29:45Z.
Please take @nikowolf123's change above: keep the measured statuses while no handle is open, and throw while one is. The #3177 probe never had an open handle, so
0x809200ffin that state is a guess. PPSA10594 calls this afterscePadInitand beforescePadOpen, so it still gets past the stop with that change.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T11:28:34Z.
I updated #5676 on current
mainin commitsc268ba50e,e5fe01dccand46c0de1b7. The export keeps the firmware-measured statuses before init and after init with no open controller, and throws while a controller handle is open because that state remains unmeasured. The focused test now covers all three states, and the generic “not implemented” export test no longer treats this measured export as a stub. Both targets build on Linux; conventions andgit diff --checkpass. CTest could not reach the assertions on this Xeon E5-1620 v2 because it lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA. The PR description records this limitation.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T19:43:56Z.
The latest head (
46c0de1b) includes the requested state split: it returns the firmware-measured values before init and after init with no open handle, and throws while a controller handle is open.GuestPad.cppnow asserts all three states, including the measured post-init/no-handle state. The current hosted eligibility, conventions, and report checks pass. I rebuilt both focused targets locally, but CTest still aborts before reaching assertions on this Xeon E5-1620 v2 because the host lacks the required LZCNT, BMI1/2, MOVBE, AVX2, and FMA features. @nikowolf123 provided a 10/10 Linux runtime run of the same behavioral split on the preceding head; I have not rerun CTest on this final head locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:41:40Z.
Rebased onto current
main2fab88d10as heade35c62c84. I preserved main’s libSceNet debt updates, kept the Pad-specific evidence inlibScePad.md, and removed the oldguest_ppsa01530_exportscheck because it treated this now-measured export as an unimplemented stub. The existingguest_padregression now owns the before-init, after-init/no-handle, and open-controller assertions. Conventions andgit diff --checkpass. The local test run is still limited by this host’s CPU-feature guard; the body now distinguishes the earlier local build/runtime evidence from this rebased head.