feat(libSceNpManager): answer the PS4 account and presence queries for a signed-out user #8110
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8110"
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 savvaniss on 2026-10-19T22:04:24Z.
What
PS4 titles call the
libSceNpManageraccount queries that take an online id, and the user check that maps an online id to a user.mainhas theAforms (by user id) but not these, so a PS4 title that imports them does not load, and one that calls them stops. Risk from CUSA03312 (Hasbro Family Fun Pack) callssceNpGetAccountCountryright after its title screen. The UnityNpToolkit plugin of Trivial Pursuit Live! (same disc) importssceNpGetAccountId,sceNpSetGamePresenceOnlineandsceNpUnregisterPlusEventCallback, so the module does not load without them.They now follow the existing signed-out model:
sceNpGetAccountCountry,sceNpGetAccountDateOfBirth,sceNpGetAccountLanguageandsceNpGetParentalControlInforeturnSCE_NP_ERROR_INVALID_ARGUMENTfor a null pointer. Otherwise they returnSCE_NP_ERROR_USER_NOT_FOUND, since no signed-in user can own the online id;sceNpCheckNpAvailabilityanswers the same way.sceNpGetUserIdByOnlineIdreturnsSCE_NP_ERROR_SIGNED_OUT, likesceNpGetUserIdByAccountId.sceNpCheckPlusreturnsSCE_NP_ERROR_SIGNED_OUT, likesceNpCheckPremium.sceNpGetAccountId(the PS4 form taking an online id) returnsSCE_NP_ERROR_INVALID_ARGUMENTfor a null pointer, otherwiseSCE_NP_ERROR_SIGNED_OUT, likesceNpGetAccountIdA.sceNpSetGamePresenceOnline(req_id, online_id, presence), shadPS4's form, returnsSCE_NP_ERROR_INVALID_ARGUMENTfor request id 0 or a null online id, otherwiseSCE_NP_ERROR_SIGNED_OUT.sceNpUnregisterPlusEventCallbackreturns 0, likesceNpUnregisterPremiumEventCallback:sceNpRegisterPlusEventCallbackkeeps no callback.sceNpNotifyPlusFeatureis declared and throws: what the console does with its parameter is unknown.The signatures and argument checks follow shadPS4's
np_manager.cpp. No output is written. The debt file records each one.Tested
Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release.
guest_np_managercovers each new function: every null argument, the error otherwise, untouched outputs, and the throw fromsceNpNotifyPlusFeature. It passes, and so doesguest_np_reachability.Trivial Pursuit Live! (CUSA03312): its UnityNpToolkit plugin stopped loading at
unresolved ELF import xViqJdDgKl0(sceNpUnregisterPlusEventCallback); with the three functions every import resolves and the title reaches its language menu and title screen through the PS4 path of #6977.Risk (CUSA03312): run through the PS4 path of #6977 with the same functions in its
libSceNpManager, on an RX 9070 XT. It gets past its title screen and the queries that follow it, then plays a local match against the AI.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pylists #6044, #6977, #6990 and #7412 as touching these files; none of them adds these functions.21 Oct: after review,
sceNpSetGamePresenceOnlinetakes(req_id, online_id, presence).guest_np_managerchecks request id 0 and a null online id. With the old body, which ignored its arguments, it fails with "must reject request id 0". With the change, it passes onmainb77bd5880with this branch merged.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T22:04:58Z.
Progress report (
3e91c8e→79a5d6b)📈 System libraries: 48.82% (+0.04%, +9 implemented, +1 declared functions)
✅ 9 implemented
sceNpCheckPlussceNpGetAccountCountrysceNpGetAccountDateOfBirthsceNpGetAccountIdsceNpGetAccountLanguagesceNpGetParentalControlInfosceNpGetUserIdByOnlineIdsceNpSetGamePresenceOnlinesceNpUnregisterPlusEventCallback⚪ 1 behaviourally empty (constant return or throw)
sceNpUnregisterPlusEventCallback🆕 1 declared as stubs
sceNpNotifyPlusFeatureImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T22:18:05Z.
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/tests/GuestNpManager.cppcore/libs/prx/libSceNpManager/Export.cppdocs/dev/debt/libSceNpManager.mdcore/libs/prx/libSceNpManager/Export.cppImported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T20:40:53Z.
sceNpSetGamePresenceOnlineis declared as(int user_id, uint32_t timeout)(Export.cpp L169), and the debt entry says this signature follows shadPS4 81be949. shadPS4 has no such signature. It declaressceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence)and returnsINVALID_ARGUMENTforreq_id == 0 || online_id == nullptr(np_manager.cpp L1092-L1096). The other shadPS4 commits this debt file cites have the same function. Orbital's type database, which the file already cites forsceNpSetTimeout, also puts the request id first:sceNpSetGamePresenceOnlineA(int reqId, SceUserServiceUserId userId, uint32_t timeout, void *pReserved)(db_types.json L1576).The stub ignores its arguments, so
sceNpSetGamePresenceOnline(1, nullptr, 0, nullptr)andsceNpSetGamePresenceOnline(0, &onlineId, 0, nullptr)both returnSCE_NP_ERROR_SIGNED_OUT(0x80550006). The cited source returnsSCE_NP_ERROR_INVALID_ARGUMENT(0x80550003) for both, and this PR applies the same rule tosceNpCheckPlusand the online-id queries. The test declares and calls the same two-argument form (GuestNpManager.cpp L23, L248). #8500 declares the A form as(int req_id, int user_id, uint32_t presence), so if both PRs merge, the A form and this one would disagree on the first parameter.I'd keep the signed-out result and add the source's checks:
The test would then check
(1, &onlineId, 0, nullptr) == SignedOut,(1, nullptr, 0, nullptr) == InvalidArgumentand(0, &onlineId, 0, nullptr) == InvalidArgument. The debt entry would name this signature and its sources: the request id, the online id and the null check from shadPS4 L1092, and the timeout and reserved pointer from orbital's A form. Its sentence "a null online id returnsINVALID_ARGUMENT" would then be true for both functions.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T00:41:45Z.
@savvaniss Thanks. Nine of the ten exports check out against the reference. One needs a change before merge (it's the point nikowolf123 raised):
sceNpSetGamePresenceOnlineis declared here as(int user_id, uint32_t timeout), and the debt entry cites shadPS4 81be949 for it. That commit (np_manager.cpp, around lines 1092-1096) hassceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence), and returnsINVALID_ARGUMENTwhenreq_idis 0 oronline_idis null. With the wrong parameter list, a real caller's arguments land in the wrong registers, and the citation doesn't support the declared form.Could you:
(int req_id, const OrbisNpOnlineId* online_id, uint32_t presence), following the reference (and keep the first parameter a request id, as in #8500's form),INVALID_ARGUMENTforreq_id == 0and for a nullonline_id, with a test case for each,The rest (account id / user id by online id, the account-info calls,
NotifyPlusFeaturethrowing,UnregisterPlusEventCallbackreturning 0) looks right.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-21T07:08:19Z.
@oneandonlydean @nikowolf123 thank you, you're right: the signature I cited was not in shadPS4. Fixed in
44dfebb52:sceNpSetGamePresenceOnline(int req_id, const NpOnlineId* online_id, uint32_t presence), as shadPS4 81be949 declares it (np_manager.cppL1092-L1096). The first parameter is a request id, as in #8500's A form.SCE_NP_ERROR_INVALID_ARGUMENTfor request id 0 or a null online id, and otherwiseSCE_NP_ERROR_SIGNED_OUT.guest_np_managerchecks(1, &onlineId, 0)== signed out,(0, &onlineId, 0)== invalid argument and(1, nullptr, 0)== invalid argument. With the old body, which ignored its arguments, it fails with "must reject request id 0". With the change, it passes on Windows, with this branch merged ontomainb77bd5880.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T07:11:55Z.
The signature and the argument check now match shadPS4. One more piece comes from the same function: after the argument check, shadPS4 looks up the request and returns
REQUEST_NOT_FOUND(0x80550014) for one that was never created or was already deleted (np_manager.cpp L1098-L1104). This library already tracks live requests (liveRequests, whichsceNpSetTimeoutuses), so the check fits here:sceNpSetGamePresenceOnline(1, &onlineId, 0)in the test passes request id 1, which the test never creates. It would then need asceNpCreateRequest()first, plus a check that an unknown or deleted id givesRequestNotFound, like thesceNpSetTimeoutchecks at GuestNpManager.cpp L190-L212.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T07:24:45Z.
@savvaniss thanks, the signature and the argument checks now match shadPS4 81be949, and the new checks fail on the old body. nikowolf123's last point checks out too: in shadPS4
c1b2655(np_manager.cppL1098-L1104),sceNpSetGamePresenceOnlinereturnsREQUEST_NOT_FOUND(0x80550014) for a request that was never created or was already deleted, and this branch already tracksliveRequests(assceNpSetTimeoutuses). Please add that lookup after the argument check, and inguest_np_managercreate a request first, so(created, &onlineId, 0)gives signed out and(1, &onlineId, 0)gives request not found.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-21T11:14:19Z.
@oneandonlydean @nikowolf123 added in
79a5d6b65. After the argument checks,sceNpSetGamePresenceOnlinelooks the request up inliveRequestsand returnsSCE_NP_ERROR_REQUEST_NOT_FOUNDfor one that was never created or was deleted, as shadPS4c1b2655does (L1098-L1104).guest_np_managernow creates a request first:(created, &onlineId, 0)gives signed out.(0, &onlineId, 0)and(created, nullptr, 0)give invalid argument.(0x7fffffff, &onlineId, 0), a request never created, gives request not found.sceNpDeleteRequest,(created, &onlineId, 0)also gives request not found.Without the lookup the test fails with "must reject a request that was never created"; with it, it passes, with the branch merged onto
main3e91c8edf. The debt entry names the new error and links those shadPS4 lines.AI-assisted: yes (Claude Code)