Skip to content

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

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
AlexFigas:feat/npcppwebapi-leaderboards-parameter-lifecycles
Oct 28, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
AlexFigas:feat/npcppwebapi-leaderboards-parameter-lifecycles

Conversation

@AlexFigas

@AlexFigas AlexFigas commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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 5bc8403, 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:

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 (feat(libSceNpCppWebApi): track the SessionManager V1 parameter lifecycles as the module does #11635 has merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

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

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.

@github-actions github-actions Bot added docs prx needs rebase Conflicts with main, rebase needed labels Oct 27, 2026
@AlexFigas
AlexFigas force-pushed the feat/npcppwebapi-leaderboards-parameter-lifecycles branch from 23c3b4c to a62e4fa Compare October 27, 2026 09:09
@AlexFigas

Copy link
Copy Markdown
Contributor Author

@MarcZX10 #11235 has merged. This PR is rebased onto main 5bc8403 (a62e4fa), keeping #11235's Common entry above this PR's Leaderboards entry. Nothing else overlaps, and the 4 np_cpp_web_api tests pass at this commit.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 27, 2026
@AlexFigas
AlexFigas requested a review from MarcZX10 October 27, 2026 10:37

@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 exact head a62e4fa. 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.

@maskym

maskym commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows result for head a62e4fae0a, merged into main f759e165d9 (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 #11724, #11644, #11639, #11635, #11630, #11353, #11347, #11221, #10925, #11706, #11693, #11686, #11682, all merged cleanly, so the run is a joint one; the tests of this PR are guest_np_cpp_web_api_offline (0.05 s), all passed (the batch's mapped tests: 16/16, plus 43/43 for the Ngs2 and host-import suites). Not run on a PS5.

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

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the five Leaderboards::V1 parameter lifecycles against the helpers merged with #11635 (same check order and codes, 0x80553512 for an empty RecordScoreRequestBody), the Api.hpp signatures, the debt entry, and that TestLeaderboardsParameterLifecycles pins codes that main returned 0 for. Confirmed by @MarcZX10 (qemu run) and @maskym (Windows); merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants