feat(libSceNpTus): run the remaining multi-slot variable calls offline #8805

Merged
ags-arnab merged 1 commit from upstream-pr/8805 into main 2026-10-21 08:32:17 +00:00
ags-arnab commented 2026-10-21 01:29:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ags-arnab on 2026-10-21T01:29:49Z.


What

sceNpTusWaitAsync and the 17 remaining multi-slot variable calls threw not implemented. They now use the offline model of the existing *AAsync calls: the arguments are checked, and a started request finishes with SCE_NP_ERROR_SIGNED_OUT (0x80550006), or ABORTED after sceNpTusAbortRequest.

  • Async: sceNpTusGetMultiSlotVariableAsync, sceNpTusSetMultiSlotVariableAsync and sceNpTusDeleteMultiSlotVariableAsync (NpId), their VUserAsync forms, sceNpTusGetMultiSlotVariableAVUserAsync, sceNpTusGetMultiSlotVariableForCrossSaveAsync and sceNpTusGetMultiSlotVariableForCrossSaveVUserAsync.
  • Blocking: sceNpTusGetMultiSlotVariableA, ...AVUser, ...ForCrossSave, ...ForCrossSaveVUser, sceNpTusSetMultiSlotVariableA, sceNpTusDeleteMultiSlotVariable, ...A and ...VUser run the async call and return its error, the wait error or the request result, as in shadPS4.
  • sceNpTusWaitAsync reports the result of a started request; an unknown id is INVALID_ID, a request that was never started INVALID_ARGUMENT.

Signatures and argument checks follow shadPS4 function by function, including where its functions differ from each other (recorded in the debt entry). fpPS4 and SharpProspero do not declare these calls. RPCS3's PS3 module differs for an empty array, a null target, an empty virtual user ID and a wait on a request that was never started; the debt entries record the differences. The virtual user ID is taken as NpOnlineId, since shadPS4's OrbisNpTusVirtualUserId has the layout of OrbisNpOnlineId and RPCS3 declares SceNpTusVirtualUserId as SceNpOnlineId; only its first byte is read. As in the *AAsync calls, the array size is not checked and no output is written, because the variable layouts are not verified; the test checks that the output buffer stays untouched.

The sceNpTusPollAsync debt entry said "the four *Async calls" and now covers every implemented *Async call, the blocking calls and sceNpTusWaitAsync. It also records that an abort stays set for every later operation on the request, which the existing code already did and the blocking calls inherit; in shadPS4 an abort only ends the operation in progress.

tools/progress.py --compare: +18 implemented functions, libSceNpTus only.

tools/pr_overlap.py --branch lists only #6977, which adds core/libs/prx/libSceNpTus/Export.cpp as a new file of throwing stubs from a base older than the library, and already conflicts with main.

