feat(libSceNpAuth): implement the remaining signed-out request calls #925

Closed
Adin-bima wants to merge 1 commit from upstream-pr/925 into main
Adin-bima commented 2026-10-06 17:20:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Adin-bima on 2026-10-06T17:20:39Z.


What

Implements the last three libSceNpAuth stubs on the existing signed-out model of the library:

  • sceNpAuthCreateRequest returns a new request id from the same counter as sceNpAuthCreateAsyncRequest.
  • sceNpAuthGetIdTokenV3 returns SCE_NP_ERROR_INVALID_ARGUMENT for a null parameter or token, else SCE_NP_ERROR_SIGNED_OUT with the token untouched, as sceNpAuthGetAuthorizationCodeV3 does.
  • sceNpAuthWaitAsync answers as sceNpAuthPollAsync: finished, with SCE_NP_ERROR_SIGNED_OUT as the result.

prosper gives the same answers (a fresh id, SIGNED_OUT). shadPS4 also reports SIGNED_OUT when not signed in, but tracks request state (unknown ids, async completion) and uses the NpAuth-specific invalid-argument code; that tracking is not modelled here, matching the existing calls of this library.

libSceNpAuth gets its own CMakeLists.txt (same shape as libSceNpSessionSignaling) to register the new guest_np_auth test.

Tested

Linux (GCC), new guest_np_auth test: distinct positive request ids, signed-out and invalid-argument answers of sceNpAuthGetIdTokenV3 with the token unchanged, the sceNpAuthWaitAsync result. Full ctest: 358/360 passed; agc_driver_lds_atomics64 and agc_driver_scalar_sop1 fail the same way on unmodified main on this machine (RTX 5070 Ti). Not tested with a title.

