feat(libSceNpAuth): implement offline auth requests #3604

Merged
itsbo5 merged 1 commit from upstream-pr/3604 into main 2026-10-12 20:38:23 +00:00
itsbo5 commented 2026-10-11 14:09:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T14:09:50Z.


What

Implement sceNpAuthCreateRequest, sceNpAuthGetIdTokenV3, and sceNpAuthWaitAsync offline stubs in libSceNpAuth. Add guest test covering sequential request ID generation, parameter validation, and offline signed-out returns. Document unverified request tracking behavior in TechnicalDebt.md.

Tested

Verified guest tests in core/libs/tests/GuestNpAuth.cpp.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819661385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604). Originally posted by [itsbo5](https://github.com/itsbo5) on 2026-10-11T14:09:50Z. --- ### What Implement `sceNpAuthCreateRequest`, `sceNpAuthGetIdTokenV3`, and `sceNpAuthWaitAsync` offline stubs in `libSceNpAuth`. Add guest test covering sequential request ID generation, parameter validation, and offline signed-out returns. Document unverified request tracking behavior in `TechnicalDebt.md`. ### Tested Verified guest tests in `core/libs/tests/GuestNpAuth.cpp`. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-11 14:10:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:10:15Z.


Progress report (27873b0 → 62d1275)

📈 System libraries: 87.15% (+0.08%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceNpAuth sceNpAuthCreateRequest
libSceNpAuth sceNpAuthGetIdTokenV3
libSceNpAuth sceNpAuthWaitAsync
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109892247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6109892247). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T14:10:15Z. --- <!-- progress-report --> ### Progress report (27873b0 → 62d1275) 📈 **System libraries**: 87.15% (+0.08%, +3 implemented functions) <details> <summary>✅ 3 implemented</summary> | Library | Name | | - | - | | libSceNpAuth | `sceNpAuthCreateRequest` | | libSceNpAuth | `sceNpAuthGetIdTokenV3` | | libSceNpAuth | `sceNpAuthWaitAsync` | </details>
adriadam10 commented 2026-10-11 14:12:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T14:12:57Z.

Review: CHANGES_REQUESTED


Thanks for the PR. The offline behaviour (incrementing request ids, SCE_NP_ERROR_SIGNED_OUT for tokens) matches shadPS4/KytyPS5. A few things before it can merge:

  • The PR template is empty (What, Tested, Checklist), which is why conventions fails. Please fill it in, including what you ran.
  • No test. Please add a guest test registered in ctest covering CreateRequest (distinct ids), GetIdTokenV3 (null param/id_token → INVALID_ARGUMENT, otherwise SIGNED_OUT) and WaitAsync.
  • core/libs/prx/libSceNpAuth/Export.cpp:25-57: the diff re-indents untouched functions (DeleteRequest, GetAuthorizationCodeV3, PollAsync) and the file now mixes 1- and 4-space indentation. Please match the file's style and keep only the changed lines.
  • Export.cpp:54: WaitAsync accepts any req_id and a null result. shadPS4 returns INVALID_ARGUMENT for a null result and REQUEST_NOT_FOUND for an unknown id. Either do the same or add a line in docs/dev/TechnicalDebt.md ("Unknown function info") saying ids are not tracked and req_id is not validated (same for Poll/Delete).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483620198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#pullrequestreview-5483620198). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T14:12:57Z. **Review:** CHANGES_REQUESTED --- Thanks for the PR. The offline behaviour (incrementing request ids, `SCE_NP_ERROR_SIGNED_OUT` for tokens) matches shadPS4/KytyPS5. A few things before it can merge: - The PR template is empty (`What`, `Tested`, `Checklist`), which is why `conventions` fails. Please fill it in, including what you ran. - No test. Please add a guest test registered in ctest covering `CreateRequest` (distinct ids), `GetIdTokenV3` (null `param`/`id_token` → `INVALID_ARGUMENT`, otherwise `SIGNED_OUT`) and `WaitAsync`. - `core/libs/prx/libSceNpAuth/Export.cpp:25-57`: the diff re-indents untouched functions (`DeleteRequest`, `GetAuthorizationCodeV3`, `PollAsync`) and the file now mixes 1- and 4-space indentation. Please match the file's style and keep only the changed lines. - `Export.cpp:54`: `WaitAsync` accepts any `req_id` and a null `result`. shadPS4 returns `INVALID_ARGUMENT` for a null `result` and `REQUEST_NOT_FOUND` for an unknown id. Either do the same or add a line in `docs/dev/TechnicalDebt.md` ("Unknown function info") saying ids are not tracked and `req_id` is not validated (same for `Poll`/`Delete`).
itsbo5 commented 2026-10-11 14:40:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T14:40:36Z.


updated

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110163059 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6110163059). Originally posted by [itsbo5](https://github.com/itsbo5) on 2026-10-11T14:40:36Z. --- updated
blawesom commented 2026-10-11 15:20:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:09Z.


Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 833/833 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110521076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6110521076). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T15:20:09Z. --- Independent pre-review on **Linux** (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Builds; `tools/check_conventions.py --base origin/main` passes. - Full suite: **833/833 passed** (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
xXPBSXx commented 2026-10-11 15:50:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:50:18Z.


Tested together with the Ces branch for Teardown (PPSA15246): with this PR the title no longer throws at sceNpAuthGetIdTokenV3 and goes on to the graphics start-up (details in #3701).

One point to check against the reference: shadPS4's GetIdToken (np_auth.cpp) distinguishes the request kind when signed out. For an async request (created with sceNpAuthCreateAsyncRequest) the call returns ORBIS_OK and stores the signed-out error in the request result, which sceNpAuthPollAsync/sceNpAuthWaitAsync return later; only for a synchronous request does the call itself return SCE_NP_ERROR_SIGNED_OUT. This PR returns signed-out from sceNpAuthGetIdTokenV3 for every request id and does not record the kind of the request. Teardown did not trip over it in a 60 s run, and I have not checked which request kind it uses, so this is a note on fidelity, not a failure.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110796635 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6110796635). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T15:50:18Z. --- Tested together with the Ces branch for Teardown (PPSA15246): with this PR the title no longer throws at `sceNpAuthGetIdTokenV3` and goes on to the graphics start-up (details in #3701). One point to check against the reference: shadPS4's `GetIdToken` ([np_auth.cpp](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp)) distinguishes the request kind when signed out. For an async request (created with `sceNpAuthCreateAsyncRequest`) the call returns `ORBIS_OK` and stores the signed-out error in the request result, which `sceNpAuthPollAsync`/`sceNpAuthWaitAsync` return later; only for a synchronous request does the call itself return `SCE_NP_ERROR_SIGNED_OUT`. This PR returns signed-out from `sceNpAuthGetIdTokenV3` for every request id and does not record the kind of the request. Teardown did not trip over it in a 60 s run, and I have not checked which request kind it uses, so this is a note on fidelity, not a failure. AI-assisted (Claude Code).
itsbo5 commented 2026-10-11 16:18:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T16:18:53Z.


Tested together with the Ces branch for Teardown (PPSA15246): with this PR the title no longer throws at sceNpAuthGetIdTokenV3 and goes on to the graphics start-up (details in #3701).

One point to check against the reference: shadPS4's GetIdToken (np_auth.cpp) distinguishes the request kind when signed out. For an async request (created with sceNpAuthCreateAsyncRequest) the call returns ORBIS_OK and stores the signed-out error in the request result, which sceNpAuthPollAsync/sceNpAuthWaitAsync return later; only for a synchronous request does the call itself return SCE_NP_ERROR_SIGNED_OUT. This PR returns signed-out from sceNpAuthGetIdTokenV3 for every request id and does not record the kind of the request. Teardown did not trip over it in a 60 s run, and I have not checked which request kind it uses, so this is a note on fidelity, not a failure.

AI-assisted (Claude Code).

Thanks for testing with Teardown and verifying the graphics startup progress!

Regarding the request kinds: the Technical Debt entry currently documents that request IDs are atomic counters and are not tracked offline. As titles exercise more of the asynchronous auth flow, we can follow up with full request state tracking (distinguishing sync vs async) in a dedicated PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111063717 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6111063717). Originally posted by [itsbo5](https://github.com/itsbo5) on 2026-10-11T16:18:53Z. --- > Tested together with the Ces branch for Teardown (PPSA15246): with this PR the title no longer throws at `sceNpAuthGetIdTokenV3` and goes on to the graphics start-up (details in #3701). > > One point to check against the reference: shadPS4's `GetIdToken` ([np_auth.cpp](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp)) distinguishes the request kind when signed out. For an async request (created with `sceNpAuthCreateAsyncRequest`) the call returns `ORBIS_OK` and stores the signed-out error in the request result, which `sceNpAuthPollAsync`/`sceNpAuthWaitAsync` return later; only for a synchronous request does the call itself return `SCE_NP_ERROR_SIGNED_OUT`. This PR returns signed-out from `sceNpAuthGetIdTokenV3` for every request id and does not record the kind of the request. Teardown did not trip over it in a 60 s run, and I have not checked which request kind it uses, so this is a note on fidelity, not a failure. > > AI-assisted (Claude Code). Thanks for testing with Teardown and verifying the graphics startup progress! Regarding the request kinds: the Technical Debt entry currently documents that request IDs are atomic counters and are not tracked offline. As titles exercise more of the asynchronous auth flow, we can follow up with full request state tracking (distinguishing sync vs async) in a dedicated PR.
adriadam10 commented 2026-10-11 16:29:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T16:29:41Z.

Review: CHANGES_REQUESTED


Thanks, the offline path is a good start and the new guest_np_auth test fails without the change. One thing before it can merge:

  • core/libs/prx/libSceNpAuth/Export.cpp:43-44 (sceNpAuthGetIdTokenV3) returns SCE_NP_ERROR_SIGNED_OUT for every request id. As @xXPBSXx pointed out, shadPS4 (np_auth.cpp, GetIdToken with CreateNpAuthRequest(async)) treats the two request kinds differently: for a request from sceNpAuthCreateAsyncRequest the call returns OK and the signed-out error is stored in the request, then returned by sceNpAuthPollAsync/sceNpAuthWaitAsync; only a request from sceNpAuthCreateRequest gets the error from the call itself. Right now main throws here, so returning a plausible result that differs for async requests is the case we avoid (exact or throw).
    What would fix it: keep a small mutex-protected table req_id -> {async, result} filled by the two Create* functions; GetIdTokenV3/GetAuthorizationCodeV3 return OK and store SCE_NP_ERROR_SIGNED_OUT for async requests, Poll/Wait return the stored result, and add test rows for both kinds. Unknown ids need either a reference or a line under "Unknown function info" (shadPS4 returns REQUEST_NOT_FOUND, but it is PS4).
  • Then update the docs/dev/TechnicalDebt.md:70 entry, which currently says requests are not tracked.

Checked: build and ctest of the PR merged onto main, and the negative run of the test. Note that shadPS4 is a PS4 reference; if you have anything from PS5, cite it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5484053880 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#pullrequestreview-5484053880). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T16:29:41Z. **Review:** CHANGES_REQUESTED --- Thanks, the offline path is a good start and the new `guest_np_auth` test fails without the change. One thing before it can merge: - `core/libs/prx/libSceNpAuth/Export.cpp:43-44` (`sceNpAuthGetIdTokenV3`) returns `SCE_NP_ERROR_SIGNED_OUT` for every request id. As @xXPBSXx pointed out, shadPS4 ([np_auth.cpp](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp), `GetIdToken` with `CreateNpAuthRequest(async)`) treats the two request kinds differently: for a request from `sceNpAuthCreateAsyncRequest` the call returns OK and the signed-out error is stored in the request, then returned by `sceNpAuthPollAsync`/`sceNpAuthWaitAsync`; only a request from `sceNpAuthCreateRequest` gets the error from the call itself. Right now `main` throws here, so returning a plausible result that differs for async requests is the case we avoid (exact or throw). What would fix it: keep a small mutex-protected table `req_id -> {async, result}` filled by the two `Create*` functions; `GetIdTokenV3`/`GetAuthorizationCodeV3` return OK and store `SCE_NP_ERROR_SIGNED_OUT` for async requests, `Poll`/`Wait` return the stored result, and add test rows for both kinds. Unknown ids need either a reference or a line under "Unknown function info" (shadPS4 returns `REQUEST_NOT_FOUND`, but it is PS4). - Then update the `docs/dev/TechnicalDebt.md:70` entry, which currently says requests are not tracked. Checked: build and ctest of the PR merged onto `main`, and the negative run of the test. Note that shadPS4 is a PS4 reference; if you have anything from PS5, cite it.
itsbo5 commented 2026-10-11 17:07:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T17:07:16Z.


Thanks, the offline path is a good start and the new guest_np_auth test fails without the change. One thing before it can merge:

  • core/libs/prx/libSceNpAuth/Export.cpp:43-44 (sceNpAuthGetIdTokenV3) returns SCE_NP_ERROR_SIGNED_OUT for every request id. As @xXPBSXx pointed out, shadPS4 (np_auth.cpp, GetIdToken with CreateNpAuthRequest(async)) treats the two request kinds differently: for a request from sceNpAuthCreateAsyncRequest the call returns OK and the signed-out error is stored in the request, then returned by sceNpAuthPollAsync/sceNpAuthWaitAsync; only a request from sceNpAuthCreateRequest gets the error from the call itself. Right now main throws here, so returning a plausible result that differs for async requests is the case we avoid (exact or throw).
    What would fix it: keep a small mutex-protected table req_id -> {async, result} filled by the two Create* functions; GetIdTokenV3/GetAuthorizationCodeV3 return OK and store SCE_NP_ERROR_SIGNED_OUT for async requests, Poll/Wait return the stored result, and add test rows for both kinds. Unknown ids need either a reference or a line under "Unknown function info" (shadPS4 returns REQUEST_NOT_FOUND, but it is PS4).
  • Then update the docs/dev/TechnicalDebt.md:70 entry, which currently says requests are not tracked.

Checked: build and ctest of the PR merged onto main, and the negative run of the test. Note that shadPS4 is a PS4 reference; if you have anything from PS5, cite it.

Updated to track requests following shadPS4 (np_auth.cpp):

  • Added a mutex-protected table tracking request kinds (async vs sync) and results.
  • sceNpAuthGetIdTokenV3 and sceNpAuthGetAuthorizationCodeV3 now return 0 for async requests while deferring SCE_NP_ERROR_SIGNED_OUT to PollAsync/WaitAsync, and return SCE_NP_ERROR_SIGNED_OUT directly for synchronous requests.
  • Unknown or deleted request IDs return SCE_NP_ERROR_REQUEST_NOT_FOUND (0x80550014), documented under Unknown function info in docs/dev/TechnicalDebt.md.
  • Expanded GuestNpAuth with test rows for both request kinds, unknown IDs, and deleted IDs.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111514658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6111514658). Originally posted by [itsbo5](https://github.com/itsbo5) on 2026-10-11T17:07:16Z. --- > Thanks, the offline path is a good start and the new `guest_np_auth` test fails without the change. One thing before it can merge: > > * `core/libs/prx/libSceNpAuth/Export.cpp:43-44` (`sceNpAuthGetIdTokenV3`) returns `SCE_NP_ERROR_SIGNED_OUT` for every request id. As @xXPBSXx pointed out, shadPS4 ([np_auth.cpp](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp), `GetIdToken` with `CreateNpAuthRequest(async)`) treats the two request kinds differently: for a request from `sceNpAuthCreateAsyncRequest` the call returns OK and the signed-out error is stored in the request, then returned by `sceNpAuthPollAsync`/`sceNpAuthWaitAsync`; only a request from `sceNpAuthCreateRequest` gets the error from the call itself. Right now `main` throws here, so returning a plausible result that differs for async requests is the case we avoid (exact or throw). > What would fix it: keep a small mutex-protected table `req_id -> {async, result}` filled by the two `Create*` functions; `GetIdTokenV3`/`GetAuthorizationCodeV3` return OK and store `SCE_NP_ERROR_SIGNED_OUT` for async requests, `Poll`/`Wait` return the stored result, and add test rows for both kinds. Unknown ids need either a reference or a line under "Unknown function info" (shadPS4 returns `REQUEST_NOT_FOUND`, but it is PS4). > * Then update the `docs/dev/TechnicalDebt.md:70` entry, which currently says requests are not tracked. > > Checked: build and ctest of the PR merged onto `main`, and the negative run of the test. Note that shadPS4 is a PS4 reference; if you have anything from PS5, cite it. Updated to track requests following shadPS4 (`np_auth.cpp`): - Added a mutex-protected table tracking request kinds (`async` vs `sync`) and results. - `sceNpAuthGetIdTokenV3` and `sceNpAuthGetAuthorizationCodeV3` now return `0` for async requests while deferring `SCE_NP_ERROR_SIGNED_OUT` to `PollAsync`/`WaitAsync`, and return `SCE_NP_ERROR_SIGNED_OUT` directly for synchronous requests. - Unknown or deleted request IDs return `SCE_NP_ERROR_REQUEST_NOT_FOUND` (`0x80550014`), documented under `Unknown function info` in `docs/dev/TechnicalDebt.md`. - Expanded `GuestNpAuth` with test rows for both request kinds, unknown IDs, and deleted IDs.
adriadam10 commented 2026-10-11 17:45:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T17:45:28Z.

Review: CHANGES_REQUESTED


Thanks for the update; the sync/async table is what was needed. Checked: build and ctest of the PR merged onto main (guest_np_auth passes). Remaining points, all against the same shadPS4 np_auth.cpp the TechnicalDebt line cites:

  • core/libs/prx/libSceNpAuth/Export.cpp:11: 0x80550014 is the generic ORBIS_NP_ERROR_REQUEST_NOT_FOUND. shadPS4's auth functions return ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND = 0x80550306 (np_error.h). Please use that in the code, the test (GuestNpAuth.cpp:26) and docs/dev/TechnicalDebt.md:70, whose "follow shadPS4" is otherwise not true.
  • Export.cpp:90-95 and :82-86 (WaitAsync/PollAsync): shadPS4 returns ORBIS_NP_AUTH_ERROR_INVALID_ID (0x80550307) when the request is not async, or when it is async but GetIdToken/GetAuthorizationCode has not been called on it yet (state Ready). Here a sync request (and an unprocessed async one) returns OK with the stored result. Please track that state (e.g. a processed flag set by the Get* calls) and update the test rows (GuestNpAuth.cpp:72-76 currently pin the sync case as OK).
  • Once GetIdTokenV3/GetAuthorizationCodeV3 ran on a request, shadPS4 returns INVALID_ARGUMENT on a second call (state Complete). If you don't model that, list it under the TechnicalDebt entry.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5484288151 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#pullrequestreview-5484288151). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T17:45:28Z. **Review:** CHANGES_REQUESTED --- Thanks for the update; the sync/async table is what was needed. Checked: build and ctest of the PR merged onto `main` (`guest_np_auth` passes). Remaining points, all against the same shadPS4 `np_auth.cpp` the TechnicalDebt line cites: - `core/libs/prx/libSceNpAuth/Export.cpp:11`: `0x80550014` is the generic `ORBIS_NP_ERROR_REQUEST_NOT_FOUND`. shadPS4's auth functions return `ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND` = `0x80550306` (`np_error.h`). Please use that in the code, the test (`GuestNpAuth.cpp:26`) and `docs/dev/TechnicalDebt.md:70`, whose "follow shadPS4" is otherwise not true. - `Export.cpp:90-95` and `:82-86` (`WaitAsync`/`PollAsync`): shadPS4 returns `ORBIS_NP_AUTH_ERROR_INVALID_ID` (`0x80550307`) when the request is not async, or when it is async but `GetIdToken`/`GetAuthorizationCode` has not been called on it yet (state `Ready`). Here a sync request (and an unprocessed async one) returns OK with the stored result. Please track that state (e.g. a `processed` flag set by the Get* calls) and update the test rows (`GuestNpAuth.cpp:72-76` currently pin the sync case as OK). - Once `GetIdTokenV3`/`GetAuthorizationCodeV3` ran on a request, shadPS4 returns `INVALID_ARGUMENT` on a second call (state `Complete`). If you don't model that, list it under the TechnicalDebt entry.
itsbo5 commented 2026-10-11 17:57:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T17:57:03Z.


Thanks for the update; the sync/async table is what was needed. Checked: build and ctest of the PR merged onto main (guest_np_auth passes). Remaining points, all against the same shadPS4 np_auth.cpp the TechnicalDebt line cites:

  • core/libs/prx/libSceNpAuth/Export.cpp:11: 0x80550014 is the generic ORBIS_NP_ERROR_REQUEST_NOT_FOUND. shadPS4's auth functions return ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND = 0x80550306 (np_error.h). Please use that in the code, the test (GuestNpAuth.cpp:26) and docs/dev/TechnicalDebt.md:70, whose "follow shadPS4" is otherwise not true.
  • Export.cpp:90-95 and :82-86 (WaitAsync/PollAsync): shadPS4 returns ORBIS_NP_AUTH_ERROR_INVALID_ID (0x80550307) when the request is not async, or when it is async but GetIdToken/GetAuthorizationCode has not been called on it yet (state Ready). Here a sync request (and an unprocessed async one) returns OK with the stored result. Please track that state (e.g. a processed flag set by the Get* calls) and update the test rows (GuestNpAuth.cpp:72-76 currently pin the sync case as OK).
  • Once GetIdTokenV3/GetAuthorizationCodeV3 ran on a request, shadPS4 returns INVALID_ARGUMENT on a second call (state Complete). If you don't model that, list it under the TechnicalDebt entry.

updated

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111966337 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6111966337). Originally posted by [itsbo5](https://github.com/itsbo5) on 2026-10-11T17:57:03Z. --- > Thanks for the update; the sync/async table is what was needed. Checked: build and ctest of the PR merged onto `main` (`guest_np_auth` passes). Remaining points, all against the same shadPS4 `np_auth.cpp` the TechnicalDebt line cites: > > * `core/libs/prx/libSceNpAuth/Export.cpp:11`: `0x80550014` is the generic `ORBIS_NP_ERROR_REQUEST_NOT_FOUND`. shadPS4's auth functions return `ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND` = `0x80550306` (`np_error.h`). Please use that in the code, the test (`GuestNpAuth.cpp:26`) and `docs/dev/TechnicalDebt.md:70`, whose "follow shadPS4" is otherwise not true. > * `Export.cpp:90-95` and `:82-86` (`WaitAsync`/`PollAsync`): shadPS4 returns `ORBIS_NP_AUTH_ERROR_INVALID_ID` (`0x80550307`) when the request is not async, or when it is async but `GetIdToken`/`GetAuthorizationCode` has not been called on it yet (state `Ready`). Here a sync request (and an unprocessed async one) returns OK with the stored result. Please track that state (e.g. a `processed` flag set by the Get* calls) and update the test rows (`GuestNpAuth.cpp:72-76` currently pin the sync case as OK). > * Once `GetIdTokenV3`/`GetAuthorizationCodeV3` ran on a request, shadPS4 returns `INVALID_ARGUMENT` on a second call (state `Complete`). If you don't model that, list it under the TechnicalDebt entry. updated
xXPBSXx commented 2026-10-11 22:50:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T22:50:26Z.


Rebase needed: merged into current main (bb48d60fc), this PR conflicts in core/libs/CMakeLists.txt (its guest_np_auth_tests block sits next to a block added on main; TechnicalDebt.md conflicts too).

Test from Teardown (PPSA15246), Windows, 60 s runs: with this PR the title passes sceNpAuthGetIdTokenV3 and goes on to savedata and graphics start-up (details in #3701); without it the call throws.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114783560 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6114783560). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T22:50:26Z. --- Rebase needed: merged into current `main` (`bb48d60fc`), this PR conflicts in `core/libs/CMakeLists.txt` (its `guest_np_auth_tests` block sits next to a block added on `main`; `TechnicalDebt.md` conflicts too). Test from Teardown (PPSA15246), Windows, 60 s runs: with this PR the title passes `sceNpAuthGetIdTokenV3` and goes on to savedata and graphics start-up (details in #3701); without it the call throws. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-12 05:39:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T05:39:23Z.


Review notes, comparing the code with the shadPS4 source this PR's TechnicalDebt entry cites (np_auth.cpp and np_error.h, read at current main). I did not run these; they are differences between this diff and that reference, not console measurements.

  1. Error code for invalid arguments. The entry says SCE_NP_ERROR_INVALID_ARGUMENT on repeated calls "follows shadPS4". In shadPS4 GetIdToken/GetAuthorizationCode return ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT (0x80550301) for a null param or output pointer, for a request that is already Complete, and sceNpAuthWaitAsync does so for a null result. This diff returns SCE_NP_ERROR_INVALID_ARGUMENT (0x80550003) in all of those places (sceNpAuthGetIdTokenV3, sceNpAuthGetAuthorizationCodeV3, sceNpAuthWaitAsync), and core/libs/tests/GuestNpAuth.cpp pins invalidArgument = 0x80550003. Either use 0x80550301 or say in the entry that it deliberately differs.
  2. No parameter size check. shadPS4 returns ORBIS_NP_AUTH_ERROR_INVALID_SIZE (0x80550302) when param->size is not the structure size, before the request lookup. This diff reads neither param field, so a wrong size is accepted. The structure layouts are not in this PR, so adding it needs them; if that is the reason, the entry should list it as not checked.
  3. sceNpAuthAbortRequest is unchanged and ignores state. In shadPS4 it returns ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND for an unknown id and marks a not-yet-processed request aborted, so the next Get* returns ORBIS_NP_AUTH_ERROR_ABORTED (0x80550304). Here it still returns 0 for any id, and the test calls sceNpAuthAbortRequest(asyncReq) on a request that has completed. Not required for PPSA15246, but the entry describes request tracking as following shadPS4.
  4. Unbounded table. g_requests only shrinks in sceNpAuthDeleteRequest; a title that creates requests without deleting them grows it without limit (shadPS4 has ORBIS_NP_AUTH_ERROR_REQUEST_MAX, 0x80550305). Minor.

Also: the branch conflicts with main (docs/dev/TechnicalDebt.md and core/libs/CMakeLists.txt are the likely places) and needs a rebase.

For context, PPSA15246 stops at sceNpAuthGetIdTokenV3 not implemented on main, so the PR is what that title needs; the points above are about matching the cited reference.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118443576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6118443576). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T05:39:23Z. --- Review notes, comparing the code with the shadPS4 source this PR's TechnicalDebt entry cites ([`np_auth.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp) and `np_error.h`, read at current `main`). I did not run these; they are differences between this diff and that reference, not console measurements. 1. **Error code for invalid arguments.** The entry says `SCE_NP_ERROR_INVALID_ARGUMENT` on repeated calls "follows shadPS4". In shadPS4 `GetIdToken`/`GetAuthorizationCode` return `ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT` (`0x80550301`) for a null `param` or output pointer, for a request that is already `Complete`, and `sceNpAuthWaitAsync` does so for a null `result`. This diff returns `SCE_NP_ERROR_INVALID_ARGUMENT` (`0x80550003`) in all of those places (`sceNpAuthGetIdTokenV3`, `sceNpAuthGetAuthorizationCodeV3`, `sceNpAuthWaitAsync`), and `core/libs/tests/GuestNpAuth.cpp` pins `invalidArgument = 0x80550003`. Either use `0x80550301` or say in the entry that it deliberately differs. 2. **No parameter size check.** shadPS4 returns `ORBIS_NP_AUTH_ERROR_INVALID_SIZE` (`0x80550302`) when `param->size` is not the structure size, before the request lookup. This diff reads neither `param` field, so a wrong `size` is accepted. The structure layouts are not in this PR, so adding it needs them; if that is the reason, the entry should list it as not checked. 3. **`sceNpAuthAbortRequest` is unchanged and ignores state.** In shadPS4 it returns `ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND` for an unknown id and marks a not-yet-processed request aborted, so the next `Get*` returns `ORBIS_NP_AUTH_ERROR_ABORTED` (`0x80550304`). Here it still returns 0 for any id, and the test calls `sceNpAuthAbortRequest(asyncReq)` on a request that has completed. Not required for PPSA15246, but the entry describes request tracking as following shadPS4. 4. **Unbounded table.** `g_requests` only shrinks in `sceNpAuthDeleteRequest`; a title that creates requests without deleting them grows it without limit (shadPS4 has `ORBIS_NP_AUTH_ERROR_REQUEST_MAX`, `0x80550305`). Minor. Also: the branch conflicts with `main` (docs/dev/TechnicalDebt.md and `core/libs/CMakeLists.txt` are the likely places) and needs a rebase. For context, PPSA15246 stops at `sceNpAuthGetIdTokenV3 not implemented` on `main`, so the PR is what that title needs; the points above are about matching the cited reference. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-12 08:23:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:23:44Z.


Conflicts with main in core/libs/CMakeLists.txt and docs/dev/TechnicalDebt.md; please rebase. One more from the same shadPS4 source: its auth functions return ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT (0x80550301) for null pointers and for a second Get* call, not 0x80550003 (Export.cpp:9, GuestNpAuth.cpp:24). The three points from the last review are done.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120513530 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6120513530). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T08:23:44Z. --- Conflicts with main in `core/libs/CMakeLists.txt` and `docs/dev/TechnicalDebt.md`; please rebase. One more from the same shadPS4 source: its auth functions return `ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT` (`0x80550301`) for null pointers and for a second `Get*` call, not `0x80550003` (`Export.cpp:9`, `GuestNpAuth.cpp:24`). The three points from the last review are done.
Mouad-Scriptz-0 commented 2026-10-12 08:58:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T08:58:04Z.


#4218 overlapped this PR with a simpler signed-out model for sceNpAuthCreateRequest, sceNpAuthGetIdTokenV3 and sceNpAuthWaitAsync; it is now cut down to sceNpAuthGetAuthorizedAppCode only (a stub from #4118 that Minecraft PPSA17221 calls after its sign-in dialog), so the request model stays here. Minecraft reaches its menu with the signed-out answers to the same three calls, in case that helps as a second title for this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121020482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6121020482). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-12T08:58:04Z. --- #4218 overlapped this PR with a simpler signed-out model for `sceNpAuthCreateRequest`, `sceNpAuthGetIdTokenV3` and `sceNpAuthWaitAsync`; it is now cut down to `sceNpAuthGetAuthorizedAppCode` only (a stub from #4118 that Minecraft PPSA17221 calls after its sign-in dialog), so the request model stays here. Minecraft reaches its menu with the signed-out answers to the same three calls, in case that helps as a second title for this PR.
Pacuka commented 2026-10-12 16:18:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-10-12T16:18:33Z.


Data point from Minecraft (PPSA17221), Linux / RX 6650 XT (RADV), on main d592d54e1 + #4215 #4218 #454 #3633: opening Settings from the main menu aborts with sceNpAuthCreateRequest not implemented (called from the game, through libSceNpAuth.prx). With this PR applied, Settings opens and the game continues. The merge into current main conflicted only in docs/dev/TechnicalDebt.md and in the test registration in core/libs/CMakeLists.txt; Export.cpp merged cleanly next to #4218.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128189231 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#issuecomment-6128189231). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-10-12T16:18:33Z. --- Data point from Minecraft (PPSA17221), Linux / RX 6650 XT (RADV), on main `d592d54e1` + #4215 #4218 #454 #3633: opening Settings from the main menu aborts with `sceNpAuthCreateRequest not implemented` (called from the game, through `libSceNpAuth.prx`). With this PR applied, Settings opens and the game continues. The merge into current main conflicted only in `docs/dev/TechnicalDebt.md` and in the test registration in `core/libs/CMakeLists.txt`; `Export.cpp` merged cleanly next to #4218.
adriadam10 commented 2026-10-12 20:37:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:37:25Z.

Review: APPROVED


Thanks, and thanks @xXPBSXx, @oneandonlydean and @Pacuka for the review and the Teardown/Minecraft runs. Checked: build and ctest of the rebased branch (87/87 in core/libs), and guest_np_auth fails without the change. I rebased onto main (the debt entries now live in docs/dev/debt/) and added these on top, so merging:

  • Export.cpp: invalid-argument errors now use ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT (0x80550301), as in shadPS4 np_error.h, in the code, the test and the debt entry.
  • sceNpAuthAbortRequest follows shadPS4: unknown id returns REQUEST_NOT_FOUND, an abort before processing makes the next Get* return ORBIS_NP_AUTH_ERROR_ABORTED (0x80550304), an abort after completion is ignored. Test rows added.
  • docs/dev/debt/libSceNpAuth.md: entry moved there and extended with what is not modelled (INVALID_SIZE checks, REQUEST_MAX).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5495715071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3604#pullrequestreview-5495715071). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T20:37:25Z. **Review:** APPROVED --- Thanks, and thanks @xXPBSXx, @oneandonlydean and @Pacuka for the review and the Teardown/Minecraft runs. Checked: build and ctest of the rebased branch (87/87 in `core/libs`), and `guest_np_auth` fails without the change. I rebased onto `main` (the debt entries now live in `docs/dev/debt/`) and added these on top, so merging: - `Export.cpp`: invalid-argument errors now use `ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT` (`0x80550301`), as in shadPS4 `np_error.h`, in the code, the test and the debt entry. - `sceNpAuthAbortRequest` follows shadPS4: unknown id returns `REQUEST_NOT_FOUND`, an abort before processing makes the next `Get*` return `ORBIS_NP_AUTH_ERROR_ABORTED` (`0x80550304`), an abort after completion is ignored. Test rows added. - `docs/dev/debt/libSceNpAuth.md`: entry moved there and extended with what is not modelled (`INVALID_SIZE` checks, `REQUEST_MAX`).
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!3604
No description provided.