Skip to content

feat(libSceNpCppWebApi): answer the Matchmaking response-body accessors - #19484

Merged
oneandonlydean merged 9 commits into
boykopovar:mainfrom
Opensource55:feat/npcpp-matchmaking-response-accessors
Nov 14, 2026
Merged

oneandonlydean merged 9 commits into
boykopovar:mainfrom
Opensource55:feat/npcpp-matchmaking-response-accessors

Conversation

@Opensource55

Copy link
Copy Markdown
Contributor

What

Answers 14 accessors of the Matchmaking response bodies that the console reduces to a single field read. Offsets come from the decrypted libSceNpCppWebApi.prx of Demon's Souls (PPSA01341):

GetOfferResponseBody::getStatus            mov eax, dword ptr [rdi + 0x9c]
GetOfferResponseBody::statusIsSet          movzx eax, byte ptr [rdi + 0xa0]
GetOfferResponseBody::offerIdIsSet         movzx eax, byte ptr [rdi + 0x50]
GetOfferResponseBody::rulesetNameIsSet     movzx eax, byte ptr [rdi + 0x78]
GetOfferResponseBody::playersIsSet         movzx eax, byte ptr [rdi + 0x98]
GetOfferResponseBody::locationIsSet        movzx eax, byte ptr [rdi + 0xc0]
GetTicketResponseBody::getStatus           mov eax, dword ptr [rdi + 0xbc]
GetTicketResponseBody::statusIsSet         movzx eax, byte ptr [rdi + 0xc0]
GetTicketResponseBody::ticketIdIsSet       movzx eax, byte ptr [rdi + 0x50]
GetTicketResponseBody::rulesetNameIsSet    movzx eax, byte ptr [rdi + 0x78]
GetTicketResponseBody::ticketAttributesIsSet movzx eax, byte ptr [rdi + 0x98]
GetTicketResponseBody::playersIsSet        movzx eax, byte ptr [rdi + 0xb8]
GetTicketResponseBody::submitterIsSet      movzx eax, byte ptr [rdi + 0x108]
SubmitTicketResponseBody::ticketIdIsSet    movzx eax, byte ptr [rdi + 0x50]

Each flag is anchored by the neighbouring accessor that is already implemented against the same module, so the numbers are a layout rather than a list:

  • GetOfferResponseBody::getOfferId and GetTicketResponseBody::getTicketId are lea rax, [rdi + 0x30]; both flags at 0x50 close a 32-byte String.
  • The two getRulesetName accessors are lea rax, [rdi + 0x58], and both flags at 0x78 close another.
  • getStatus reads a 4-byte value at 0x9c / 0xbc, and the matching flag is the byte immediately after it, 0xa0 / 0xc0.

include/Api.hpp is untouched: every one of these already returns int, and the reads are 1 or 4 bytes wide.

Not included: getCreatedDateTime, getUpdatedDateTime, getMaxScoreLimit, getMinScoreLimit in this family. The module returns them in rax as 64-bit values while the tree declares int, so they need a declaration change and belong in their own PR rather than here.

Tested

Windows 10 19045, MinGW GCC 15.2, Release.

  • New guest_np_cpp_web_api_matchmaking_response test: a buffer whose byte i holds i, so a wrong offset, a wrong width or a constant answer fails. getStatus and statusIsSet are also re-checked after rewriting their bytes, so the values track memory. Passes.
  • All 14 symbols appear as NID exports in the built build/core/libs/libs/libSceNpCppWebApi.prx.
  • tools/progress.py --module libSceNpCppWebApi moves from 1332 to 1346 with nothing else changing.
  • tools/check_conventions.py --base upstream/main passes.

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

