feat(libSceNpCppWebApi): track the Leaderboards V1 parameter lifecycles as the module does #11636

Merged
AlexFigas merged 2 commits from upstream-pr/11636 into main 2026-10-28 14:19:12 +00:00
AlexFigas commented 2026-10-27 00:37:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-27T00:37:32Z.


What

Five Leaderboards::V1 parameter classes kept no state:

  • BoardsApi::ParameterToGetBoardDefinition
  • RecordApi::ParameterToRecordLargeData
  • RecordApi::ParameterToRecordScore
  • ViewApi::ParameterToGetLargeDataByObjectId
  • ViewApi::ParameterToGetRanking

Their constructors left the object untouched. initialize and terminate were declared without parameters and returned 0. So initialize accepted a null LibContext, a missing object ID, an empty request body and a second call, and terminate accepted a parameter that was never initialized. They now follow the module bundled with PPSA21564 (sce_module/libSceNpCppWebApi.prx, the library's own code), with the helpers from #11635.

Member Module Here
constructor (0xcbbb0, 0xe02f0, 0xe2300, 0xed910, 0xf0180) ParameterBase constructor zeroes +0, then +8 = 0 ConstructParameter
initialize null LibContext → 0x80553503; context not found → 0x80553502; +8 != 0 → 0x8055350f; then allocates, runs ParameterBase::initialize and stores the arguments InitializeParameter, same checks in the same order
GetBoardDefinition (0xcbc10), GetRanking (0xf01e0) initialize(LibContext*, int) stores the board ID; nothing else is checked the board ID is not kept
GetLargeDataByObjectId (0xed970), RecordLargeData (0xe0350) initialize(…, const char*) String::copyFrom of the object ID; a null one gives 0x80553503 and undoes everything same result
RecordScore initialize(LibContext*, int, IntrusivePtr<RecordScoreRequestBody>) (0xe2360) an empty body runs ParameterBase::terminate, frees the implementation and returns 0x80553512 InitializeParameterWithBody
terminate (0xcbd40, 0xe0530, 0xe2760, 0xedb50, 0xf0350) +8 == 0 → 0x80553510; otherwise frees it, +8 = 0 TerminateParameter
setxPsnAtomicOperation (0xe28c0), setgetRankingRequestBody (0xf04a0) store the value only when +8 != 0 and return nothing unchanged no-ops

No argument is kept, because only a request would read one, and requests fail with SCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN here.

These definitions come before the helpers in Export.cpp, so the helpers gain forward declarations at the top of the extern "C" block. Api.hpp now declares the members with their real parameters. The Leaderboards::V1 debt entry now covers only the request-body setters and User setters, and records what these five classes keep.

Tested

On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), rebased onto main 5bc84038c4, ctest --test-dir build -R np_cpp_web_api passes all 4 tests (2 runs). guest_np_cpp_web_api_offline gains TestLeaderboardsParameterLifecycles. It runs each class through TestParameterLifecycle:

  • the constructor zeroes exactly 0x10 bytes;
  • terminate returns 0x80553510 before initialize;
  • initialize returns 0x80553503 for a null context and 0x80553502 for a context Common::initialize has not set;
  • a null object ID gives 0x80553503 and an empty RecordScoreRequestBody gives 0x80553512, both leaving the parameter uninitialized;
  • initialize then succeeds and a second call returns 0x8055350f;
  • terminate succeeds once and again after a new initialize.

