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

Merged
AlexFigas merged 1 commit from upstream-pr/11635 into main 2026-10-28 02:27:48 +00:00
AlexFigas commented 2026-10-27 00:31:54 +00:00 (Migrated from github.com)

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


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 5bc84038c4, 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 #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:

  • python3 tools/check_conventions.py --base origin/main passes.
  • python3 tools/pr_overlap.py --branch feat/npcppwebapi-sessionmanager-parameter-lifecycles reports no overlap.
  • git merge-tree against #10925, #11221 and #11631 merges cleanly. #11235, which edits the same debt file, has merged, and this commit rebased onto it without a conflict.

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:5026732454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11635). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-27T00:31:54Z. --- ### 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 <!-- 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 `TestSessionManagerParameterLifecycles`: - **Create, Join and Leave** go through `TestParameterLifecycle`, the sequence from #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: - `python3 tools/check_conventions.py --base origin/main` passes. - `python3 tools/pr_overlap.py --branch feat/npcppwebapi-sessionmanager-parameter-lifecycles` reports no overlap. - `git merge-tree` against #10925, #11221 and #11631 merges cleanly. #11235, which edits the same debt file, has merged, and this commit rebased onto it without a conflict. ### 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-27 01:11:13 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


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

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661111849 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11635#pullrequestreview-5661111849). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T01:11:13Z. **Review:** CHANGES_REQUESTED --- 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).
MarcZX10 commented 2026-10-27 11:02:03 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed exact head 7054872694. 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5665974636 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11635#pullrequestreview-5665974636). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T11:02:03Z. **Review:** APPROVED --- Reviewed exact head 7054872694e9d1cc130962ffaf406bd67371cbca. 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.
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!11635
No description provided.