fix(libSceNpCppWebApi): answer finish, abort and getId for never-started transactions as the module does #11235

Merged
AlexFigas merged 1 commit from upstream-pr/11235 into main 2026-10-27 08:21:53 +00:00
AlexFigas commented 2026-10-25 22:26:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-25T22:26:03Z.


What

AnyPS5 never starts an NpCppWebApi transaction: start and the API calls fail with SCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN. The libSceNpCppWebApi.prx bundled with PPSA21564 (sce_module/, the library's own code) shows what a transaction in that state answers:

  • The constructor of every Transaction<...> (17 instantiations, e.g. 0x3d07f0 and 0x372bb0) is vxorps xmm0, xmm0, xmm0; vmovups [rdi], xmm0; ret, which zeroes the two words at +0 and +8. start (e.g. 0x3cfcd0) is the only function that sets them, and only on success.
  • The destructor of every instantiation is a bare ret.
  • TransactionBase::finish in all 18 instantiations starts with cmp qword ptr [rdi + 8], 0 / cmp qword ptr [rdi], 0. When either word is zero it returns 0x80553508.
  • TransactionBase::abort (0xd80, 0x3c0320, 0x3bbc20, 0x3c14e0, 0x3bcde0, 0x3b98a0) makes the same checks and returns 0x80553508.
  • TransactionBase::getId (0x12f0, 0x3c05e0, 0x3bbee0, 0x3bd0a0, 0x3b9b60) makes the same checks and returns 0. The result is 64-bit (rax).

This PR changes these exports:

  • Transaction constructor and destructor for Vector<IntrusivePtr<InGameCatalog::V5::Container>> and TitleCloudStorage::V1::GetMultiDataStatusesResponseBody. These threw before. The constructor now zeroes the first 0x10 bytes, and the destructor does nothing, as in the module.
  • abort (6 instantiations) and getId (5). These threw before. They now return 0x80553508 and 0. getId is declared std::int64_t.
  • finish (18 instantiations). The two that threw and the 16 that returned 0 now return 0x80553508. A transaction never starts here, so a successful finish was a made-up result. The finish overrides of DownStreamTransaction jump to a shared body and are not changed.

The debt entries now list only the DownStreamTransaction finish overrides as silent stubs, and no longer list abort/getId as throwing.

Tested

On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), rebased onto main 74acfad65b, ctest --test-dir build -R np_cpp_web_api passes all 4 tests, 3 runs each.

guest_np_cpp_web_api_signed_out now expects 0x80553508 from finish in the existing request flows. It also checks:

  • the two new constructors zero exactly 0x10 bytes and the destructors leave them alone;
  • finish and the six aborts return 0x80553508;
  • the five getIds return 0.

