feat(libSceNpManager): answer the PS4 account and presence queries for a signed-out user #8110

Merged
savvaniss merged 5 commits from upstream-pr/8110 into main 2026-10-21 12:54:32 +00:00
savvaniss commented 2026-10-19 22:04:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T22:04:24Z.


What

PS4 titles call the libSceNpManager account queries that take an online id, and the user check that maps an online id to a user. main has the A forms (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) calls sceNpGetAccountCountry right after its title screen. The UnityNpToolkit plugin of Trivial Pursuit Live! (same disc) imports sceNpGetAccountId, sceNpSetGamePresenceOnline and sceNpUnregisterPlusEventCallback, so the module does not load without them.

They now follow the existing signed-out model:

  • sceNpGetAccountCountry, sceNpGetAccountDateOfBirth, sceNpGetAccountLanguage and sceNpGetParentalControlInfo return SCE_NP_ERROR_INVALID_ARGUMENT for a null pointer. Otherwise they return SCE_NP_ERROR_USER_NOT_FOUND, since no signed-in user can own the online id; sceNpCheckNpAvailability answers the same way.
  • sceNpGetUserIdByOnlineId returns SCE_NP_ERROR_SIGNED_OUT, like sceNpGetUserIdByAccountId.
  • sceNpCheckPlus returns SCE_NP_ERROR_SIGNED_OUT, like sceNpCheckPremium.
  • sceNpGetAccountId (the PS4 form taking an online id) returns SCE_NP_ERROR_INVALID_ARGUMENT for a null pointer, otherwise SCE_NP_ERROR_SIGNED_OUT, like sceNpGetAccountIdA. sceNpSetGamePresenceOnline(req_id, online_id, presence), shadPS4's form, returns SCE_NP_ERROR_INVALID_ARGUMENT for request id 0 or a null online id, otherwise SCE_NP_ERROR_SIGNED_OUT.
  • sceNpUnregisterPlusEventCallback returns 0, like sceNpUnregisterPremiumEventCallback: sceNpRegisterPlusEventCallback keeps no callback.
  • sceNpNotifyPlusFeature is 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_manager covers each new function: every null argument, the error otherwise, untouched outputs, and the throw from sceNpNotifyPlusFeature. It passes, and so does guest_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/main passes. tools/pr_overlap.py lists #6044, #6977, #6990 and #7412 as touching these files; none of them adds these functions.

  • 21 Oct: after review, sceNpSetGamePresenceOnline takes (req_id, online_id, presence). guest_np_manager checks 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 on main b77bd5880 with this branch merged.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: CUSA03312 #7198
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4928038552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T22:04:24Z. --- ### What PS4 titles call the `libSceNpManager` account queries that take an online id, and the user check that maps an online id to a user. `main` has the `A` forms (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) calls `sceNpGetAccountCountry` right after its title screen. The UnityNpToolkit plugin of Trivial Pursuit Live! (same disc) imports `sceNpGetAccountId`, `sceNpSetGamePresenceOnline` and `sceNpUnregisterPlusEventCallback`, so the module does not load without them. They now follow the existing signed-out model: - `sceNpGetAccountCountry`, `sceNpGetAccountDateOfBirth`, `sceNpGetAccountLanguage` and `sceNpGetParentalControlInfo` return `SCE_NP_ERROR_INVALID_ARGUMENT` for a null pointer. Otherwise they return `SCE_NP_ERROR_USER_NOT_FOUND`, since no signed-in user can own the online id; `sceNpCheckNpAvailability` answers the same way. - `sceNpGetUserIdByOnlineId` returns `SCE_NP_ERROR_SIGNED_OUT`, like `sceNpGetUserIdByAccountId`. - `sceNpCheckPlus` returns `SCE_NP_ERROR_SIGNED_OUT`, like `sceNpCheckPremium`. - `sceNpGetAccountId` (the PS4 form taking an online id) returns `SCE_NP_ERROR_INVALID_ARGUMENT` for a null pointer, otherwise `SCE_NP_ERROR_SIGNED_OUT`, like `sceNpGetAccountIdA`. `sceNpSetGamePresenceOnline(req_id, online_id, presence)`, shadPS4's form, returns `SCE_NP_ERROR_INVALID_ARGUMENT` for request id 0 or a null online id, otherwise `SCE_NP_ERROR_SIGNED_OUT`. - `sceNpUnregisterPlusEventCallback` returns 0, like `sceNpUnregisterPremiumEventCallback`: `sceNpRegisterPlusEventCallback` keeps no callback. - `sceNpNotifyPlusFeature` is 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_manager` covers each new function: every null argument, the error otherwise, untouched outputs, and the throw from `sceNpNotifyPlusFeature`. It passes, and so does `guest_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/main` passes. `tools/pr_overlap.py` lists #6044, #6977, #6990 and #7412 as touching these files; none of them adds these functions. - 21 Oct: after review, `sceNpSetGamePresenceOnline` takes `(req_id, online_id, presence)`. `guest_np_manager` checks 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 on `main` `b77bd5880` with this branch merged. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: CUSA03312 #7198 - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 22:04:58 +00:00 (Migrated from github.com)

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
Library Name
libSceNpManager sceNpCheckPlus
libSceNpManager sceNpGetAccountCountry
libSceNpManager sceNpGetAccountDateOfBirth
libSceNpManager sceNpGetAccountId
libSceNpManager sceNpGetAccountLanguage
libSceNpManager sceNpGetParentalControlInfo
libSceNpManager sceNpGetUserIdByOnlineId
libSceNpManager sceNpSetGamePresenceOnline
libSceNpManager sceNpUnregisterPlusEventCallback
⚪ 1 behaviourally empty (constant return or throw)
Library Name
libSceNpManager sceNpUnregisterPlusEventCallback
🆕 1 declared as stubs
Library Name
libSceNpManager sceNpNotifyPlusFeature
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6278401082 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6278401082). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T22:04:58Z. --- <!-- progress-report --> ### Progress report (3e91c8e → 79a5d6b) 📈 **System libraries**: 48.82% (+0.04%, +9 implemented, +1 declared functions) <details> <summary>✅ 9 implemented</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpCheckPlus` | | libSceNpManager | `sceNpGetAccountCountry` | | libSceNpManager | `sceNpGetAccountDateOfBirth` | | libSceNpManager | `sceNpGetAccountId` | | libSceNpManager | `sceNpGetAccountLanguage` | | libSceNpManager | `sceNpGetParentalControlInfo` | | libSceNpManager | `sceNpGetUserIdByOnlineId` | | libSceNpManager | `sceNpSetGamePresenceOnline` | | libSceNpManager | `sceNpUnregisterPlusEventCallback` | </details> <details> <summary>⚪ 1 behaviourally empty (constant return or throw)</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpUnregisterPlusEventCallback` | </details> <details> <summary>🆕 1 declared as stubs</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpNotifyPlusFeature` | </details>
github-actions[bot] commented 2026-10-19 22:18:05 +00:00 (Migrated from github.com)

