feat(libSceNpCppWebApi): track the Leaderboards V1 parameter lifecycles as the module does #11636
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11636"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-27T00:37:32Z.
What
Five
Leaderboards::V1parameter classes kept no state:BoardsApi::ParameterToGetBoardDefinitionRecordApi::ParameterToRecordLargeDataRecordApi::ParameterToRecordScoreViewApi::ParameterToGetLargeDataByObjectIdViewApi::ParameterToGetRankingTheir constructors left the object untouched.
initializeandterminatewere declared without parameters and returned 0. Soinitializeaccepted a nullLibContext, a missing object ID, an empty request body and a second call, andterminateaccepted 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.ParameterBaseconstructor zeroes +0, then+8 = 0ConstructParameterinitializeLibContext→0x80553503; context not found →0x80553502;+8 != 0→0x8055350f; then allocates, runsParameterBase::initializeand stores the argumentsInitializeParameter, same checks in the same orderGetBoardDefinition(0xcbc10),GetRanking(0xf01e0)initialize(LibContext*, int)GetLargeDataByObjectId(0xed970),RecordLargeData(0xe0350)initialize(…, const char*)String::copyFromof the object ID; a null one gives0x80553503and undoes everythingRecordScoreinitialize(LibContext*, int, IntrusivePtr<RecordScoreRequestBody>)(0xe2360)ParameterBase::terminate, frees the implementation and returns0x80553512InitializeParameterWithBodyterminate(0xcbd40, 0xe0530, 0xe2760, 0xedb50, 0xf0350)+8 == 0→0x80553510; otherwise frees it,+8 = 0TerminateParametersetxPsnAtomicOperation(0xe28c0),setgetRankingRequestBody(0xf04a0)+8 != 0and return nothingNo argument is kept, because only a request would read one, and requests fail with
SCE_NP_WEBAPI_ERROR_NOT_SIGNED_INhere.These definitions come before the helpers in
Export.cpp, so the helpers gain forward declarations at the top of theextern "C"block.Api.hppnow declares the members with their real parameters. The Leaderboards::V1 debt entry now covers only the request-body setters andUsersetters, and records what these five classes keep.Tested
On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), rebased onto
main5bc84038c4,ctest --test-dir build -R np_cpp_web_apipasses all 4 tests (2 runs).guest_np_cpp_web_api_offlinegainsTestLeaderboardsParameterLifecycles. It runs each class throughTestParameterLifecycle:terminatereturns0x80553510beforeinitialize;initializereturns0x80553503for a null context and0x80553502for a contextCommon::initializehas not set;0x80553503and an emptyRecordScoreRequestBodygives0x80553512, both leaving the parameter uninitialized;initializethen succeeds and a second call returns0x8055350f;terminatesucceeds once and again after a newinitialize.Also run:
python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch feat/npcppwebapi-leaderboards-parameter-lifecyclesreported #11235 atdocs/dev/debt/libSceNpCppWebApi.mdL5-7, theCommonentry above the Leaderboards one. #11235 has merged, and this branch is rebased onto it, keeping itsCommonentry above this PR's Leaderboards entry.git merge-treeagainst #10925, #11221 and #11631 merges cleanly.main.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)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.mdand says whichever lands second will be rebased.CONTRIBUTING.mdasks overlapping PRs to agree which goes first and declare that ordering withDepends 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-treeconfirms the debt-document edits conflict if combined as currently submitted.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_teststarget and ran it underqemu-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.