Skip to content

feat(libSceNpMatching2): model contexts offline - #9902

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
MarrasFederico:feat/np-matching2-contexts
Oct 24, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
MarrasFederico:feat/np-matching2-contexts

Conversation

@MarrasFederico

@MarrasFederico MarrasFederico commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Builds on #9896, which implements sceNpMatching2Initialize and sceNpMatching2Terminate. #9896 is merged and this branch is merged with current main, so the diff now holds only this PR's change.

The context calls of libSceNpMatching2 threw. They now follow shadPS4's np_matching2.cpp and its context manager, offline:

  • Contexts: sceNpMatching2CreateContext returns NOT_INITIALIZED before any argument check, then refuses a null parameter, a parameter whose size is not 0x28 and a null output with INVALID_ARGUMENT. Ids 1 to 10 are handed out round-robin; an eleventh context is CONTEXT_MAX. sceNpMatching2DestroyContext and the room event, room message and signaling callback registrations answer INVALID_CONTEXT_ID for an unknown context; sceNpMatching2SetDefaultRequestOptParam checks the null option first. sceNpMatching2Terminate now also releases the contexts and restarts the ids.
  • Starting: sceNpMatching2ContextStart returns 0x804101E2 (SCE_NET_ERROR_RESOLVER_ETIMEDOUT) after the initialization check. shadPS4 returns it when there is no network and notes that the "error [was] confirmed with a real console disconnected from the internet". No context starts, so sceNpMatching2ContextStop answers CONTEXT_NOT_STARTED for a known context.

Callbacks and the default request option are checked but never used, as no event is generated offline. The room, user, world, server-id and signaling-info calls still throw: sceNpMatching2GetServerId in shadPS4 writes server id 1 from its own server, which is not an answer to copy. Nothing here is measured on a PS5 beyond shadPS4's note; the debt entry says so.

#9874 declares other libSceNpMatching2 exports and creates the same debt file as #9896; pr_overlap.py finds no conflict in Export.cpp.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON. Windows was not compiled. No title was 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

The context calls, the callback registrations and
SetDefaultRequestOptParam threw. They now follow shadPS4's checks and
context ids, ContextStart returns SCE_NET_ERROR_RESOLVER_ETIMEDOUT, the
answer shadPS4 records for a console without internet access, and
Terminate releases the contexts.
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Progress report (aeeaefa → aff9389)

📈 System libraries: 48.79% (+0.08%, +9 implemented functions)

✅ 9 implemented
Library Name
libSceNpMatching2 sceNpMatching2ContextStart
libSceNpMatching2 sceNpMatching2ContextStop
libSceNpMatching2 sceNpMatching2CreateContext
libSceNpMatching2 sceNpMatching2DestroyContext
libSceNpMatching2 sceNpMatching2RegisterContextCallback
libSceNpMatching2 sceNpMatching2RegisterRoomEventCallback
libSceNpMatching2 sceNpMatching2RegisterRoomMessageCallback
libSceNpMatching2 sceNpMatching2RegisterSignalingCallback
libSceNpMatching2 sceNpMatching2SetDefaultRequestOptParam

@MarcZX10

Copy link
Copy Markdown
Contributor

I checked the context lifecycle and offline behavior against the added test: the context set is serialized under a mutex, ids wrap across 1–10 while skipping live ids, termination clears state and resets allocation, and ContextStart consistently returns the documented offline resolver timeout before validating the id. The regression covers initialization precedence, output preservation on failed creation, capacity/wraparound, callback/options checks and reinitialization. git diff-tree --check -r passes on head 4bb91851bbcd5fcda792dd0097697c3a936d162a; current conventions/intake/labels checks pass and product build jobs are skipped. Network-driven behavior and unsupported server calls remain explicitly unimplemented/debt.

@MarcZX10

Copy link
Copy Markdown
Contributor

I also independently built and ran the exact GuestNpMatching2Offline.cpp with the PR’s libSceNpMatching2/Export.cpp under GCC 12.2 in an isolated Linux harness (NpMatching2 offline tests passed). This covers the context lifecycle/model, not the separate trophy or PS4 import integration tests.

A scope/checklist question before I can complete approval: the current three-commit diff includes offline Matching2 contexts, libSceNpTrophy game/group/trophy behavior, and import declarations for InvitationDialog and Signaling, while the PR title/body center on Matching2. CONTRIBUTING says one topic per PR. Are these all part of one documented CUSA03312 bring-up objective? If so, please identify the relevant Game bring-up discussion in the Unblocks checklist as the template requires; otherwise, please keep the distinct contributions in separate PRs and preserve the declared #9896 dependency/order. I have not run the trophy or PS4 import CTests locally.

@MarcZX10

Copy link
Copy Markdown
Contributor

Correction to my scope question in #6354074656: I compared the complete commit ancestry with #9896 and confirmed that the PS4 NP imports and Trophy changes are the exact declared prerequisite history, not separate contributions newly bundled into this PR. The Depends on: #9896 declaration is appropriate, so the request to split them or add an Unblocks entry was mistaken; I withdraw it. My independent Linux run remains limited to the new guest_np_matching2_offline test and does not cover the prerequisite’s separate tests.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@MarrasFederico

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks for the independent context test and for clarifying the prerequisite scope. Updated in d90537b, merging main while preserving the reviewed hashes: both CMake test registrations and both Signaling debt sections are retained. The full Release build and all six focused NP tests pass, including guest_np_matching2_offline and the prerequisite guest_np_ps4_imports. Depends on #9896 remains; Windows was not compiled here.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
…texts

# Conflicts:
#	core/libs/CMakeLists.txt
#	docs/dev/debt/libSceNpSignaling.md
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
danielradosa added a commit to danielradosa/AnyPS5 that referenced this pull request Oct 24, 2026
…CMakeLists.txt docs/dev/debt/libSceNpSignaling.md)
danielradosa added a commit to danielradosa/AnyPS5 that referenced this pull request Oct 24, 2026
…oykopovar#9466 in core/libs/CMakeLists.txt and libc/CMakeLists.txt: the kept-both-sides merge dropped the closing PATH line and endif() of the test block each PR's block was inserted after
@oneandonlydean
oneandonlydean merged commit 0eba9f8 into boykopovar:main Oct 24, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants