Skip to content

feat(libSceNpTus): create NpId title contexts with sceNpTusCreateNpTitleCtx - #13458

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
KernelPanicNT:feat/nptus-npid-title-context
Oct 30, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
KernelPanicNT:feat/nptus-npid-title-context

Conversation

@KernelPanicNT

Copy link
Copy Markdown
Contributor

Source of the behaviour

Not measured on a device. The checks follow shadPS4's sceNpTusCreateNpTitleCtx (GPL, used for behaviour only; no code is taken from it), the same function the merged sceNpTssCreateNpTitleCtx (#9531) already follows. The signature is shadPS4's and fpPS4's; fpPS4 only returns -1, so it settles the parameter list and nothing else.

Call Check, in order Result
sceNpTusCreateNpTitleCtx(serviceLabel, npId) npId null INSUFFICIENT_ARGUMENT 0x8055070C
serviceLabel 0xFFFFFFFF INVALID_ARGUMENT 0x80550704
32 title contexts already open (shared with the A and TSS forms) TOO_MANY_OBJECTS 0x80550706
otherwise a new title context ID

In-tree lines that change: the throwing sceNpTusCreateNpTitleCtx, which now calls sceNpTssCreateNpTitleCtx, and the debt entry that listed it. The declaration keeps its signature.

What

sceNpTusCreateNpTitleCtx no longer throws. It makes the checks of sceNpTssCreateNpTitleCtx (table above) and creates its context in the same table as sceNpTusCreateNpTitleCtxA and the TSS forms, so requests, deletion and the 32-context limit behave the same for all four creators.

The Unknown function info entry is removed, because fpPS4 now gives a second source for the prototype. A new Functional entry records what stays open: nothing is measured on a device, and the npId contents are neither read nor kept with the context.

Tested

  • Linux (GitHub codespace), current main with this branch applied: guest_np_tus passes. The new cases check a null npId with a valid and an invalid service label, the invalid label with a valid npId, that a created context takes requests and that deleting it removes them, the 32-context limit shared with sceNpTusCreateNpTitleCtxA and sceNpTssCreateNpTitleCtx, and that the argument errors come before the limit.
  • Negative control: with Export.cpp restored from main, guest_np_tus fails with sceNpTusCreateNpTitleCtx not implemented.
  • python3 tools/check_conventions.py --base origin/main passes. tools/progress.py against main: +1 implemented function (sceNpTusCreateNpTitleCtx); libSceNpTus 121/142 to 122/142.
  • tools/pr_overlap.py: no overlap with open pull requests (feat(libSceNpTus): implement sceNpTssGetData and sceNpTssGetDataAsync #10693 and feat(libSceNpTus): implement the friends A and CrossSave calls and two virtual-user calls #10675 touch the same files and merge cleanly).

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

…tleCtx

sceNpTusCreateNpTitleCtx makes the same checks as sceNpTssCreateNpTitleCtx,
which already follows shadPS4's sceNpTusCreateNpTitleCtx: a null npId is
INSUFFICIENT_ARGUMENT, service label 0xFFFFFFFF is INVALID_ARGUMENT, and
otherwise it creates a context in the shared 32-context table. The
signature is shadPS4's and fpPS4's.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The wrapper delegates to the existing TSS context creator, and the new tests cover its argument precedence, shared capacity, request lifecycle, and deletion behavior.

What I ran

Reviewed head 41c1f7881abbebcd1fce5e0a008f7454a4bbe5c9 against PR base 9f748f4d8e36ce3714f3b95f3386316e110a9b22. A read-only merge preview onto current upstream/main 9304896d89f070f65b8f38bd3a8024d5c19f8fe1 was clean (tree 2202ab9a68cb2942f59904f56343f0adaf4f54f4). Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0.

git diff --check 9f748f4d8e36ce3714f3b95f3386316e110a9b22...41c1f7881abbebcd1fce5e0a008f7454a4bbe5c9
python3 tools/check_conventions.py --base 9f748f4d8e36ce3714f3b95f3386316e110a9b22 --head 41c1f7881abbebcd1fce5e0a008f7454a4bbe5c9
python3 tools/pr_abi_audit.py --base 9f748f4d8e36ce3714f3b95f3386316e110a9b22 --head 41c1f7881abbebcd1fce5e0a008f7454a4bbe5c9
python3 tools/pr_test_quality.py --root . core/libs/tests/GuestNpTus.cpp
git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/review/pr-13458

Diff check and conventions passed; the ABI audit found consistent declarations and definitions. The test-quality heuristic warned that it could not find a literal CMake test path; I verified the test is registered in core/libs/prx/libSceNpTus/CMakeLists.txt through ${LIBS_INCLUDE_DIR}. The aggregate precheck could not find local-only helper scripts in its isolated copy, so I ran the relevant audit helpers directly. No build or C++ tests were run locally.

Not verified

The PR's hosted checks were queued at final refresh. I did not independently run the author's reported Linux test or negative control, or verify console behavior.

@github-actions

Copy link
Copy Markdown

Progress report (9f748f4 → 41c1f78)

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

✅ 1 implemented
Library Name
libSceNpTus sceNpTusCreateNpTitleCtx

Changed libraries (implemented exports)

Library Before After Change
libSceNpTus 121/142 (85.21%) 122/142 (85.92%) +0.70%

@maskym

maskym commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Windows result for head 41c1f7881a, merged into main 556547da71 (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

The tree also carried the open PRs #13485, #13479, #13470, #13462, #13459, #13457, #13456, all merged cleanly, so the run is a joint one. guest_np_tus, the test this PR extends, passes. Every test of the touched modules passes too (23/23, three runs). Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@adriadam10 adriadam10 self-assigned this Oct 30, 2026
@adriadam10
adriadam10 merged commit f728f26 into boykopovar:main Oct 30, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the check order against shadPS4 (null npId, then label 0xFFFFFFFF, then the shared 32-context limit), that it reuses sceNpTssCreateNpTitleCtx, that the new guest_np_tus cases fail without the change, and the debt entry. Windows run by @maskym and the approving review by @MarcZX10 noted; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants