feat(libSceNpManager): implement sceNpIsPlusMember and sceNpSetContentRestriction #9225

Merged
YossiYad merged 4 commits from upstream-pr/9225 into main 2026-10-22 06:09:14 +00:00
YossiYad commented 2026-10-21 15:38:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-21T15:38:59Z.


What

sceNpIsPlusMember and sceNpSetContentRestriction threw. They now follow shadPS4's np_manager.cpp:

  • sceNpIsPlusMember(user id, bool*) writes false, since PSN is not emulated. A null output returns SCE_NP_ERROR_INVALID_ARGUMENT.
  • sceNpSetContentRestriction reads shadPS4's 0x18-byte layout through the existing opaque NpContentRestriction:
    • null: INVALID_ARGUMENT
    • size other than 0x18: SCE_NP_ERROR_INVALID_SIZE (0x80550011)
    • negative default age, more than 256 age restrictions, or a count with no array: INVALID_ARGUMENT
    • valid: accepted and not stored

Not measured on a PS5; the debt entry says so. sceNpIsPlusMember was one of the 150 pending declarations, so that count drops to 149.

Tested

Linux (Fedora 44, GCC, Ninja, -DBUILD_TESTING=ON), based on main cecb540a63:

  • guest_np_manager (core/libs/tests/GuestNpManager.cpp) gains CheckPlusAndContentRestriction. It checks the Plus answer and its null case, a valid restriction with and without age entries, the 256 limit on both sides, and each refusal. It aborts on main.
  • Each of 7 mutations makes the test fail:
    • the Plus answer
    • the null output
    • the size error code
    • the negative age check
    • the 256 bound
    • the missing array check
    • the null restriction
  • Full ctest: 1793 of 1801 pass. The 8 failures fail the same way on main on this machine and do not link libSceNpManager: application_heap_scripting, application_heap_lazy, agc_driver_guest_memory_lifetime, agc_driver_image_array_window_past_layer_limit, agc_driver_tessellation and the three net_dontwait_blocking_* cases.
  • tools/progress.py --compare: libraries +0.02%, 2 functions implemented, none lost.
  • tools/check_conventions.py --base upstream/main passes.
  • tools/pr_overlap.py finds #9144 on the pending count line of the debt file and core/libs/CMakeLists.txt; my #9085 edits another part of the same test and debt file.

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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4954241427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T15:38:59Z. --- ### What `sceNpIsPlusMember` and `sceNpSetContentRestriction` threw. They now follow [shadPS4's np_manager.cpp](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/np/np_manager.cpp): - `sceNpIsPlusMember(user id, bool*)` writes `false`, since PSN is not emulated. A null output returns `SCE_NP_ERROR_INVALID_ARGUMENT`. - `sceNpSetContentRestriction` reads shadPS4's 0x18-byte layout through the existing opaque `NpContentRestriction`: - null: `INVALID_ARGUMENT` - size other than 0x18: `SCE_NP_ERROR_INVALID_SIZE` (0x80550011) - negative default age, more than 256 age restrictions, or a count with no array: `INVALID_ARGUMENT` - valid: accepted and not stored Not measured on a PS5; the debt entry says so. `sceNpIsPlusMember` was one of the 150 pending declarations, so that count drops to 149. ### Tested Linux (Fedora 44, GCC, Ninja, `-DBUILD_TESTING=ON`), based on `main` `cecb540a63`: - `guest_np_manager` (`core/libs/tests/GuestNpManager.cpp`) gains `CheckPlusAndContentRestriction`. It checks the Plus answer and its null case, a valid restriction with and without age entries, the 256 limit on both sides, and each refusal. It aborts on `main`. - Each of 7 mutations makes the test fail: - the Plus answer - the null output - the size error code - the negative age check - the 256 bound - the missing array check - the null restriction - Full `ctest`: 1793 of 1801 pass. The 8 failures fail the same way on `main` on this machine and do not link libSceNpManager: `application_heap_scripting`, `application_heap_lazy`, `agc_driver_guest_memory_lifetime`, `agc_driver_image_array_window_past_layer_limit`, `agc_driver_tessellation` and the three `net_dontwait_blocking_*` cases. - `tools/progress.py --compare`: libraries +0.02%, 2 functions implemented, none lost. - `tools/check_conventions.py --base upstream/main` passes. - `tools/pr_overlap.py` finds #9144 on the pending count line of the debt file and `core/libs/CMakeLists.txt`; my #9085 edits another part of the same test and debt file. ### 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: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-21 15:39:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T15:39:49Z.


