feat(libSceNpSignaling): model contexts and connections offline #9886
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9886"
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 MarrasFederico on 2026-10-22T20:37:06Z.
What
All eight libSceNpSignaling exports threw. They now follow shadPS4's np_signaling.cpp offline, the way #9009 modelled libSceNpTus:
sceNpSignalingInitializeisALREADY_INITIALIZED; every other call before it, andsceNpSignalingTerminatetwice, isNOT_INITIALIZED, checked before any argument. Terminating releases the contexts.sceNpSignalingCreateContextrefuses a null NpId or output and an NpId whose online ID breaks the rule shadPS4'sNormalizeNpIdapplies (term0, 3 to 16 characters, the first an ASCII letter or digit, then ASCII letters, digits,_or-; checked byte by byte, so the host locale does not change it) withINVALID_ARGUMENT. Ids 1 to 8 are handed out round-robin as inAllocateContextIdLocked; a ninth context isCTXID_NOT_AVAILABLE.sceNpSignalingDeleteContextsucceeds for any id, as shadPS4's does.sceNpSignalingSetContextOptiontakes option 1 with value 0 or 1, after the context check.sceNpSignalingActivateConnectionruns shadPS4's checks up toOWN_NP_ID(the context's own NpId, fromActivateSig1) and returnsSCE_NP_ERROR_SIGNED_OUTwithout writing a connection id. No connection exists, sosceNpSignalingTerminateConnectionandsceNpSignalingGetConnectionInfoanswerCONN_NOT_FOUNDafter their context checks and write nothing.Left out: shadPS4's heap and thread start in
Initialize(its arguments are not checked), its app-type checks and its activation rate limit. Nothing here is measured on a PS5; the new debt file says so. Callbacks are never called.#9896 adds a
sceNpSignalingDeactivateConnectiondeclaration to thisExport.cppand creates the same debt file; theExport.cppchanges merge cleanly, and whichever lands second keeps both debt entries.Tested
Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with
BUILD_TESTING=ON. Windows was not compiled. No title was run.guest_np_signaling_offline(core/libs/tests/GuestNpSignalingOffline.cpp):NOT_INITIALIZEDbefore initialization (ahead of null arguments), double initialization, each NpId rule (2 characters, leading_,., a byte outside ASCII, unterminated, 16 characters and upper case with digits accepted), ids 1 to 8 with a freed id skipped until the allocation wraps, the ninth context, the option checks and their order,OWN_NP_ID,SIGNED_OUTwith no id written, the connection calls writing nothing, deleting an unknown context, and termination releasing contexts and restarting ids at 1.main(sceNpSignalingCreateContext not implemented) and passes with this change. 14 mutations of the new code (check order in three calls, each NpId rule including upper case, round-robin allocation,OWN_NP_ID, the flag values, deleting an unknown context, both parts of the termination reset) each fail it.tools/check_conventions.py --base upstream/mainpasses;tools/pr_overlap.pyreports no overlap.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)