feat(libSceNpMatching2): answer signaling connection status and context start abort offline #12013

Merged
simnJS merged 1 commit from upstream-pr/12013 into main 2026-10-28 09:54:00 +00:00
simnJS commented 2026-10-27 17:06:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simnJS on 2026-10-27T17:06:24Z.


What

Two libSceNpMatching2 exports that Hasbro Family Fun Pack (CUSA03312) imports (#9896, discussions/7198) threw NotImplemented on main. They now answer within the offline context model the library already follows:

  • int sceNpMatching2SignalingGetConnectionStatus(u16 ctxId, u64 roomId, u16 memberId, s32* connStatus, void* peerAddr, u16* peerPort)
    • Returns NOT_INITIALIZED before sceNpMatching2Initialize and INVALID_CONTEXT_ID for an unknown or destroyed context. In both cases the outputs are left as they were.
    • For a known context it writes 0 (inactive) and returns 0. No context starts offline (sceNpMatching2ContextStart returns the resolver timeout), so no room is ever joined. This is what shadPS4 answers for a member outside a room.
    • The peer address and port are never written: shadPS4 writes them only for a member in a room.
    • A null connStatus throws after the initialization check. The references disagree on it: shadPS4 skips the write, and RPCS3's PS3 module returns INVALID_ARGUMENT.
  • int sceNpMatching2AbortContextStart(u16 ctxId)
    • Returns NOT_INITIALIZED before initialization, as RPCS3 does.
    • Returns 0 for any context id, as shadPS4 and RPCS3 both do. Neither checks the id, and no start is ever pending offline. The context's state is unchanged.

The signatures follow shadPS4's declarations (np_matching2.h, np_types2.h: context id u16, room id u64, member id u16).

Not measured on a console. The debt entry records the one disagreement the implementation follows shadPS4 on: for a room it does not know, RPCS3's PS3 module also writes inactive but returns INVALID_ROOM_ID. Both names leave the "no credible prototypes" lists in docs/dev/debt/libSceNpMatching2.md.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release, BUILD_TESTING=ON, on main c547deaacb. No title run: the importing title is a PS4 title, which needs #6977 to start.

  • guest_np_matching2_offline (extended) and guest_np_ps4_imports: pass, 20 runs each on this head (ctest --repeat until-fail:10 twice, with a rebuild in between).
  • The new cases cover:
    • both calls before initialization and after termination;
    • abort on a known and an unknown context, and the context's start state after the abort;
    • the inactive status, with the peer address and port left untouched;
    • null peer outputs;
    • unknown and destroyed contexts, with the status left untouched;
    • a null status throwing for a known and an unknown context.
  • Control: with main's throwing bodies put back (same signatures, so the test compiles), guest_np_matching2_offline fails with sceNpMatching2AbortContextStart not implemented (exit 0xc0000409).
  • public_headers and public_headers_compile_*: 65/65 pass.
  • python tools/check_conventions.py --base origin/main with this title and body: all checks pass. python tools/pr_overlap.py --branch feat/npmatching2-signaling-status: no overlap. #11904 also adds checks to GuestNpMatching2Offline.cpp; git merge-tree of this head and its head 5be476d442 is clean.

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:5038014777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12013). Originally posted by [simnJS](https://github.com/simnJS) on 2026-10-27T17:06:24Z. --- ### What Two `libSceNpMatching2` exports that Hasbro Family Fun Pack (CUSA03312) imports (#9896, discussions/7198) threw `NotImplemented` on `main`. They now answer within the offline context model the library already follows: - `int sceNpMatching2SignalingGetConnectionStatus(u16 ctxId, u64 roomId, u16 memberId, s32* connStatus, void* peerAddr, u16* peerPort)` - Returns `NOT_INITIALIZED` before `sceNpMatching2Initialize` and `INVALID_CONTEXT_ID` for an unknown or destroyed context. In both cases the outputs are left as they were. - For a known context it writes 0 (inactive) and returns 0. No context starts offline (`sceNpMatching2ContextStart` returns the resolver timeout), so no room is ever joined. This is what [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/core/libraries/np/np_matching2/np_matching2.cpp#L569-L602) answers for a member outside a room. - The peer address and port are never written: shadPS4 writes them only for a member in a room. - A null `connStatus` throws after the initialization check. The references disagree on it: shadPS4 skips the write, and [RPCS3's PS3 module](https://github.com/RPCS3/rpcs3/blob/c365ea76a552961ff078ea1a46da9d4b07729674/rpcs3/Emu/Cell/Modules/sceNp2.cpp#L449-L472) returns `INVALID_ARGUMENT`. - `int sceNpMatching2AbortContextStart(u16 ctxId)` - Returns `NOT_INITIALIZED` before initialization, as [RPCS3](https://github.com/RPCS3/rpcs3/blob/c365ea76a552961ff078ea1a46da9d4b07729674/rpcs3/Emu/Cell/Modules/sceNp2.cpp#L940-L952) does. - Returns 0 for any context id, as [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/core/libraries/np/np_matching2/np_matching2.cpp#L634-L637) and RPCS3 both do. Neither checks the id, and no start is ever pending offline. The context's state is unchanged. The signatures follow shadPS4's declarations (`np_matching2.h`, `np_types2.h`: context id `u16`, room id `u64`, member id `u16`). Not measured on a console. The debt entry records the one disagreement the implementation follows shadPS4 on: for a room it does not know, RPCS3's PS3 module also writes inactive but returns `INVALID_ROOM_ID`. Both names leave the "no credible prototypes" lists in `docs/dev/debt/libSceNpMatching2.md`. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release, `BUILD_TESTING=ON`, on `main` `c547deaacb`. No title run: the importing title is a PS4 title, which needs #6977 to start. - `guest_np_matching2_offline` (extended) and `guest_np_ps4_imports`: pass, 20 runs each on this head (`ctest --repeat until-fail:10` twice, with a rebuild in between). - The new cases cover: - both calls before initialization and after termination; - abort on a known and an unknown context, and the context's start state after the abort; - the inactive status, with the peer address and port left untouched; - null peer outputs; - unknown and destroyed contexts, with the status left untouched; - a null status throwing for a known and an unknown context. - Control: with `main`'s throwing bodies put back (same signatures, so the test compiles), `guest_np_matching2_offline` fails with `sceNpMatching2AbortContextStart not implemented` (exit `0xc0000409`). - `public_headers` and `public_headers_compile_*`: 65/65 pass. - `python tools/check_conventions.py --base origin/main` with this title and body: all checks pass. `python tools/pr_overlap.py --branch feat/npmatching2-signaling-status`: no overlap. #11904 also adds checks to `GuestNpMatching2Offline.cpp`; `git merge-tree` of this head and its head `5be476d442` is clean. ### Checklist - [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
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!12013
No description provided.