Skip to content

feat(libSceNpCppWebApi): track the SessionManager V1 parameter lifecycles as the module does - #11635

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
AlexFigas:feat/npcppwebapi-sessionmanager-parameter-lifecycles
Oct 28, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
AlexFigas:feat/npcppwebapi-sessionmanager-parameter-lifecycles

Conversation

@AlexFigas

@AlexFigas AlexFigas commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Four SessionManager::V1::PlayerSessionsApi parameter classes returned 0 from every member and kept no state:

  • ParameterToCreatePlayerSessions
  • ParameterToGetPlayerSessionInvitations
  • ParameterToJoinPlayerSessionAsPlayer
  • ParameterToLeavePlayerSession

So initialize accepted a null LibContext, missing arguments 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), the same way #11252 made the TitleCloudStorage and InGameCatalog parameters do.

In the module, each of these objects is {ParameterBase implementation at +0, class implementation at +8}:

Member Module Here
constructor (0x294920, 0x2999a0, 0x29cd30, 0x29fbc0) ParameterBase constructor zeroes +0, then +8 = 0 ConstructParameter zeroes +0 and +8
initialize (0x294980, 0x299a00, 0x29cd90, 0x29fc20) null LibContext → 0x80553503; context not found → 0x80553502; +8 != 0 → 0x8055350f. It then allocates, runs ParameterBase::initialize and String::copyFrom of each string argument; a null string gives 0x80553503 and undoes everything InitializeParameter, same checks in the same order
initialize with a request body (Create, Join) after the strings, an IntrusivePtr body whose object is null runs ParameterBase::terminate, frees the implementation and returns 0x80553512 the new InitializeParameterWithBody: the same result, and the parameter stays uninitialized
setinvitationInvalidFilter (0x299e70) +8 == 0 → 0x80553502; otherwise String::copyFrom, 0x80553503 for null SetParameterText
terminate (0x294d20, 0x29d170, 0x29fe50) ParameterBase::terminate; +8 == 0 → 0x80553510; otherwise frees it and sets +8 = 0 TerminateParameter
destructor (0x294940, 0x2999c0, 0x29cd50, 0x29fbe0) jmp ParameterBase::~ParameterBase does nothing

A few things are not kept:

  • Values. No string or body is stored; only a request would read them, and requests fail with SCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN here.
  • setfields (0x299d20). The module stores the vector only once initialized and returns nothing; here it stays a no-op.
  • GetPlayerSessionInvitations::terminate. It is not exported here, so this PR does not add it.

Api.hpp now declares these members with their real parameters. The SessionManager::V1 debt entry now says which members keep only their initialized state and which setters still store nothing.

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 TestSessionManagerParameterLifecycles:

  • Create, Join and Leave go through TestParameterLifecycle, the sequence from feat(libSceNpCppWebApi): track the TitleCloudStorage and InGameCatalog parameter lifecycles as the module does #11252:

    • the constructor zeroes exactly 0x10 bytes;
    • terminate returns 0x80553510 before initialize;
    • initialize returns 0x80553503 for a null context and 0x80553502 for a context that Common::initialize has not set;
    • a missing string gives 0x80553503 and leaves the parameter uninitialized;
    • initialize then succeeds, a second call returns 0x8055350f, and terminate works once and again after a new initialize.

    Create and Join also check 0x80553512 for an empty request body. The helper now accepts a class without a string setter, and checks that a failed initialize changed nothing through terminate rather than the setter.

  • GetPlayerSessionInvitations runs the same checks without terminate, through setinvitationInvalidFilter.

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
  • 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 appears consistent with the module behavior and the declared tests. I found one contribution-rule issue in the overlap report: the PR says its merge-tree check against #11235 is clean, but a current merge-tree check reports a conflict in docs/dev/debt/libSceNpCppWebApi.md. Comparing the three versions shows both PRs edit the SessionManager2V1 debt entry. CONTRIBUTING.md requires overlapping PRs to agree which goes first and declare that order with Depends on. Please coordinate with #11235 and update the overlap report/checklist to record the agreed order (or correct the report if the overlap has since been resolved).

@AlexFigas
AlexFigas force-pushed the feat/npcppwebapi-sessionmanager-parameter-lifecycles branch from 7c8d0b0 to 7054872 Compare October 27, 2026 09:09
@AlexFigas

Copy link
Copy Markdown
Contributor Author

@MarcZX10 #11235 has merged. This PR is rebased onto main 5bc8403 (7054872), and the commit applied without a conflict, so no order is left to declare. git merge-tree against #10925, #11221 and #11631 is clean, the 4 np_cpp_web_api tests pass, and the description's overlap report is corrected.

@AlexFigas
AlexFigas requested a review from MarcZX10 October 27, 2026 10:37
@adriadam10 adriadam10 self-assigned this Oct 27, 2026

@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 7054872. The shared lifecycle helpers check context, initialization state, missing arguments/body, and terminate state in the order described from the bundled module; constructors initialize the object state, and failures leave it uninitialized. The debt entry records that string/body contents remain unretained while requests are unsupported offline. I found no correctness issue in the scoped lifecycle behavior.

Independent local check: built guest_np_cpp_web_api_offline_tests; it passed under qemu-x86_64 -cpu max. Native execution is blocked by this host's AVX2/FMA guard; the author reports all four focused WebApi tests passing natively on WSL, and the hosted Windows check passes. Main has advanced four commits beyond the PR's base, but none touched these files; please bring the stack up to current main before merge per the branch-currency rule. This approval covers the reviewed code and test evidence, not the required rebase.

@maskym

maskym commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows result for head 7054872694, 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, #11636, #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 constructor, initialize (null context, unset context, already initialized, null string, empty request body), terminate and setinvitationInvalidFilter against the lifecycle pattern merged for TitleCloudStorage and the module codes cited; the new test pins each code and fails on main, where every member returned 0. The overlap point raised by @MarcZX10 is resolved since #11235 merged and this rebases cleanly; 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