Skip to content

feat(np-tus): add libSceNpTus with offline title user storage - #6592

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
LuisAguilarDev:feat/libscenptus
Oct 19, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
LuisAguilarDev:feat/libscenptus

Conversation

@LuisAguilarDev

Copy link
Copy Markdown
Contributor

What

Add libSceNpTus. A title that imports it fails to load: Failed to load module: libSceNpTus.prx GetLastError: 126.

Implemented exports: sceNpTusCreateNpTitleCtxA, sceNpTusCreateRequest, sceNpTusDeleteRequest, sceNpTusAbortRequest, sceNpTusPollAsync, sceNpTusGetMultiSlotVariableAAsync, sceNpTusSetMultiSlotVariableAAsync, sceNpTusDeleteMultiSlotVariableAAsync, sceNpTusAddAndGetVariableAAsync.

PSN is not emulated, so the library follows libSceNpManager:

  • Title contexts and requests are tracked. An unknown ID returns SCE_NP_COMMUNITY_ERROR_INVALID_ID. More than 32 contexts or 256 requests returns TOO_MANY_OBJECTS.

  • The async calls validate their arguments:

    • null arrays return INSUFFICIENT_ARGUMENT
    • arrayLen < 1, a negative slot ID or a non-null option returns INVALID_ARGUMENT
    • more than 64 slots returns TOO_MANY_SLOTID

    A valid call starts the request.

  • A started request finishes with SCE_NP_ERROR_SIGNED_OUT, the same result sceNpPollAsync reports. An aborted request finishes with ABORTED.

  • sceNpTusPollAsync returns 1 while no operation has started. After one has, it returns 0 and writes that operation's result.

Signatures and community error codes come from shadPS4 (src/core/libraries/np/np_tus/, np_error.h), and fpPS4 agrees on the context and request calls. Two choices differ from shadPS4:

  • Context creation: sceNpTusCreateNpTitleCtxA creates a context without checking sign-in. shadPS4 returns the sceNpGetNpId error instead.
  • Signed-out result: the signed-out state is reported per operation, through the poll result.

The SceNpTusVariableA layout is not verified, so output arrays are never written and variableArraySize is not checked.

Tested

  • Windows 11, MinGW-w64 GCC 16.2.0, Release:
    • The new guest_np_tus test passes in 0.11 s. It covers argument validation, the poll states, the signed-out and aborted results, and stale IDs after delete.
    • tools/check_conventions.py --base origin/main and git diff --check pass.
  • Dragon Ball Xenoverse 2 (PPSA08587), RTX 3070 Ti: the title loads its modules and renders its first frames. It then stops in the AGC driver (stencil clear requires a writable stencil plane), which is a separate topic and not part of this PR. The title has not called the TUS functions yet.

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
  • Unblocks: PPSA08587 Dragon Ball Xenoverse 2 (PPSA08587) on Windows #6591
  • GPUs tested: n/a
  • AI-assisted: yes

@jotitadev jotitadev 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.

Linux run: head 6f109b887 merged onto main 5d9dcc42d (clean merge, CMake reconfigured for the new library), in one tree with seven other library PRs that share no files with this one. The description lists Windows only.

Machine: Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, Release, BUILD_TESTING=ON.

  • libSceNpTus builds, and guest_np_tus passes, 5/5 with --repeat until-fail:5.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): no regressions. The only failures are file_writer_binary and file_writer_text, which also fail on main on this machine.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

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 sceNpTusCreateRequest
sceNpTusDeleteRequest
core/libs/prx/libSceNpTus/Export.cpp

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

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Progress report (feb74b6 → 6093e8c)

📈 System libraries: 91.42% (+0.02%, +9 implemented functions)

✅ 9 implemented
Library Name
libSceNpTus sceNpTusAbortRequest
libSceNpTus sceNpTusAddAndGetVariableAAsync
libSceNpTus sceNpTusCreateNpTitleCtxA
libSceNpTus sceNpTusCreateRequest
libSceNpTus sceNpTusDeleteMultiSlotVariableAAsync
libSceNpTus sceNpTusDeleteRequest
libSceNpTus sceNpTusGetMultiSlotVariableAAsync
libSceNpTus sceNpTusPollAsync
libSceNpTus sceNpTusSetMultiSlotVariableAAsync

LuisAguilarDev and others added 2 commits October 19, 2026 08:26
Titles that import libSceNpTus failed to load because the library did
not exist. Title contexts and requests are tracked, arguments are
validated, and every storage operation completes as signed out, matching
how libSceNpManager reports PSN.
@github-actions github-actions Bot added the docs label Oct 19, 2026
@adriadam10
adriadam10 merged commit 4833581 into boykopovar:main Oct 19, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the error codes and the poll/abort/delete semantics against shadPS4; the test pins values that only the code produces.

Added by us (own commit on your branch): docs/dev/debt/libSceNpTus.md, recording the unverified SceNpTusVariableA layout, the context creation without a sign-in check (shadPS4 returns the sceNpGetNpId error) and the always-signed-out request result. guest_np_tus and the scoped ctest pass on the rebased head.

Merging through the queue once its Build run is green. Thanks @jotitadev for the Linux run.

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

Labels

build docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants