feat(libSceNpManager): answer the user ID account queries for a signed-out user #9144
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9144"
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 rooklz on 2026-10-21T13:28:12Z.
What
Implements six of the pending libSceNpManager exports for the only state AnyPS5 has, a user with no PSN account signed in:
sceNpCheckNpAvailabilityA(8Z2Jc5GvGDI),sceNpGetAccountLanguageA(TPMbgIxvog0),sceNpGetParentalControlInfoA(m9L3O6yst-U),sceNpGetAccountDateOfBirthA(q3M7XzBKC3s),sceNpGetGamePresenceStatus(IPb1hd1wAGc) andsceNpGetGamePresenceStatusA(oPO9U42YpgI). Until now they were no-parameter declarations that threw. The signed-in behaviour is not implemented.Signatures:
sceNpCheckNpAvailabilityA(int reqId, int userId),sceNpGetAccountLanguageA(int reqId, int userId, void* language),sceNpGetParentalControlInfoA(int reqId, int userId, int8_t* age, void* info),sceNpGetAccountDateOfBirthA(int userId, void* dateOfBirth)andsceNpGetGamePresenceStatusA(int userId, uint32_t* status). Orbital (L1445, L1469-L1476), shadPS4 and fpPS4 agree on these five.sceNpGetGamePresenceStatus(const NpOnlineId* onlineId, uint32_t* status)comes from shadPS4 and fpPS4 only. Orbital does not list it.enum *status, fpPS4PInteger), so it is a 4-byte write, typeduint32_tlikesceNpGetNpReachabilityState. The account outputs stayvoid*because nothing is written to them. That also sidesteps a layout disagreement:SceNpDateis 4 bytes in shadPS4 and 8 in fpPS4 (an extra_pad: DWord).Behaviour, from shadPS4's signed-out path at c2814041 (L211-L227, L295-L313, L327-L346, L519-L533, L535-L559):
USER_SERVICE_USER_ID_INVALID) returnsSCE_NP_ERROR_INVALID_ARGUMENT(0x80550003). shadPS4 tests both in one condition, so their order can't be observed.GetRequest(L145-L169). Request id 0 isINVALID_ARGUMENT, and a request that was never created or was deleted isREQUEST_NOT_FOUND.sceNpSetGamePresenceOnlinealready does this with the sameliveRequestsset, so I added a small helper next toAddRequest.SCE_NP_ERROR_SIGNED_OUTand write nothing.OFFLINE(0) and return 0. shadPS4 and fpPS4 (L318-L332) agree on this. fpPS4 doesn't check the online id for a null pointer. shadPS4 does, and so do the other online-id functions here, so I check it too.How this fits the existing functions:
sceNpGetAccountCountryA,sceNpGetAccountLanguage2andsceNpGetOnlineId, which returnSIGNED_OUTfor every user. The presence queries matchsceNpGetNpReachabilityState, which writesUNAVAILABLEand returns 0.SIGNED_OUT, as it does fromsceNpGetAccountCountryA. shadPS4'ssceNpGetAccountDateOfBirthAreturnsUSER_NOT_FOUNDfor a user its user manager doesn't know (L525-L527), and so does itssceNpGetAccountCountryA. Here,sceNpGetAccountCountryAdoesn't do that, so I kept the two date and country queries consistent. This is recorded in the debt entry.CompleteRequest(L172-L180) returns 0 for an async request and leavesSIGNED_OUTtosceNpPollAsync. It also refuses a request that was already used. Here, an async request getsSIGNED_OUTdirectly from the call, assceNpSetGamePresenceOnlinegives it. This is recorded in the debt entry.Where the sources disagree: fpPS4 returns made-up account data with 0. It reports language
en(L196-L201), age 18 with no restrictions (L485-L501) and a birth date of 1990-01-01 (L560-L569). It also returns 0 fromsceNpCheckNpAvailabilityA, withSIGNED_OUTcommented out (L454-L458). shadPS4 fills profile values only when a user is signed in to its shadNet, and otherwise returnsSIGNED_OUT. I follow shadPS4's signed-out path. AnyPS5 never has a signed-in account, the rest of this library already reportsSIGNED_OUT, and returning a language or a birth date that no account holds would mean inventing values.Left out:
sceNpIsPlusMember(Ybu6AxV6S0o) keeps throwing. shadPS4 is the only source with a signature for it,(user_id, bool* result)(L1159-L1168). Orbital, fpPS4 and KytyPS5 don't have it. shadPS4 writes "not a member" and returns 0 without checking sign-in, which doesn't fitsceNpCheckPlushere, since that returnsSIGNED_OUT. I can't tell whether a signed-out console answersSIGNED_OUTor "not a member", so I left it as it is.Title evidence: the bring-up thread for inFAMOUS Second Son (CUSA00223, #8214) lists two of these among its absent imports: "libSceNpManager (3):
sceNpCheckNpAvailabilityA(8Z2Jc5GvGDI),sceNpRegisterGamePresenceCallbackA(KswxLxk4c1Y),sceNpGetGamePresenceStatusA(oPO9U42YpgI)". This is a PS4 title on the #6977 path, and it still has 47 absent libSceGnmDriver imports, so I left Unblocks at none.sceNpRegisterGamePresenceCallbackAis not part of this PR.Debt (
docs/dev/debt/libSceNpManager.md): I cut the pending-exports entry from 150 to 144 and added a Functional entry. It states the gap first: no signed-in behaviour, the shadPS4USER_NOT_FOUNDdifference, and async requests.Overlap: I searched the open PRs for each name and NID. #6977 only mentions two of them in its body and doesn't implement them. #9085, #6990 and #9137 change other functions in the same files. I replaced the stubs in place and kept the test in its own function and declaration block.
git merge-treeof this branch with #9085, #9137 and #6990 is clean, and it adds no conflict to #6977, #7412 or #6044.Tested
Ubuntu 24.04 x86-64 in Docker (Rosetta on an Apple Silicon Mac), GCC 13.3, Release,
-DBUILD_TESTING=ON. I built onlyguest_np_manager_testsandguest_np_reachability_tests, and bothguest_np_managerandguest_np_reachabilitypass.The new
CheckUserIdQueriesinguest_np_managerchecks that:SIGNED_OUTfrom the four account queries andOFFLINEwith 0 fromsceNpGetGamePresenceStatusA, and an online id getsOFFLINEfromsceNpGetGamePresenceStatus;INVALID_ARGUMENT;INVALID_ARGUMENT, and a request that was never created or was deleted returnsREQUEST_NOT_FOUND;With main's
Export.cppand the new test,guest_np_manageraborts withterminate called after throwing an instance of 'std::runtime_error' what(): sceNpCheckNpAvailabilityA not implemented. With this change it passes.tools/check_conventions.py --base origin/mainpasses.tools/progress.py --module libSceNpManagergoes from 41/197 to 47/197, and none of the six count as behaviourally empty.Not verified: none of this is measured on a console, and I didn't run a title. CUSA00223 stops on missing imports before it can reach these calls.
Hosted runs on my fork (GitHub runners), this branch
1ad02f332and its base27bcd6a29:net_dontwait_blocking_*tests fail on both.agc_driver_sgpr_pattern_fill_keysfailed on one side only; it is intermittent under parallel ctest (#8708).guest_np_managerandguest_np_reachabilitypass (2/2; 2/2 on the base).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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T13:29:12Z.
Progress report (
8b3e398→f0e63df)📈 System libraries: 43.28% (+0.05%, +6 implemented functions)
✅ 6 implemented
sceNpCheckNpAvailabilityAsceNpGetAccountDateOfBirthAsceNpGetAccountLanguageAsceNpGetGamePresenceStatussceNpGetGamePresenceStatusAsceNpGetParentalControlInfoAImported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T13:34:01Z.
Rebased onto current
main(8b3e39832a): headf0e63df885, same diff. The only conflict was the pending-exports count indocs/dev/debt/libSceNpManager.md:mainnow says 149, this PR implements 6 of them, so it reads 143 (the stub count inExport.cppgoes from 162 to 156).