Imported 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.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestNpManager.cpp
PR 6977 core/libs/prx/libSceNpManager/Export.cpp
docs/dev/debt/libSceNpManager.md
PR 7412 core/libs/prx/libSceNpManager/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6278602091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6278602091). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T22:18:05Z. --- <!-- pr-overlap --> 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 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestNpManager.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceNpManager/Export.cpp`<br>`docs/dev/debt/libSceNpManager.md` | | [PR 7412](https://www.github.com/boykopovar/AnyPS5/pull/7412) | `core/libs/prx/libSceNpManager/Export.cpp` |
nikowolf123 commented 2026-10-20 20:40:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T20:40:53Z.


sceNpSetGamePresenceOnline is 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 declares sceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence) and returns INVALID_ARGUMENT for req_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 for sceNpSetTimeout, 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) and sceNpSetGamePresenceOnline(0, &onlineId, 0, nullptr) both return SCE_NP_ERROR_SIGNED_OUT (0x80550006). The cited source returns SCE_NP_ERROR_INVALID_ARGUMENT (0x80550003) for both, and this PR applies the same rule to sceNpCheckPlus and 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:

int APS5_VABI sceNpSetGamePresenceOnline(int req_id, const NpOnlineId* online_id, uint32_t timeout, void* reserved) {
    (void)timeout;
    (void)reserved;
    if (req_id == 0 || !online_id) return SCE_NP_ERROR_INVALID_ARGUMENT;
    return SCE_NP_ERROR_SIGNED_OUT;
}

The test would then check (1, &onlineId, 0, nullptr) == SignedOut, (1, nullptr, 0, nullptr) == InvalidArgument and (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 returns INVALID_ARGUMENT" would then be true for both functions.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301002930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6301002930). Originally posted by [nikowolf123](https://github.com/nikowolf123) on 2026-10-20T20:40:53Z. --- `sceNpSetGamePresenceOnline` is declared as `(int user_id, uint32_t timeout)` ([Export.cpp L169](https://github.com/boykopovar/AnyPS5/blob/dc642205a5068b75927bec53576af4cbfddcb4a1/core/libs/prx/libSceNpManager/Export.cpp#L169)), and the [debt entry](https://github.com/boykopovar/AnyPS5/blob/dc642205a5068b75927bec53576af4cbfddcb4a1/docs/dev/debt/libSceNpManager.md#L21) says this signature follows shadPS4 81be949. shadPS4 has no such signature. It declares `sceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence)` and returns `INVALID_ARGUMENT` for `req_id == 0 || online_id == nullptr` ([np_manager.cpp L1092-L1096](https://github.com/shadps4-emu/shadPS4/blob/81be949167d0060b08f26dc3e055a0b640d129c8/src/core/libraries/np/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 for `sceNpSetTimeout`, also puts the request id first: `sceNpSetGamePresenceOnlineA(int reqId, SceUserServiceUserId userId, uint32_t timeout, void *pReserved)` ([db_types.json L1576](https://github.com/AlexAltea/orbital/blob/b321fcdbd700cc02da1cb1ad25412781d5ec73c6/tools/ida/db_types.json#L1576)). The stub ignores its arguments, so `sceNpSetGamePresenceOnline(1, nullptr, 0, nullptr)` and `sceNpSetGamePresenceOnline(0, &onlineId, 0, nullptr)` both return `SCE_NP_ERROR_SIGNED_OUT` (0x80550006). The cited source returns `SCE_NP_ERROR_INVALID_ARGUMENT` (0x80550003) for both, and this PR applies the same rule to `sceNpCheckPlus` and the online-id queries. The test declares and calls the same two-argument form ([GuestNpManager.cpp L23](https://github.com/boykopovar/AnyPS5/blob/dc642205a5068b75927bec53576af4cbfddcb4a1/core/libs/tests/GuestNpManager.cpp#L23), [L248](https://github.com/boykopovar/AnyPS5/blob/dc642205a5068b75927bec53576af4cbfddcb4a1/core/libs/tests/GuestNpManager.cpp#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: ```cpp int APS5_VABI sceNpSetGamePresenceOnline(int req_id, const NpOnlineId* online_id, uint32_t timeout, void* reserved) { (void)timeout; (void)reserved; if (req_id == 0 || !online_id) return SCE_NP_ERROR_INVALID_ARGUMENT; return SCE_NP_ERROR_SIGNED_OUT; } ``` The test would then check `(1, &onlineId, 0, nullptr) == SignedOut`, `(1, nullptr, 0, nullptr) == InvalidArgument` and `(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 returns `INVALID_ARGUMENT`" would then be true for both functions.
oneandonlydean commented 2026-10-21 00:41:45 +00:00 (Migrated from github.com)

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):