Checklist

  • Based on current main; no other open PR implements the same functions — #346 (opened earlier) implements the same functions; this is offered as a replacement if #346 is not continued
  • 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:4762269250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/925). Originally posted by [Adin-bima](https://github.com/Adin-bima) on 2026-10-06T17:20:39Z. --- ### What Implements the last three libSceNpAuth stubs on the existing signed-out model of the library: - `sceNpAuthCreateRequest` returns a new request id from the same counter as `sceNpAuthCreateAsyncRequest`. - `sceNpAuthGetIdTokenV3` returns `SCE_NP_ERROR_INVALID_ARGUMENT` for a null parameter or token, else `SCE_NP_ERROR_SIGNED_OUT` with the token untouched, as `sceNpAuthGetAuthorizationCodeV3` does. - `sceNpAuthWaitAsync` answers as `sceNpAuthPollAsync`: finished, with `SCE_NP_ERROR_SIGNED_OUT` as the result. [prosper](https://github.com/mattias800/prosper/blob/main/prosper/src/hle/np/np.cpp) gives the same answers (a fresh id, `SIGNED_OUT`). [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp) also reports `SIGNED_OUT` when not signed in, but tracks request state (unknown ids, async completion) and uses the NpAuth-specific invalid-argument code; that tracking is not modelled here, matching the existing calls of this library. libSceNpAuth gets its own `CMakeLists.txt` (same shape as libSceNpSessionSignaling) to register the new `guest_np_auth` test. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. --> Linux (GCC), new `guest_np_auth` test: distinct positive request ids, signed-out and invalid-argument answers of `sceNpAuthGetIdTokenV3` with the token unchanged, the `sceNpAuthWaitAsync` result. Full `ctest`: 358/360 passed; `agc_driver_lds_atomics64` and `agc_driver_scalar_sop1` fail the same way on unmodified `main` on this machine (RTX 5070 Ti). Not tested with a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [ ] Based on current `main`; no other open PR implements the same functions — #346 (opened earlier) implements the same functions; this is offered as a replacement if #346 is not continued - [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
adriadam10 commented 2026-10-07 20:33:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T20:33:10Z.

Review: CHANGES_REQUESTED


Built and ran it merged onto current main: full ctest green, and guest_np_auth fails with Export.cpp reverted, so the test does exercise the change. A few things don't match the references (KytyPS5 libNet.cpp, shadPS4 np_auth.cpp, fpPS4 np_error.pas):

  • sceNpAuthWaitAsync with a null result (Export.cpp:54, pinned by GuestNpAuth.cpp:43): KytyPS5 (np_auth_wait_or_poll_async) and shadPS4 both return SCE_NP_AUTH_ERROR_INVALID_ARGUMENT (0x80550301), not 0. Since WaitAsync delegates to sceNpAuthPollAsync, the null check belongs there and fixes both.
  • sceNpAuthGetIdTokenV3 with a null param/id_token (Export.cpp:43, test lines 38-39) returns the generic NP code 0x80550003. shadPS4 returns the NpAuth code 0x80550301, and fpPS4 has the same constant. GetAuthorizationCodeV3 on main has the same mismatch; switching both would keep them consistent.
  • GuestNpAuth.cpp:42 waits on first, which comes from the synchronous sceNpAuthCreateRequest. Both references return SCE_NP_AUTH_ERROR_INVALID_ID (0x80550307) for a non-async request, so the test currently pins behaviour they reject. Please wait on the id from sceNpAuthCreateAsyncRequest instead.
  • Request tracking (unknown ids, sync vs async, aborted) isn't modelled. That's fine, but it needs a line in docs/dev/TechnicalDebt.md saying so, and the line shouldn't go at the end of its section.

Also, no CI ran on this head. Please push the fixes so the fork CI runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5448002116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/925#pullrequestreview-5448002116). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T20:33:10Z. **Review:** CHANGES_REQUESTED --- Built and ran it merged onto current `main`: full ctest green, and `guest_np_auth` fails with `Export.cpp` reverted, so the test does exercise the change. A few things don't match the references (KytyPS5 `libNet.cpp`, shadPS4 `np_auth.cpp`, fpPS4 `np_error.pas`): - `sceNpAuthWaitAsync` with a null `result` (`Export.cpp:54`, pinned by `GuestNpAuth.cpp:43`): KytyPS5 (`np_auth_wait_or_poll_async`) and shadPS4 both return `SCE_NP_AUTH_ERROR_INVALID_ARGUMENT` (`0x80550301`), not 0. Since `WaitAsync` delegates to `sceNpAuthPollAsync`, the null check belongs there and fixes both. - `sceNpAuthGetIdTokenV3` with a null `param`/`id_token` (`Export.cpp:43`, test lines 38-39) returns the generic NP code `0x80550003`. shadPS4 returns the NpAuth code `0x80550301`, and fpPS4 has the same constant. `GetAuthorizationCodeV3` on `main` has the same mismatch; switching both would keep them consistent. - `GuestNpAuth.cpp:42` waits on `first`, which comes from the synchronous `sceNpAuthCreateRequest`. Both references return `SCE_NP_AUTH_ERROR_INVALID_ID` (`0x80550307`) for a non-async request, so the test currently pins behaviour they reject. Please wait on the id from `sceNpAuthCreateAsyncRequest` instead. - Request tracking (unknown ids, sync vs async, aborted) isn't modelled. That's fine, but it needs a line in `docs/dev/TechnicalDebt.md` saying so, and the line shouldn't go at the end of its section. Also, no CI ran on this head. Please push the fixes so the fork CI runs.
popcoder565 commented 2026-10-09 19:50:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T19:50:47Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 0917ada2, alone on main 8b393b6e.

  • guest_np_auth passes 3 of 3.
  • The full suite passes (512 of 512).
  • The new libSceNpAuth/CMakeLists.txt was only picked up after rerunning CMake in the existing build directory. A fresh configure, as in CI, isn't affected.
  • It conflicts with #2364, which also adds libSceNpAuth/CMakeLists.txt and changes GuestNpAuth.cpp.

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088147543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/925#issuecomment-6088147543). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T19:50:47Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `0917ada2`, alone on `main` 8b393b6e. - `guest_np_auth` passes 3 of 3. - The full suite passes (512 of 512). - The new `libSceNpAuth/CMakeLists.txt` was only picked up after rerunning CMake in the existing build directory. A fresh configure, as in CI, isn't affected. - It conflicts with #2364, which also adds `libSceNpAuth/CMakeLists.txt` and changes `GuestNpAuth.cpp`. No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
oneandonlydean commented 2026-10-11 01:07:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T01:07:32Z.


Closing for now: the points from 2026-10-07 are still open. If you pick it back up, please comment here and it can be reopened.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104046970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/925#issuecomment-6104046970). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T01:07:32Z. --- Closing for now: the points from 2026-10-07 are still open. If you pick it back up, please comment here and it can be reopened.

Pull request closed

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!925
No description provided.