Also run:

  • python3 tools/check_conventions.py --base origin/main passes.
  • python3 core/libs/tests/test_public_headers.py --audit-only verifies 368 libraries and 12368 exports.
  • python3 tools/pr_overlap.py --branch feat/npcppwebapi-never-started-transactions reports no overlap. #9015, which inserted a debt line after line 20, the line this PR edits, merged first, and this branch is rebased onto it keeping both lines; #10832 was closed.

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:5009336758 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11235). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-25T22:26:03Z. --- ### What AnyPS5 never starts an NpCppWebApi transaction: `start` and the API calls fail with `SCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN`. The `libSceNpCppWebApi.prx` bundled with PPSA21564 (`sce_module/`, the library's own code) shows what a transaction in that state answers: - **The constructor** of every `Transaction<...>` (17 instantiations, e.g. 0x3d07f0 and 0x372bb0) is `vxorps xmm0, xmm0, xmm0; vmovups [rdi], xmm0; ret`, which zeroes the two words at +0 and +8. `start` (e.g. 0x3cfcd0) is the only function that sets them, and only on success. - **The destructor** of every instantiation is a bare `ret`. - **`TransactionBase::finish`** in all 18 instantiations starts with `cmp qword ptr [rdi + 8], 0` / `cmp qword ptr [rdi], 0`. When either word is zero it returns `0x80553508`. - **`TransactionBase::abort`** (0xd80, 0x3c0320, 0x3bbc20, 0x3c14e0, 0x3bcde0, 0x3b98a0) makes the same checks and returns `0x80553508`. - **`TransactionBase::getId`** (0x12f0, 0x3c05e0, 0x3bbee0, 0x3bd0a0, 0x3b9b60) makes the same checks and returns 0. The result is 64-bit (`rax`). This PR changes these exports: - **Transaction constructor and destructor for `Vector<IntrusivePtr<InGameCatalog::V5::Container>>` and `TitleCloudStorage::V1::GetMultiDataStatusesResponseBody`.** These threw before. The constructor now zeroes the first 0x10 bytes, and the destructor does nothing, as in the module. - **`abort` (6 instantiations) and `getId` (5).** These threw before. They now return `0x80553508` and 0. `getId` is declared `std::int64_t`. - **`finish` (18 instantiations).** The two that threw and the 16 that returned 0 now return `0x80553508`. A transaction never starts here, so a successful `finish` was a made-up result. The `finish` overrides of `DownStreamTransaction` jump to a shared body and are not changed. The debt entries now list only the `DownStreamTransaction` `finish` overrides as silent stubs, and no longer list `abort`/`getId` as throwing. ### 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. --> On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), rebased onto `main` 74acfad65b, `ctest --test-dir build -R np_cpp_web_api` passes all 4 tests, 3 runs each. `guest_np_cpp_web_api_signed_out` now expects `0x80553508` from `finish` in the existing request flows. It also checks: - the two new constructors zero exactly 0x10 bytes and the destructors leave them alone; - `finish` and the six `abort`s return `0x80553508`; - the five `getId`s return 0. Also run: - `python3 tools/check_conventions.py --base origin/main` passes. - `python3 core/libs/tests/test_public_headers.py --audit-only` verifies 368 libraries and 12368 exports. - `python3 tools/pr_overlap.py --branch feat/npcppwebapi-never-started-transactions` reports no overlap. #9015, which inserted a debt line after line 20, the line this PR edits, merged first, and this branch is rebased onto it keeping both lines; #10832 was closed. ### 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
MarcZX10 commented 2026-10-25 22:30:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:30:22Z.

Review: APPROVED


Reviewed exact head 3e333ce0fc5dd45de42f49cd064a0d21a315054c. The recorded bundled-module behavior is internally consistent: a never-started transaction has two zero words, and finish/abort return 0x80553508 while getId returns zero. The implementation replaces the prior success/throwing behavior accordingly, and the test checks both newly implemented constructor layouts, all listed abort/getId instantiations, and signed-out request flows. Current-main conventions and diff-check pass; hosted product tests were skipped by path policy, and I did not rerun the author-reported WSL guest_np_cpp_web_api suite locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645685799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11235#pullrequestreview-5645685799). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T22:30:22Z. **Review:** APPROVED --- Reviewed exact head `3e333ce0fc5dd45de42f49cd064a0d21a315054c`. The recorded bundled-module behavior is internally consistent: a never-started transaction has two zero words, and `finish`/`abort` return `0x80553508` while `getId` returns zero. The implementation replaces the prior success/throwing behavior accordingly, and the test checks both newly implemented constructor layouts, all listed abort/getId instantiations, and signed-out request flows. Current-main conventions and diff-check pass; hosted product tests were skipped by path policy, and I did not rerun the author-reported WSL `guest_np_cpp_web_api` suite locally.
MarcZX10 commented 2026-10-26 06:40:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T06:40:43Z.

Review: CHANGES_REQUESTED


The code review remains sound, but the current overlap report flags this PR’s docs/dev/debt/libSceNpCppWebApi.md edits against both open #9015 and #10832. CONTRIBUTING.md requires the authors to agree on merge order and declare the prerequisite with Depends on; the checklist currently says Depends on: none. Please coordinate with both authors, update that checklist line to the agreed order, and refresh the debt-file merge if either must land first. The two production code files have no stated overlap finding. Current hosted eligibility/intake/conventions/labels/report checks pass; product jobs are skipped by path policy. I did not rerun the author-reported WSL test suite.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5648250582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11235#pullrequestreview-5648250582). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T06:40:43Z. **Review:** CHANGES_REQUESTED --- The code review remains sound, but the current overlap report flags this PR’s `docs/dev/debt/libSceNpCppWebApi.md` edits against both open #9015 and #10832. CONTRIBUTING.md requires the authors to agree on merge order and declare the prerequisite with `Depends on`; the checklist currently says `Depends on: none`. Please coordinate with both authors, update that checklist line to the agreed order, and refresh the debt-file merge if either must land first. The two production code files have no stated overlap finding. Current hosted eligibility/intake/conventions/labels/report checks pass; product jobs are skipped by path policy. I did not rerun the author-reported WSL test suite.
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!11235
No description provided.