sceNpSetGamePresenceOnline is 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) has sceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence), and returns INVALID_ARGUMENT when req_id is 0 or online_id is 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:

  • declare it as (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),
  • return INVALID_ARGUMENT for req_id == 0 and for a null online_id, with a test case for each,
  • and correct the debt entry to match?

The rest (account id / user id by online id, the account-info calls, NotifyPlusFeature throwing, UnregisterPlusEventCallback returning 0) looks right.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305101225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6305101225). Originally posted by [oneandonlydean](https://github.com/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): `sceNpSetGamePresenceOnline` is 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) has `sceNpSetGamePresenceOnline(s32 req_id, const OrbisNpOnlineId* online_id, u32 presence)`, and returns `INVALID_ARGUMENT` when `req_id` is 0 or `online_id` is 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: - declare it as `(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), - return `INVALID_ARGUMENT` for `req_id == 0` and for a null `online_id`, with a test case for each, - and correct the debt entry to match? The rest (account id / user id by online id, the account-info calls, `NotifyPlusFeature` throwing, `UnregisterPlusEventCallback` returning 0) looks right.
savvaniss commented 2026-10-21 07:08:19 +00:00 (Migrated from github.com)

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.cpp L1092-L1096). The first parameter is a request id, as in #8500's A form.
  • It returns SCE_NP_ERROR_INVALID_ARGUMENT for request id 0 or a null online id, and otherwise SCE_NP_ERROR_SIGNED_OUT.
  • guest_np_manager checks (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 onto main b77bd5880.
  • The debt entry now names this signature and links those lines.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310214959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6310214959). Originally posted by [savvaniss](https://github.com/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.cpp` L1092-L1096). The first parameter is a request id, as in #8500's A form. - It returns `SCE_NP_ERROR_INVALID_ARGUMENT` for request id 0 or a null online id, and otherwise `SCE_NP_ERROR_SIGNED_OUT`. - `guest_np_manager` checks `(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 onto `main` `b77bd5880`. - The debt entry now names this signature and links those lines. AI-assisted: yes (Claude Code)
nikowolf123 commented 2026-10-21 07:11:55 +00:00 (Migrated from github.com)

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, which sceNpSetTimeout uses), so the check fits here:

    if (req_id == 0 || !online_id) return SCE_NP_ERROR_INVALID_ARGUMENT;
    {
        std::lock_guard lock(requestMutex);
        if (!liveRequests.count(req_id)) return SCE_NP_ERROR_REQUEST_NOT_FOUND;
    }
    return SCE_NP_ERROR_SIGNED_OUT;

