feat(libSceNpManager): implement sceNpSetContentRestriction and sceNpRegisterGamePresenceCallback offline #4531

Closed
NahuelGenchi wants to merge 1 commit from upstream-pr/4531 into main
NahuelGenchi commented 2026-10-12 14:38:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-12T14:38:40Z.


What

Replaces #2398, which the intake bot closed under the earlier paused-intake rule and GitHub would not let me reopen. Main has since taken sceNpCheckNpAvailability, and #2852 is open for sceNpGetUserIdByAccountId, so this keeps only the two calls nobody else has:

  • sceNpSetContentRestriction was declared with an opaque 128-byte structure and threw as not implemented. It now has the real layout (size, default age, count and a pointer to country and age pairs, 24 bytes with an 8-byte pair) and checks it the way shadPS4 does: a null structure is an invalid argument, a size that is not 24 is INVALID_SIZE, a negative age or count, a count over 256, or a nonzero count with no list is an invalid argument. A valid structure is accepted and dropped, since the model has no age rating to apply it to.
  • sceNpRegisterGamePresenceCallback keeps the last callback and user data under a mutex and never calls it, as no presence update ever arrives.

Both are listed in TechnicalDebt with shadPS4 as the source of the checks. None of this was measured on a console.

Tested

Ubuntu 26.04, GCC 15.2. guest_np_manager now covers a default age only, per country ages, a missing list, 256 and 257 entries, a negative count, a negative default age, a wrong size and a null structure, plus registering and clearing the presence callback. The convention and overlap checks pass. Not run on Windows.

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:4830949375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4531). Originally posted by [NahuelGenchi](https://github.com/NahuelGenchi) on 2026-10-12T14:38:40Z. --- ### What Replaces #2398, which the intake bot closed under the earlier paused-intake rule and GitHub would not let me reopen. Main has since taken `sceNpCheckNpAvailability`, and #2852 is open for `sceNpGetUserIdByAccountId`, so this keeps only the two calls nobody else has: - `sceNpSetContentRestriction` was declared with an opaque 128-byte structure and threw as not implemented. It now has the real layout (size, default age, count and a pointer to country and age pairs, 24 bytes with an 8-byte pair) and checks it the way shadPS4 does: a null structure is an invalid argument, a size that is not 24 is `INVALID_SIZE`, a negative age or count, a count over 256, or a nonzero count with no list is an invalid argument. A valid structure is accepted and dropped, since the model has no age rating to apply it to. - `sceNpRegisterGamePresenceCallback` keeps the last callback and user data under a mutex and never calls it, as no presence update ever arrives. Both are listed in TechnicalDebt with shadPS4 as the source of the checks. None of this was measured on a console. ### Tested Ubuntu 26.04, GCC 15.2. `guest_np_manager` now covers a default age only, per country ages, a missing list, 256 and 257 entries, a negative count, a negative default age, a wrong size and a null structure, plus registering and clearing the presence callback. The convention and overlap checks pass. Not run on Windows. ### 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 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-12 14:39:05 +00:00 (Migrated from github.com)

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


Progress report (d167000 → 79881d6)

📈 System libraries: 88.24% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceNpManager sceNpRegisterGamePresenceCallback
libSceNpManager sceNpSetContentRestriction
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126477555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4531#issuecomment-6126477555). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T14:39:05Z. --- <!-- progress-report --> ### Progress report (d167000 → 79881d6) 📈 **System libraries**: 88.24% (+0.06%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpRegisterGamePresenceCallback` | | libSceNpManager | `sceNpSetContentRestriction` | </details>
xXPBSXx commented 2026-10-12 17:18:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T17:18:31Z.


Windows test: head e61d87701 merged onto current main 2a5eca11c (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest with the filter guest_np_manager: guest_np_manager passed (1 test(s), 0 failed); python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129105955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4531#issuecomment-6129105955). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T17:18:31Z. --- Windows test: head `e61d87701` merged onto current `main` `2a5eca11c` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j2`: full build 0 errors; ctest with the filter `guest_np_manager`: guest_np_manager passed (1 test(s), 0 failed); `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-13 00:21:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:21:00Z.


Which title reaches sceNpSetContentRestriction or sceNpRegisterGamePresenceCallback on main? The layout and checks are what was asked for on #926, so with the title ID and the log line this can go in; otherwise I'll close it until one does.

Please also rebase instead of merging main in (a0f0159cb); branches here carry no merge commits.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135183819 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4531#issuecomment-6135183819). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:21:00Z. --- Which title reaches `sceNpSetContentRestriction` or `sceNpRegisterGamePresenceCallback` on main? The layout and checks are what was asked for on #926, so with the title ID and the log line this can go in; otherwise I'll close it until one does. Please also rebase instead of merging main in (`a0f0159cb`); branches here carry no merge commits.
oneandonlydean commented 2026-10-14 09:12:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T09:12:35Z.


Closing: no title is known to reach sceNpSetContentRestriction or sceNpRegisterGamePresenceCallback on main, and while the queue is this long we're holding PRs that don't name one. Please reopen with the title ID and the log line where it stops on current main; the layout and checks are fine as they are.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164954707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4531#issuecomment-6164954707). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T09:12:35Z. --- Closing: no title is known to reach `sceNpSetContentRestriction` or `sceNpRegisterGamePresenceCallback` on main, and while the queue is this long we're holding PRs that don't name one. Please reopen with the title ID and the log line where it stops on current main; the layout and checks are fine as they are.

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