Also run:

  • python3 tools/check_conventions.py --base origin/main passes.
  • python3 tools/pr_overlap.py --branch feat/npcppwebapi-leaderboards-parameter-lifecycles reported #11235 at docs/dev/debt/libSceNpCppWebApi.md L5-7, the Common entry above the Leaderboards one. #11235 has merged, and this branch is rebased onto it, keeping its Common entry above this PR's Leaderboards entry. git merge-tree against #10925, #11221 and #11631 merges cleanly.
  • The branch was stacked on #11635, for its helpers and the neighbouring SessionManager entry. #11635 has merged, so only this PR's commit is left on top of main.

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 (#11635 has merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5026777304 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11636). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-27T00:37:32Z. --- ### What Five `Leaderboards::V1` parameter classes kept no state: - `BoardsApi::ParameterToGetBoardDefinition` - `RecordApi::ParameterToRecordLargeData` - `RecordApi::ParameterToRecordScore` - `ViewApi::ParameterToGetLargeDataByObjectId` - `ViewApi::ParameterToGetRanking` Their constructors left the object untouched. `initialize` and `terminate` were declared without parameters and returned 0. So `initialize` accepted a null `LibContext`, a missing object ID, an empty request body and a second call, and `terminate` accepted a parameter that was never initialized. They now follow the module bundled with PPSA21564 (`sce_module/libSceNpCppWebApi.prx`, the library's own code), with the helpers from #11635. | Member | Module | Here | |---|---|---| | constructor (0xcbbb0, 0xe02f0, 0xe2300, 0xed910, 0xf0180) | `ParameterBase` constructor zeroes +0, then `+8 = 0` | `ConstructParameter` | | `initialize` | null `LibContext` → `0x80553503`; context not found → `0x80553502`; `+8 != 0` → `0x8055350f`; then allocates, runs `ParameterBase::initialize` and stores the arguments | `InitializeParameter`, same checks in the same order | | `GetBoardDefinition` (0xcbc10), `GetRanking` (0xf01e0) `initialize(LibContext*, int)` | stores the board ID; nothing else is checked | the board ID is not kept | | `GetLargeDataByObjectId` (0xed970), `RecordLargeData` (0xe0350) `initialize(…, const char*)` | `String::copyFrom` of the object ID; a null one gives `0x80553503` and undoes everything | same result | | `RecordScore` `initialize(LibContext*, int, IntrusivePtr<RecordScoreRequestBody>)` (0xe2360) | an empty body runs `ParameterBase::terminate`, frees the implementation and returns `0x80553512` | `InitializeParameterWithBody` | | `terminate` (0xcbd40, 0xe0530, 0xe2760, 0xedb50, 0xf0350) | `+8 == 0` → `0x80553510`; otherwise frees it, `+8 = 0` | `TerminateParameter` | | `setxPsnAtomicOperation` (0xe28c0), `setgetRankingRequestBody` (0xf04a0) | store the value only when `+8 != 0` and return nothing | unchanged no-ops | No argument is kept, because only a request would read one, and requests fail with `SCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN` here. These definitions come before the helpers in `Export.cpp`, so the helpers gain forward declarations at the top of the `extern "C"` block. `Api.hpp` now declares the members with their real parameters. The Leaderboards::V1 debt entry now covers only the request-body setters and `User` setters, and records what these five classes keep. ### 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` 5bc84038c4, `ctest --test-dir build -R np_cpp_web_api` passes all 4 tests (2 runs). `guest_np_cpp_web_api_offline` gains `TestLeaderboardsParameterLifecycles`. It runs each class through `TestParameterLifecycle`: - the constructor zeroes exactly 0x10 bytes; - `terminate` returns `0x80553510` before `initialize`; - `initialize` returns `0x80553503` for a null context and `0x80553502` for a context `Common::initialize` has not set; - a null object ID gives `0x80553503` and an empty `RecordScoreRequestBody` gives `0x80553512`, both leaving the parameter uninitialized; - `initialize` then succeeds and a second call returns `0x8055350f`; - `terminate` succeeds once and again after a new `initialize`. Also run: - `python3 tools/check_conventions.py --base origin/main` passes. - `python3 tools/pr_overlap.py --branch feat/npcppwebapi-leaderboards-parameter-lifecycles` reported #11235 at `docs/dev/debt/libSceNpCppWebApi.md` L5-7, the `Common` entry above the Leaderboards one. #11235 has merged, and this branch is rebased onto it, keeping its `Common` entry above this PR's Leaderboards entry. `git merge-tree` against #10925, #11221 and #11631 merges cleanly. - The branch was stacked on #11635, for its helpers and the neighbouring SessionManager entry. #11635 has merged, so only this PR's commit is left on top of `main`. ### 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 (#11635 has merged) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 01:05:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T01:05:35Z.

Review: CHANGES_REQUESTED


The lifecycle implementation and its dependency on #11635 look coherent. One repository-rule item remains: this PR reports an overlapping edit with open #11235 in docs/dev/debt/libSceNpCppWebApi.md and says whichever lands second will be rebased. CONTRIBUTING.md asks overlapping PRs to agree which goes first and declare that ordering with Depends on. Please coordinate the order with #11235 and record the agreed dependency in this PR checklist (or explain if the overlap has been resolved). git merge-tree confirms the debt-document edits conflict if combined as currently submitted.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661078833 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11636#pullrequestreview-5661078833). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T01:05:35Z. **Review:** CHANGES_REQUESTED --- The lifecycle implementation and its dependency on #11635 look coherent. One repository-rule item remains: this PR reports an overlapping edit with open #11235 in `docs/dev/debt/libSceNpCppWebApi.md` and says whichever lands second will be rebased. `CONTRIBUTING.md` asks overlapping PRs to agree which goes first and declare that ordering with `Depends on`. Please coordinate the order with #11235 and record the agreed dependency in this PR checklist (or explain if the overlap has been resolved). `git merge-tree` confirms the debt-document edits conflict if combined as currently submitted.
MarcZX10 commented 2026-10-27 11:02:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T11:02:11Z.

Review: APPROVED


Reviewed exact head a62e4fae0a. The Leaderboards V1 lifecycle changes use the same helpers already reviewed in #11635, and add the correct context/initialized checks plus the measured missing-body error for RecordScore. The focused tests cover constructors, invalid contexts/arguments, double initialization, terminate-before-init, and reinitialization.

Independent local check: built the exact guest_np_cpp_web_api_offline_tests target and ran it under qemu-x86_64 -cpu max; it passed. The author reports the full focused WebApi test set passing on native WSL, and hosted Windows passed. This PR depends on #11635. Main has advanced four commits from its base, with no changes to these paths; please update the dependency stack before merge per the branch-currency rule. No additional defect found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5665976083 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11636#pullrequestreview-5665976083). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T11:02:11Z. **Review:** APPROVED --- Reviewed exact head a62e4fae0a512e93c117c3118c2738a16b8d02be. The Leaderboards V1 lifecycle changes use the same helpers already reviewed in #11635, and add the correct context/initialized checks plus the measured missing-body error for RecordScore. The focused tests cover constructors, invalid contexts/arguments, double initialization, terminate-before-init, and reinitialization. Independent local check: built the exact `guest_np_cpp_web_api_offline_tests` target and ran it under `qemu-x86_64 -cpu max`; it passed. The author reports the full focused WebApi test set passing on native WSL, and hosted Windows passed. This PR depends on #11635. Main has advanced four commits from its base, with no changes to these paths; please update the dependency stack before merge per the branch-currency rule. No additional defect found.
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!11636
No description provided.