Progress report (cecb540 → 3cf57aa)

📈 System libraries: 42.12% (+0.02%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceNpManager sceNpIsPlusMember
libSceNpManager sceNpSetContentRestriction
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6319980650 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6319980650). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T15:39:49Z. --- <!-- progress-report --> ### Progress report (cecb540 → 3cf57aa) 📈 **System libraries**: 42.12% (+0.02%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpIsPlusMember` | | libSceNpManager | `sceNpSetContentRestriction` | </details>
github-actions[bot] commented 2026-10-21 16:45:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T16:45:12Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9144 docs/dev/debt/libSceNpManager.md L9
PR 9282 docs/dev/debt/libSceNpManager.md L8-9

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 6990 core/libs/prx/libSceNpManager/Export.cpp
core/libs/tests/GuestNpManager.cpp
PR 7412 core/libs/prx/libSceNpManager/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321394021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6321394021). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T16:45:12Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 9144](https://www.github.com/boykopovar/AnyPS5/pull/9144) | `docs/dev/debt/libSceNpManager.md` [L9](https://github.com/boykopovar/AnyPS5/blob/a6dcea9279b53b3a39c13695eac66f7c8b5b503c/docs/dev/debt/libSceNpManager.md#L9) | | | | [PR 9282](https://www.github.com/boykopovar/AnyPS5/pull/9282) | `docs/dev/debt/libSceNpManager.md` [L8-9](https://github.com/boykopovar/AnyPS5/blob/a6dcea9279b53b3a39c13695eac66f7c8b5b503c/docs/dev/debt/libSceNpManager.md#L8-L9) | | | 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 6990](https://www.github.com/boykopovar/AnyPS5/pull/6990) | `core/libs/prx/libSceNpManager/Export.cpp`<br>`core/libs/tests/GuestNpManager.cpp` | | [PR 7412](https://www.github.com/boykopovar/AnyPS5/pull/7412) | `core/libs/prx/libSceNpManager/Export.cpp` |
xXPBSXx commented 2026-10-21 19:18:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T19:18:30Z.


Independent Windows run of this PR (data only).

Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against main is clean. I built only guest_np_manager_tests; ctest -N -R guest_np_manager lists exactly one test.

PR head tested: 3cf57aa463ccbe7c5b159825ae3de4a29fdf8a17.

Results (3 runs each):

  • PR head: guest_np_manager passes 3/3.
  • Baseline: I kept the PR's test and replaced only core/libs/prx/libSceNpManager/Export.cpp with the version from the PR's merge base (cecb540a63), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.

Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6324478934 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6324478934). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T19:18:30Z. --- Independent Windows run of this PR (data only). **Environment:** Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against `main` is clean. I built only `guest_np_manager_tests`; `ctest -N -R guest_np_manager` lists exactly one test. **PR head tested:** `3cf57aa463ccbe7c5b159825ae3de4a29fdf8a17`. **Results (3 runs each):** - PR head: `guest_np_manager` passes 3/3. - Baseline: I kept the PR's test and replaced only `core/libs/prx/libSceNpManager/Export.cpp` with the version from the PR's merge base (`cecb540a63`), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards. **Not run:** other platforms, the other tests in the same family, the full repository CTest, and any title or console run. AI-assisted (Claude Code).
YossiYad commented 2026-10-21 19:43:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-21T19:43:25Z.


Thanks @xXPBSXx for the Windows run, and for the baseline with Export.cpp reverted that shows the test fails without the change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6324962074 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6324962074). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T19:43:25Z. --- Thanks @xXPBSXx for the Windows run, and for the baseline with `Export.cpp` reverted that shows the test fails without the change.
YossiYad commented 2026-10-22 05:34:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-22T05:34:48Z.


@oneandonlydean @adriadam10 ready from my side: CI is green, it merges cleanly, and xXPBSXx's Windows run shows the test passing here and failing with main's library code.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333571892 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6333571892). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-22T05:34:48Z. --- @oneandonlydean @adriadam10 ready from my side: CI is green, it merges cleanly, and xXPBSXx's Windows run shows the test passing here and failing with `main`'s library code.
oneandonlydean commented 2026-10-22 05:48:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T05:48:51Z.


@YossiYad thanks, it's in my review queue now. I'll come back here with the result.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333759573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9225#issuecomment-6333759573). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T05:48:51Z. --- @YossiYad thanks, it's in my review queue now. I'll come back here with the result.
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!9225
No description provided.