Files
AnyPS5/docs/dev/debt/libSceNpMatching2.md
T
zaryabzip 078b64c6fb feat(libSceNpMatching2): answer the request checks, local and signaling calls offline as firmware 13.42 does
Firmware 13.42, run natively, checks six requests' arguments before the
context; a request that passes them still throws, because the run could
not show how the module completes it. LeaveRoom finds no session, the
local getters report the context as not started, and the signaling calls
find no peer. The signaling port is stored and reported.
2026-10-31 04:30:59 +05:00

20 lines
9.2 KiB
Markdown

# libSceNpMatching2 technical debt
### Unknown function info
- [sceNpMatching2CreateContextInternal, sceNpMatching2CreateJoinRoomA, sceNpMatching2GetLobbyInfoList, sceNpMatching2GetLobbyMemberDataInternal, sceNpMatching2GetLobbyMemberDataInternalList, sceNpMatching2GetMemoryInfo, sceNpMatching2GetRoomMemberDataExternalList, sceNpMatching2GetRoomMemberIdListLocal, sceNpMatching2GetRoomPasswordLocal, sceNpMatching2GetSignalingOptParamLocal](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - names and NIDs are present in the [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceNpMatching2.c), but no credible prototypes were found. The declarations have no parameters solely to resolve known imports; this is not an ABI claim and callers must not call them until signatures are verified
- [sceNpMatching2GetSslMemoryInfo, sceNpMatching2GetUserInfoListA, sceNpMatching2GrantRoomOwner, sceNpMatching2JoinLobby, sceNpMatching2JoinRoomA, sceNpMatching2LeaveLobby, sceNpMatching2RegisterManualUdpSignalingCallback, sceNpMatching2SendLobbyChatMessage, sceNpMatching2SetExtraInitParam, sceNpMatching2SetLobbyMemberDataInternal, sceNpMatching2SetRoomDataInternalExt](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - names and NIDs are present in the [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceNpMatching2.c), but no credible prototypes were found. The declarations have no parameters solely to resolve known imports; this is not an ABI claim and callers must not call them until signatures are verified
- [sceNpMatching2SetSignalingOptParam, sceNpMatching2SignalingAbortConnection, sceNpMatching2SignalingCancelPeerNetInfo, sceNpMatching2SignalingEnableManualUdpMode, sceNpMatching2SignalingEstablishConnection, sceNpMatching2SignalingGetLocalNetInfo, sceNpMatching2SignalingGetPeerNetInfo, sceNpMatching2SignalingGetPeerNetInfoResult](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - names and NIDs are present in the [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceNpMatching2.c), but no credible prototypes were found. The declarations have no parameters solely to resolve known imports; this is not an ABI claim and callers must not call them until signatures are verified
### Functional
- [sceNpMatching2Initialize, sceNpMatching2Terminate](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - only the library state is kept: initialization checks the parameter's `size` field (0x28, or 0x30 with an SSL pool) as [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/81be949167d0060b08f26dc3e055a0b640d129c8/src/core/libraries/np/np_matching2/np_matching2.cpp) does and starts no thread; a second initialization returns `ALREADY_INITIALIZED` and a termination without one `NOT_INITIALIZED`. The pool, thread and SSL settings are not used: no matching server is reached. Not measured on a console
- [sceNpMatching2CreateContext and the context calls](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - offline only, not measured on a PS5: the checks follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/91e6afa69b0a64b0afaa0281b80f8fbb0cd88136/src/core/libraries/np/np_matching2/np_matching2.cpp#L26-L349) and its [context manager](https://github.com/shadps4-emu/shadPS4/blob/91e6afa69b0a64b0afaa0281b80f8fbb0cd88136/src/core/libraries/np/np_matching2/np_matching2_internal.cpp#L1348-L1457) (a `0x28`-byte parameter, ten ids handed out round-robin). `sceNpMatching2ContextStart` returns `0x804101E2` (`SCE_NET_ERROR_RESOLVER_ETIMEDOUT`), which shadPS4 says was confirmed on a console disconnected from the internet, so no context starts and `sceNpMatching2ContextStop` answers `CONTEXT_NOT_STARTED`. Callbacks and the default request option are checked but never used. The room, user, world, server-id and signaling-info calls still throw
- [sceNpMatching2CreateContextA](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - offline only: the A parameter (user id, service label, then a `size` of 0x10) and its checks follow a [later shadPS4](https://github.com/shadps4-emu/shadPS4/blob/0614ce324be092791b758d79f93d9f1ca5b10a81/src/core/libraries/np/np_matching2/np_matching2.cpp#L48-L71), and the user id is unused. The context takes the next of the same ten slots with 0x100 added: firmware 13.42, [run natively](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501291543), gave context 1 to `sceNpMatching2CreateContext` and 258 (0x0102) to the `sceNpMatching2CreateContextA` after it. That the 0x100 marks A contexts, and that slot 2 alone does not name the A context, are read from that single pair
- [sceNpMatching2RegisterLobbyEventCallback, sceNpMatching2RegisterLobbyMessageCallback](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - offline only, not measured on a PS5: checked like the room callbacks, as shadPS4 does ([event](https://github.com/shadps4-emu/shadPS4/blob/0614ce324be092791b758d79f93d9f1ca5b10a81/src/core/libraries/np/np_matching2/np_matching2.cpp#L166-L183), [message](https://github.com/shadps4-emu/shadPS4/blob/0614ce324be092791b758d79f93d9f1ca5b10a81/src/core/libraries/np/np_matching2/np_matching2.cpp#L654-L672)), and never called: no lobby is joined offline
- [sceNpMatching2SignalingGetConnectionStatus, sceNpMatching2AbortContextStart](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - not measured on a console. With no room joined offline, the status call writes 0 (inactive) and returns 0 for a known context, as [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/core/libraries/np/np_matching2/np_matching2.cpp#L569-L637) does; the PS3 module in [RPCS3](https://github.com/RPCS3/rpcs3/blob/c365ea76a552961ff078ea1a46da9d4b07729674/rpcs3/Emu/Cell/Modules/sceNp2.cpp#L449-L952) also writes inactive but returns `INVALID_ROOM_ID`. A null status pointer throws (shadPS4 skips the write, RPCS3 returns `INVALID_ARGUMENT`); peer address and port are never written. The abort returns `NOT_INITIALIZED` before initialization, as RPCS3 does, and 0 for any context id, as both do
- [sceNpMatching2GetWorldInfoList, sceNpMatching2SetUserInfo, sceNpMatching2SetRoomDataExternal, sceNpMatching2SetRoomDataInternal, sceNpMatching2GetRoomDataInternal, sceNpMatching2SignalingGetPingInfo](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - follow firmware 13.42 [run natively](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501291543) on never-started contexts: initialization, a null parameter, then its leading server id (`INVALID_SERVER_ID`) or room id (`INVALID_ROOM_ID`) come before the context (`CONTEXT_NOT_FOUND`). A request that passes these checks throws: the run accepted it and handed out a request id counted from 1, but with its worker threads stopped it could not show how the module completes, calls back or cancels the request offline. Not reproduced or measured: the checks on the rest of each parameter and a null request id (refused with the parameter, as in shadPS4)
- [sceNpMatching2LeaveRoom](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - checked like the room requests above, then returns `SESSION_NOT_FOUND` (0x80550C3A) on a known context and `CONTEXT_NOT_FOUND` on an unknown one, as firmware 13.42 [did](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501700641), and room 0 gives `INVALID_ROOM_ID` on any context
- [sceNpMatching2GetServerId, sceNpMatching2GetRoomJoinedSlotMaskLocal, sceNpMatching2GetWorldIdArrayForAllServers](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - no context starts offline, so a known context gets what firmware 13.42 [returned](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501291543) for a created, never-started one, writing nothing: `CONTEXT_NOT_STARTED`, `CONTEXT_NOT_STARTED` and `SERVER_NOT_AVAILABLE` (0x80550C28). An unknown context gives `CONTEXT_NOT_FOUND`. The first two refuse a null output before the context; room 0 gives 0x80550C0C on a known context ([measured](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501700641)). The third checks the context first, then its pointers. Assumed: that initialization is checked first, as in the request calls, the widths of the third call's arguments and which of its pointers it checks
- [sceNpMatching2SignalingGetConnectionInfo, sceNpMatching2SignalingGetConnectionInfoA, sceNpMatching2SignalingGetPort, sceNpMatching2SignalingSetPort](../../../core/libs/prx/libSceNpMatching2/Export.cpp) (libSceNpMatching2) - as firmware 13.42 [did](https://github.com/boykopovar/AnyPS5/pull/12623#issuecomment-6501291543) with no context started: the connection info calls refuse a null `info` with 0x80550E15, then answer 0x80550E19 (no peer) for a known context and 0x80550E05 for an unknown one; the null check of the non-A form and the answer before initialization are not measured. The signaling port starts at 0 and `SetPort` stores what `GetPort` reports. Neither checks initialization here, and `GetPort` writes through its pointer with no null check, as the module does per its disassembly