`libSceNpCppWebApi.prx` answers these 14 accessors with one field read:

    GetOfferResponseBody::getStatus              mov eax, [rdi + 0x9c]
    GetOfferResponseBody::statusIsSet            movzx eax, byte [rdi + 0xa0]
    GetOfferResponseBody::offerIdIsSet           movzx eax, byte [rdi + 0x50]
    GetOfferResponseBody::rulesetNameIsSet       movzx eax, byte [rdi + 0x78]
    GetOfferResponseBody::playersIsSet           movzx eax, byte [rdi + 0x98]
    GetOfferResponseBody::locationIsSet          movzx eax, byte [rdi + 0xc0]
    GetTicketResponseBody::getStatus             mov eax, [rdi + 0xbc]
    GetTicketResponseBody::statusIsSet           movzx eax, byte [rdi + 0xc0]
    GetTicketResponseBody::ticketIdIsSet         movzx eax, byte [rdi + 0x50]
    GetTicketResponseBody::rulesetNameIsSet      movzx eax, byte [rdi + 0x78]
    GetTicketResponseBody::ticketAttributesIsSet movzx eax, byte [rdi + 0x98]
    GetTicketResponseBody::playersIsSet          movzx eax, byte [rdi + 0xb8]
    GetTicketResponseBody::submitterIsSet        movzx eax, byte [rdi + 0x108]
    SubmitTicketResponseBody::ticketIdIsSet      movzx eax, byte [rdi + 0x50]

Each flag is anchored by its own accessor in the same module, so the
offsets form a layout instead of a list: `getOfferId` and `getTicketId`
are `lea rax, [rdi + 0x30]` and the flags at `0x50` close a 32-byte
`String`; both `getRulesetName` accessors are `lea rax, [rdi + 0x58]`
with the flags at `0x78`; `getStatus` reads four bytes at `0x9c` / `0xbc`
and its flag is the immediately following byte.

`include/Api.hpp` is untouched, since all 14 already return `int` and the
reads are 1 or 4 bytes wide.

The `getCreatedDateTime`, `getUpdatedDateTime`, `getMaxScoreLimit` and
`getMinScoreLimit` accessors of this family are left alone: the module
returns them in `rax` as 64-bit values while the tree declares `int`, so
they need a declaration change and a separate PR.

`guest_np_cpp_web_api_matchmaking_response` fills a buffer whose byte i
holds i and checks all 14, then rewrites the status bytes to prove the
values track memory. The library's measured count moves from 1332 to
1346, and all 14 appear as NID exports in the patched prx.
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Opensource55 the accessors are small and the test is a good one (byte i holds i). Two things before this can land:

  1. The offsets come from one module, the PPSA01341 build of libSceNpCppWebApi. The neighbouring Leaderboards entry in docs/dev/debt/libSceNpCppWebApi.md records that offsets in this library differ between SDK builds (getTmpRank is +0x30 in one module and +0x10 in another, which is why it still throws). The Account-ID and Activity entries take their layouts from the modules bundled with PPSA21564 and PPSA05347 and say they agree. Could you read these 14 offsets in the PPSA21564 module as well, since it imports the Matchmaking::V1 exports, and in a second build if you have one? If they agree, say so; if any differ, leave that accessor throwing.
  2. The PR adds no debt entry. Please add one under Functional next to the Account-ID entry: which modules the offsets were read from, that they were inspected statically and not run, that the layouts beyond these fields are unverified, and that the four 64-bit accessors (getCreatedDateTime and the others) stay throwing.