Tested

  • Linux x86-64, Ubuntu 26.04 container, GCC 15.2.0, Release, full build: guest_np_tus passes on this branch and on main. The host is Apple silicon and Rosetta has no AVX2, which the libraries require, so the test binary ran under qemu-x86_64 -cpu max (QEMU 10.2.1).
  • The NID-patched libSceNpTus.prx builds and exports the same NIDs as on main.
  • Windows: not built or run (WinLibs GCC 15.2.0 unavailable); the changed files compile with MinGW GCC 16 -fsyntax-only -Wall -Wextra without warnings.
  • No title was run.
  • python3 tools/check_conventions.py --base origin/main passes.

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:4944984274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805). Originally posted by [ags-arnab](https://github.com/ags-arnab) on 2026-10-21T01:29:49Z. --- ### What `sceNpTusWaitAsync` and the 17 remaining multi-slot variable calls threw `not implemented`. They now use the offline model of the existing `*AAsync` calls: the arguments are checked, and a started request finishes with `SCE_NP_ERROR_SIGNED_OUT` (`0x80550006`), or `ABORTED` after `sceNpTusAbortRequest`. - Async: `sceNpTusGetMultiSlotVariableAsync`, `sceNpTusSetMultiSlotVariableAsync` and `sceNpTusDeleteMultiSlotVariableAsync` (NpId), their `VUserAsync` forms, `sceNpTusGetMultiSlotVariableAVUserAsync`, `sceNpTusGetMultiSlotVariableForCrossSaveAsync` and `sceNpTusGetMultiSlotVariableForCrossSaveVUserAsync`. - Blocking: `sceNpTusGetMultiSlotVariableA`, `...AVUser`, `...ForCrossSave`, `...ForCrossSaveVUser`, `sceNpTusSetMultiSlotVariableA`, `sceNpTusDeleteMultiSlotVariable`, `...A` and `...VUser` run the async call and return its error, the wait error or the request result, as in shadPS4. - `sceNpTusWaitAsync` reports the result of a started request; an unknown id is `INVALID_ID`, a request that was never started `INVALID_ARGUMENT`. Signatures and argument checks follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/c1b26558352b863f80142256e4df38585aa7d727/src/core/libraries/np/np_tus/np_tus.cpp) function by function, including where its functions differ from each other (recorded in the debt entry). fpPS4 and SharpProspero do not declare these calls. RPCS3's [PS3 module](https://github.com/RPCS3/rpcs3/blob/1a9dca3a3a84a18df866e3021918322bd295160a/rpcs3/Emu/Cell/Modules/sceNpTus.cpp) differs for an empty array, a null target, an empty virtual user ID and a wait on a request that was never started; the debt entries record the differences. The virtual user ID is taken as `NpOnlineId`, since shadPS4's `OrbisNpTusVirtualUserId` has the layout of `OrbisNpOnlineId` and RPCS3 declares `SceNpTusVirtualUserId` as `SceNpOnlineId`; only its first byte is read. As in the `*AAsync` calls, the array size is not checked and no output is written, because the variable layouts are not verified; the test checks that the output buffer stays untouched. The `sceNpTusPollAsync` debt entry said "the four `*Async` calls" and now covers every implemented `*Async` call, the blocking calls and `sceNpTusWaitAsync`. It also records that an abort stays set for every later operation on the request, which the existing code already did and the blocking calls inherit; in shadPS4 an abort only ends the operation in progress. `tools/progress.py --compare`: +18 implemented functions, libSceNpTus only. `tools/pr_overlap.py --branch` lists only #6977, which adds `core/libs/prx/libSceNpTus/Export.cpp` as a new file of throwing stubs from a base older than the library, and already conflicts with `main`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Linux x86-64, Ubuntu 26.04 container, GCC 15.2.0, Release, full build: `guest_np_tus` passes on this branch and on `main`. The host is Apple silicon and Rosetta has no AVX2, which the libraries require, so the test binary ran under `qemu-x86_64 -cpu max` (QEMU 10.2.1). - The NID-patched `libSceNpTus.prx` builds and exports the same NIDs as on `main`. - Windows: not built or run (WinLibs GCC 15.2.0 unavailable); the changed files compile with MinGW GCC 16 `-fsyntax-only -Wall -Wextra` without warnings. - No title was run. - `python3 tools/check_conventions.py --base origin/main` passes. ### 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
copilot-pull-request-reviewer[bot] commented 2026-10-21 01:29:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-21T01:29:56Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593884058 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805#pullrequestreview-5593884058). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-21T01:29:56Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
github-actions[bot] commented 2026-10-21 01:53:23 +00:00 (Migrated from github.com)

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


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:6306058734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805#issuecomment-6306058734). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T01:53:23Z. --- <!-- 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 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceNpTus/Export.cpp` |
nikowolf123 commented 2026-10-21 03:19:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T03:19:04Z.


I compared all 18 functions with shadPS4's np_tus.cpp at the cited commit (c1b2655) and found nothing to change. I checked:

  • the parameter lists;
  • the order and error codes of the argument checks, including the per-function differences the debt entry lists (arrayLen < 1 is INSUFFICIENT_ARGUMENT in the NpId and virtual-user delete calls and in sceNpTusGetMultiSlotVariableVUserAsync; a null NpId is accepted except in delete);
  • that an unknown request id is reported only after the argument checks, as ResolveTus does;
  • the blocking wrappers.

To avoid duplicate work: shadPS4 has the same kind of logic for 93 of the stubs this PR leaves. They are the data get/set calls, the data status calls (multi-slot, multi-user, friends), add-and-get, try-and-set, the friends and multi-user variable reads, the multi-slot data deletes and the Tss calls. I've started porting those onto this PR's helpers (StartOffline, WaitOffline, Complete) on a branch stacked on this head, and I won't open it before this PR is merged. If you're already working on any of those families, tell me which and I'll leave them out.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307178947 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805#issuecomment-6307178947). Originally posted by [nikowolf123](https://github.com/nikowolf123) on 2026-10-21T03:19:04Z. --- I compared all 18 functions with shadPS4's `np_tus.cpp` at the cited commit (c1b2655) and found nothing to change. I checked: - the parameter lists; - the order and error codes of the argument checks, including the per-function differences the debt entry lists (`arrayLen < 1` is `INSUFFICIENT_ARGUMENT` in the NpId and virtual-user delete calls and in `sceNpTusGetMultiSlotVariableVUserAsync`; a null NpId is accepted except in delete); - that an unknown request id is reported only after the argument checks, as `ResolveTus` does; - the blocking wrappers. To avoid duplicate work: shadPS4 has the same kind of logic for 93 of the stubs this PR leaves. They are the data get/set calls, the data status calls (multi-slot, multi-user, friends), add-and-get, try-and-set, the friends and multi-user variable reads, the multi-slot data deletes and the Tss calls. I've started porting those onto this PR's helpers (`StartOffline`, `WaitOffline`, `Complete`) on a branch stacked on this head, and I won't open it before this PR is merged. If you're already working on any of those families, tell me which and I'll leave them out.
pipe1os commented 2026-10-21 06:27:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pipe1os on 2026-10-21T06:27:07Z.


Built and ran this on Windows, since the PR says it wasn't.

Windows 11 Pro 26300, WinLibs GCC 15.2.0, Ninja, Release, BUILD_TESTING=ON. a7d5b6a89 merged onto main a07e985c8f without conflicts.

  • ctest --test-dir build -R '^guest_np_tus$' passes (0.28 s).
  • Reverting only core/libs/prx/libSceNpTus/Export.cpp to main and keeping the new test, it fails with 0xc0000409 and sceNpTusWaitAsync not implemented, so the test covers the change.
  • The NID-patched libSceNpTus.prx exports the same 136 NIDs as main's.

I also checked the 18 functions against shadPS4 c1b2655: signatures, check order and error codes match. The only difference I found is the one already in the debt entry (no variableArraySize / INVALID_ALIGNMENT check).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309595631 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805#issuecomment-6309595631). Originally posted by [pipe1os](https://github.com/pipe1os) on 2026-10-21T06:27:07Z. --- Built and ran this on Windows, since the PR says it wasn't. Windows 11 Pro 26300, WinLibs GCC 15.2.0, Ninja, Release, `BUILD_TESTING=ON`. a7d5b6a89 merged onto main a07e985c8f without conflicts. - `ctest --test-dir build -R '^guest_np_tus$'` passes (0.28 s). - Reverting only `core/libs/prx/libSceNpTus/Export.cpp` to main and keeping the new test, it fails with `0xc0000409` and `sceNpTusWaitAsync not implemented`, so the test covers the change. - The NID-patched `libSceNpTus.prx` exports the same 136 NIDs as main's. I also checked the 18 functions against shadPS4 c1b2655: signatures, check order and error codes match. The only difference I found is the one already in the debt entry (no `variableArraySize` / `INVALID_ALIGNMENT` check).
ags-arnab commented 2026-10-21 10:26:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ags-arnab on 2026-10-21T10:26:58Z.


Thanks @nikowolf123 for checking all 18 against shadPS4. I am not working on any of those families, so go ahead and take all 93.

@pipe1os thanks for running it on Windows, that was the one part I could not test on my side. Good to know the test actually fails without the implementation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313730301 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8805#issuecomment-6313730301). Originally posted by [ags-arnab](https://github.com/ags-arnab) on 2026-10-21T10:26:58Z. --- Thanks @nikowolf123 for checking all 18 against shadPS4. I am not working on any of those families, so go ahead and take all 93. @pipe1os thanks for running it on Windows, that was the one part I could not test on my side. Good to know the test actually fails without the implementation.
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!8805
No description provided.