sceNpSetGamePresenceOnline(1, &onlineId, 0) in the test passes request id 1, which the test never creates. It would then need a sceNpCreateRequest() first, plus a check that an unknown or deleted id gives RequestNotFound, like the sceNpSetTimeout checks at GuestNpManager.cpp L190-L212.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310272599 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6310272599). Originally posted by [nikowolf123](https://github.com/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](https://github.com/shadps4-emu/shadPS4/blob/c1b26558352b863f80142256e4df38585aa7d727/src/core/libraries/np/np_manager.cpp#L1098-L1104)). This library already tracks live requests (`liveRequests`, which `sceNpSetTimeout` uses), so the check fits here: ```cpp if (req_id == 0 || !online_id) return SCE_NP_ERROR_INVALID_ARGUMENT; { std::lock_guard lock(requestMutex); if (!liveRequests.count(req_id)) return SCE_NP_ERROR_REQUEST_NOT_FOUND; } return SCE_NP_ERROR_SIGNED_OUT; ``` `sceNpSetGamePresenceOnline(1, &onlineId, 0)` in the test passes request id 1, which the test never creates. It would then need a `sceNpCreateRequest()` first, plus a check that an unknown or deleted id gives `RequestNotFound`, like the `sceNpSetTimeout` checks at [GuestNpManager.cpp L190-L212](https://github.com/boykopovar/AnyPS5/blob/44dfebb524c3397e4ad1019f0056e45323e5de70/core/libs/tests/GuestNpManager.cpp#L190-L212).
oneandonlydean commented 2026-10-21 07:24:45 +00:00 (Migrated from github.com)

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.cpp L1098-L1104), sceNpSetGamePresenceOnline returns REQUEST_NOT_FOUND (0x80550014) for a request that was never created or was already deleted, and this branch already tracks liveRequests (as sceNpSetTimeout uses). Please add that lookup after the argument check, and in guest_np_manager create a request first, so (created, &onlineId, 0) gives signed out and (1, &onlineId, 0) gives request not found.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310480767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6310480767). Originally posted by [oneandonlydean](https://github.com/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.cpp` L1098-L1104), `sceNpSetGamePresenceOnline` returns `REQUEST_NOT_FOUND` (`0x80550014`) for a request that was never created or was already deleted, and this branch already tracks `liveRequests` (as `sceNpSetTimeout` uses). Please add that lookup after the argument check, and in `guest_np_manager` create a request first, so `(created, &onlineId, 0)` gives signed out and `(1, &onlineId, 0)` gives request not found.
savvaniss commented 2026-10-21 11:14:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-21T11:14:19Z.


@oneandonlydean @nikowolf123 added in 79a5d6b65. After the argument checks, sceNpSetGamePresenceOnline looks the request up in liveRequests and returns SCE_NP_ERROR_REQUEST_NOT_FOUND for one that was never created or was deleted, as shadPS4 c1b2655 does (L1098-L1104).

guest_np_manager now 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.
  • After 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 main 3e91c8edf. The debt entry names the new error and links those shadPS4 lines.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6314549363 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8110#issuecomment-6314549363). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-21T11:14:19Z. --- @oneandonlydean @nikowolf123 added in `79a5d6b65`. After the argument checks, `sceNpSetGamePresenceOnline` looks the request up in `liveRequests` and returns `SCE_NP_ERROR_REQUEST_NOT_FOUND` for one that was never created or was deleted, as shadPS4 `c1b2655` does (L1098-L1104). `guest_np_manager` now 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. - After `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 `main` `3e91c8edf`. The debt entry names the new error and links those shadPS4 lines. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8110
No description provided.