@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 8e4abdf9f7, merged onto main 174899a5cc (a02849feac, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_np_cpp_web_api_matchmaking_response passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

The fourteen flag and status accessors this branch answers had no debt
entry, and the `Matchmaking::V1` entry still says response accessors
throw. The new entry lists each accessor with its offset, says they were
inspected statically and not executed, and states that they were read
from the PPSA01341 v01.007.000 build only, because no Matchmaking member
is among the offsets this file records from PPSA21564.

It also records the boundary the reviewer named: the value getters of the
fields these flags guard, the objects' other fields, their construction
and any console value are unverified, and the four 64-bit DateTime
accessors belong to the sibling PR rather than this one.
@Opensource55

Copy link
Copy Markdown
Contributor Author

Both points are in dbe93a8919.

1. A second module. I cannot read one. The PPSA21564 sce_module copy on this machine is a SELF container (4f 15 3d 1d …), not a plain ELF, and there is no PPSA05347 or PPSA20397 dump at all — so "read the 14 offsets in the PPSA21564 module as well" cannot be met here, and I would rather say that than quote numbers I cannot reproduce.

What I did instead is check the direction of the difference, because that decides whether these fourteen are PPSA01341-only or family-wide: reading the 34 offsets this debt file records from PPSA21564 back out of the PPSA01341 module agrees on 34 of 34 (class, method and displacement). Those 34 are SessionManager::V1 members plus four Leaderboards accessors and two Activities ones; no Matchmaking member is among them, so that agreement is evidence that the two builds share a layout family — not a per-member measurement of these fourteen. The entry therefore records that they were read from the PPSA01341 build only, which is the fallback your point allows, and does not claim a second build.

2. The debt entry. Added next to the Account-ID entry, as asked. It lists all fourteen with offsets (GetOfferResponseBody offerIdIsSet +0x50, rulesetNameIsSet +0x78, getStatus +0x9c, statusIsSet +0xa0, playersIsSet +0x98, locationIsSet +0xc0; GetTicketResponseBody ticketIdIsSet +0x50, rulesetNameIsSet +0x78, ticketAttributesIsSet +0x98, playersIsSet +0xb8, getStatus +0xbc, statusIsSet +0xc0, submitterIsSet +0x108; SubmitTicketResponseBody::ticketIdIsSet +0x50), says they were inspected statically and not run, says the value getters those flags guard and the objects' other fields stay unverified, and points at the sibling PR for the four 64-bit DateTime accessors so the two entries cannot contradict each other after both merge.

The entry this branch added ran to 1191 characters, past the 1000 the
conventions check warns at. It is tighter now: the accessors and their
offsets are unchanged, the DateTime cross-reference is gone because the
sibling PR gives those eight their own entry, and the note that these
fourteen are one-build only is stated once.
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Progress report (f8627a5 → 4becfe3)

📈 System libraries: 40.64% (+0.03%, +14 implemented functions)

✅ 14 implemented
Library Name
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody11statusIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody12offerIdIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody12playersIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody13locationIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody16rulesetNameIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody9getStatusEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody11statusIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody12playersIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody13ticketIdIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody14submitterIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody16rulesetNameIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody21ticketAttributesIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody9getStatusEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V124SubmitTicketResponseBody13ticketIdIsSetEv

Changed libraries (implemented exports)

Library Before After Change
libSceNpCppWebApi 1419/1799 (78.88%) 1433/1799 (79.66%) +0.78%

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed docs labels Nov 13, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 13, 2026
The only conflict is the tail of `libSceNpCppWebApi/CMakeLists.txt`, where
both sides append a `BUILD_TESTING` block. Both blocks are kept: the two
that main gained from the DateTime and string PRs stay in their order and
this branch's `guest_np_cpp_web_api_matchmaking_response` block goes after
them.

`Export.cpp` merged without help and each of the fourteen accessors this
branch answers is still converted, with no implementation that main has
gained since dropped; `guest_np_cpp_web_api_*` is 20 of 20 after the merge.
…accessors' into feat/npcpp-matchmaking-response-accessors

# Conflicts:
#	core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 14, 2026
# Conflicts:
#	core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
# Conflicts:
#	core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
@Opensource55

Copy link
Copy Markdown
Contributor Author

Merged 32a2f1e1d7 (008c9bc). main moved 14 commits; the only overlap is core/libs/prx/libSceNpCppWebApi/CMakeLists.txt, because #19526 landed its own session_manager_values block at the same spot. The two blocks were kept in order, each closed with its own set_tests_properties(... ...)/endif(); add_test(NAME now counts 17, i.e. main's 16 plus this PR's matchmaking_response.

Re-verified on the merged tree: 14 of 14 answered symbols are in the NID export table (1783 entries), ctest -R np_cpp_web_api is 23 of 23, check_conventions.py passes, and git merge-tree --write-tree HEAD upstream/main is clean.

The windows job on the previous head is red on the 30 s test-duration guideline, not on this branch: agc_graphics_profile_draw 30.7 s. Nothing here touches AGC. I cannot rerun jobs from this account (403 Must have admin rights); this push is also what triggers a fresh run.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 16018 core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
core/libs/prx/libSceNpCppWebApi/Export.cpp
docs/dev/debt/libSceNpCppWebApi.md
PR 16052 core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
core/libs/prx/libSceNpCppWebApi/Export.cpp
docs/dev/debt/libSceNpCppWebApi.md

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 14, 2026
@oneandonlydean
oneandonlydean merged commit a8e4204 into boykopovar:main Nov 14, 2026
13 checks passed
@Opensource55
Opensource55 deleted the feat/npcpp-matchmaking-response-accessors branch November 15, 2026 04:59
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.

3 participants