feat(libSceNpTus): delete title contexts and their requests #8242

Merged
santhoshkumar-dev merged 1 commit from upstream-pr/8242 into main 2026-10-20 22:23:34 +00:00
santhoshkumar-dev commented 2026-10-20 06:22:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-20T06:22:52Z.


What

Title contexts in the newly added libSceNpTus occupy one of 32 slots for the process lifetime because the library has no deletion export. Add sceNpTusDeleteNpTitleCtx(int) and record each request's owning context so deleting a context releases its slot and all of its requests under the existing mutex. Unknown or already deleted contexts return SCE_NP_COMMUNITY_ERROR_INVALID_ID; requests owned by another context remain usable.

The export name is present in the PS5 3.20 inventory, with NID H3uq7x0sZOI. The signature and child-request cleanup follow shadPS4. PS5 argument, error and lifetime behavior has not been measured on a console; the library's debt file records that gap.

Overlap review: #6977 also declares sceNpTusDeleteNpTitleCtx, but its current implementation only calls NotImplemented_nid_no_patch and has no parameters. This PR implements the verified signature and parent/request cleanup; it does not duplicate an implemented path in that branch.

Tested

Windows x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release. Configured the full project with BUILD_TESTING=ON.

  • cmake --build build --target guest_np_tus_tests --parallel 8: passed, including the library and its libc/libkernel dependencies.
  • ctest --test-dir build -R '^guest_np_tus$' --output-on-failure: passed (0.14 s).
  • python tools/check_conventions.py --base origin/main: passed.
  • git diff --check origin/main...HEAD: passed.

The regression covers unknown and repeated deletion; invalidating idle, completed and aborted child requests; preserving another context's completed request; recycling all 32 context slots; reclaiming all 256 request slots through context deletion; and rejecting stale IDs.

No title or console hardware tested. The full test suite was not run.

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:4931869329 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8242). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-20T06:22:52Z. --- ### What Title contexts in the newly added `libSceNpTus` occupy one of 32 slots for the process lifetime because the library has no deletion export. Add `sceNpTusDeleteNpTitleCtx(int)` and record each request's owning context so deleting a context releases its slot and all of its requests under the existing mutex. Unknown or already deleted contexts return `SCE_NP_COMMUNITY_ERROR_INVALID_ID`; requests owned by another context remain usable. The export name is present in the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceNpTus.c#L236-L241), with NID `H3uq7x0sZOI`. The signature and child-request cleanup follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/np/np_tus/np_tus.cpp#L158-L180). PS5 argument, error and lifetime behavior has not been measured on a console; the library's debt file records that gap. Overlap review: #6977 also declares `sceNpTusDeleteNpTitleCtx`, but its current implementation only calls `NotImplemented_nid_no_patch` and has no parameters. This PR implements the verified signature and parent/request cleanup; it does not duplicate an implemented path in that branch. ### Tested Windows x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release. Configured the full project with `BUILD_TESTING=ON`. - `cmake --build build --target guest_np_tus_tests --parallel 8`: passed, including the library and its libc/libkernel dependencies. - `ctest --test-dir build -R '^guest_np_tus$' --output-on-failure`: passed (0.14 s). - `python tools/check_conventions.py --base origin/main`: passed. - `git diff --check origin/main...HEAD`: passed. The regression covers unknown and repeated deletion; invalidating idle, completed and aborted child requests; preserving another context's completed request; recycling all 32 context slots; reclaiming all 256 request slots through context deletion; and rejecting stale IDs. No title or console hardware tested. The full test suite was not run. ### 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 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-20 06:23:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T06:23:23Z.


Progress report (1ed63f6 → 971d8ba)

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

✅ 1 implemented
Library Name
libSceNpTus sceNpTusDeleteNpTitleCtx
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6284805971 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8242#issuecomment-6284805971). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T06:23:23Z. --- <!-- progress-report --> ### Progress report (1ed63f6 → 971d8ba) 📈 **System libraries**: 66.63% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceNpTus | `sceNpTusDeleteNpTitleCtx` | </details>
github-actions[bot] commented 2026-10-20 06:38:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T06:38:51Z.


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 6977 sceNpTusDeleteNpTitleCtx
PR 8328 docs/dev/debt/libSceNpTus.md L5

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 6977 core/libs/prx/libSceNpTus/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285013928 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8242#issuecomment-6285013928). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T06:38:51Z. --- <!-- 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 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | | `sceNpTusDeleteNpTitleCtx` | | | [PR 8328](https://www.github.com/boykopovar/AnyPS5/pull/8328) | `docs/dev/debt/libSceNpTus.md` [L5](https://github.com/boykopovar/AnyPS5/blob/e41fb9db5d35ba68b8111bfa0c7cbc698e77a69b/docs/dev/debt/libSceNpTus.md#L5) | | | 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 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceNpTus/Export.cpp` |
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!8242
No description provided.