feat(libSceNpManager): implement sceNpCheckCallbackForLib #9085

Merged
YossiYad merged 3 commits from upstream-pr/9085 into main 2026-10-22 05:53:46 +00:00
YossiYad commented 2026-10-21 12:00:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-21T12:00:54Z.


What

sceNpCheckCallbackForLib threw. It now delivers the pending NP state callbacks, as sceNpCheckCallback already does here: each registered state callback gets SIGNED_OUT once, and a second check delivers nothing new. In shadPS4's np_manager.cpp sceNpCheckCallbackForLib dispatches the same pending state events; its sceNpCheckCallback also runs other registered NP callbacks, which this library does not keep, so the two calls are the same here.

Not measured on a PS5; the debt entry says so, and the pending-declaration line that named only this function is removed.

Tested

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

  • guest_np_manager (core/libs/tests/GuestNpManager.cpp): CheckStateCallbacksA now delivers the state to a callback registered again through sceNpCheckCallbackForLib, then checks that neither call delivers it a second time. It aborts on main, and fails when sceNpCheckCallbackForLib returns 0 without dispatching.
  • Full ctest: 1790 of 1798 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.01%, 1 function implemented, none lost.
  • tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists #6977, #7412 and #6044 as editing the same files; none of them implements this function.

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:4951190122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T12:00:54Z. --- ### What `sceNpCheckCallbackForLib` threw. It now delivers the pending NP state callbacks, as `sceNpCheckCallback` already does here: each registered state callback gets `SIGNED_OUT` once, and a second check delivers nothing new. In [shadPS4's np_manager.cpp](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/np/np_manager.cpp) `sceNpCheckCallbackForLib` dispatches the same pending state events; its `sceNpCheckCallback` also runs other registered NP callbacks, which this library does not keep, so the two calls are the same here. Not measured on a PS5; the debt entry says so, and the pending-declaration line that named only this function is removed. ### Tested Linux (Fedora 44, GCC, Ninja, `-DBUILD_TESTING=ON`), based on `main` `47fa6eecf8`: - `guest_np_manager` (`core/libs/tests/GuestNpManager.cpp`): `CheckStateCallbacksA` now delivers the state to a callback registered again through `sceNpCheckCallbackForLib`, then checks that neither call delivers it a second time. It aborts on `main`, and fails when `sceNpCheckCallbackForLib` returns 0 without dispatching. - Full `ctest`: 1790 of 1798 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.01%, 1 function implemented, none lost. - `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` lists #6977, #7412 and #6044 as editing the same files; none of them implements this function. ### 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 12:01:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T12:01:44Z.


Progress report (47fa6ee → fcc7f2a)

📈 System libraries: 48.68% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceNpManager sceNpCheckCallbackForLib
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315398894 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6315398894). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T12:01:44Z. --- <!-- progress-report --> ### Progress report (47fa6ee → fcc7f2a) 📈 **System libraries**: 48.68% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceNpManager | `sceNpCheckCallbackForLib` | </details>
github-actions[bot] commented 2026-10-21 12:11:37 +00:00 (Migrated from github.com)

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


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:6315587622 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6315587622). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T12:11:37Z. --- <!-- 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 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 16:14:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T16:14:37Z.


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: fcc7f2aba92f3e467b1b3a530abe782c8ce3ded4.

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 (47fa6eecf8), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.

GPU: the run output has no Selected GPU line; no GPU claim is made.

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:6320722525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6320722525). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T16:14:37Z. --- 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:** `fcc7f2aba92f3e467b1b3a530abe782c8ce3ded4`. **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 (`47fa6eecf8`), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards. **GPU:** the run output has no `Selected GPU` line; no GPU claim is made. **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:29 +00:00 (Migrated from github.com)

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


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:6324963522 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6324963522). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T19:43:29Z. --- 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:46 +00:00 (Migrated from github.com)

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


@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:6333571217 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6333571217). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-22T05:34:46Z. --- @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:37:54 +00:00 (Migrated from github.com)

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


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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333613295 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9085#issuecomment-6333613295). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T05:37:54Z. --- @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!9085
No description provided.