Skip to content

feat(libSceNpCppWebApi): answer the last value accessors of five APIs - #19546

Merged
oneandonlydean merged 10 commits into
boykopovar:mainfrom
Opensource55:feat/npcpp-remaining-value-accessors
Nov 14, 2026
Merged

oneandonlydean merged 10 commits into
boykopovar:mainfrom
Opensource55:feat/npcpp-remaining-value-accessors

Conversation

@Opensource55

@Opensource55 Opensource55 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Fourteen remaining stubs in libSceNpCppWebApi are single field reads of the same shapes as the ones already answered, so they are answered here from libSceNpCppWebApi.prx in Demon's Souls (PPSA01341 v01.007.000, libSceNpCppWebApi.prx sha256 d03d64abc6f82a2a6b0b9e992782f98b7f488fd225a8553132b41e23bdad5b10):

accessor module read
Activities::UserActivities::UserActivities::getActivities [rsi + 0x30], retain at +0x30
Matchmaking::PlayerForRead::getPlayerAttributes [rsi + 0x68], retain at +0x30
Matchmaking::PlayerForRead::getOnlineId 0x14 bytes from [rsi + 0x19]
Matchmaking::PlayerForOfferRead::getOnlineId 0x14 bytes from [rsi + 0x19]
Matchmaking::GetOfferResponseBody::getPlayers [rsi + 0x80], retain at +0x30
Matchmaking::GetOfferResponseBody::getLocation [rsi + 0xa8], retain at +0x00
Matchmaking::GetTicketResponseBody::getPlayers [rsi + 0xa0], retain at +0x30
Matchmaking::GetTicketResponseBody::getTicketAttributes [rsi + 0x80], retain at +0x30
Matchmaking::GetTicketResponseBody::getSubmitter [rsi + 0xf0], retain at +0x00
Leaderboards::GetRankingResponseBody::getLastUpdatedDateTime mov rax, [rdi + 0x50]
Leaderboards::RecordScoreResponseHeaders::getXPsnAtomicOperationId [rdi + 0x10], "" when null
TitleCloudStorage::DataStatus::getOwner [rsi + 0x98], retain at +0x00
SessionManager::GetUsersAccountIdPlayerSessionsInvitationsResponseBody::getInvitations [rsi + 0x30], retain at +0x30
SessionManager::GetUsersAccountIdPlayerSessionsInvitationsResponseBody::invitationsIsSet movzx eax, byte [rdi + 0x48]

The vector getters bump the reference count at 0x30, which is where every Common::Vector keeps it; the IntrusivePtr members and getOwner bump at 0x00. That difference is in the module itself: the vector getters do add rdi, 0x30 before the shared retain call and the others do not, so the split is read from the code rather than guessed from the type name.

PlayerForRead::getOnlineId reads its twenty bytes from 0x19, not 0x18: the tail word sits at 0x29, exactly 0x10 past the base. Leaderboards::Entry::getOnlineId, already implemented, has the same shape at 0x69, so the odd base is the module's own layout.

getXPsnAtomicOperationId returns the stored pointer when it is not null, and otherwise a pointer into the module's zero-filled data: the lea targets 0x5e44e8, inside the segment starting at 0x5e4000 whose file size stops at 0x5e40e0, so the fallback reads as the empty string.

The three accessors that stay throwing

GetUsersActivitiesResponse::getUsers and RecordScoreResponseBody::getTmpRank/getTmpSerialRank are not converted, although the first version of this PR converted them:

  • docs/dev/debt/libSceNpCppWebApi.md records the getUsers vector handle at +0x30 in one bundled build and +0x10 in the PPSA05347 one;
  • the same file records getTmpRank/getTmpSerialRank at +0x30/+0x34 in one build and +0x10/+0x14 in the other.

Accessors whose offsets differ between builds keep calling NotImplemented_nid_no_patch rather than special-casing one title, and the PPSA05347 module is not readable on this machine, so neither layout can be shown to be the right one.

Why the remaining offsets can be stated

Reading the 34 offsets that the debt file records from the PPSA21564 module back out of the PPSA01341 module agrees on 34 of 34 (class, method and displacement), so those two builds share one layout family and a value read from PPSA01341 is not a one-title special case. The single build that differs is PPSA05347, which is exactly the one unavailable here.

Twelve declarations were too narrow for what the module returns: eleven getters lacked the structure-return pointer their IntrusivePtr result needs (six of those also returned int), and getLastUpdatedDateTime was const void* where the module loads a 64-bit slot into rax.

The debt file gains one entry naming these fourteen accessors and their offsets, and the Activities::V1 entry now says that getActivities answers while getUsers still throws and why.

Merged with e083b03cff

main moved 242 commits while this PR was open, and the merge (a7fa006186) conflicted once, in Export.cpp: #13206 merged first and added a int(const void*) stub for Activities::UserActivities::UserActivities::getActivities in the same block where this branch answers it as the structure-returning void*(void*, const void*). The stub was dropped and the answer kept. The same commit moved ReferenceCountOffset/VectorReferenceCountOffset to the top of the file, so the two duplicate definitions here were removed in a second commit.

After the merge, the fourteen answered symbols are still all present in the NID export table (1783 entries), and git merge-tree a7fa006186 upstream/main is clean.

Tested

Windows 10 22H2 (19045), MinGW GCC 15.2.0, MinGW-Ninja build.

  • guest_np_cpp_web_api_value_accessors (new) drives the nine structure returns over a member whose object carries a live reference count, and checks the count moves from 1 to 2 at 0x00 or 0x30 depending on the member kind; a second call with the object cleared must copy the null and leave the count alone.
  • The two online ids are read from a buffer where only 0x19 onwards holds a known byte, so a base of 0x18 fails the first byte check; the twenty-first byte of the output must stay zero.
  • The timestamp is a 64-bit value with 0xff on both sides, and both branches of the operation-id getter are exercised: a stored pointer must come back unchanged, and a null member must come back as a non-null pointer to an empty string.
  • The flag byte at 0x48 is flipped on its own, and the three reverted accessors are back as NotImplemented stubs — the export list still holds 1783 NIDs, so nothing was dropped.
  • ctest -R np_cpp_web_api reports 21 of 21 on this branch after merging e083b03cff: the 20 suites main has plus this PR's own.

Checklist

Seventeen stubs left in `libSceNpCppWebApi.prx` are single field reads
of the same two shapes as the ones already answered, so they are
answered here from the module in Demon's Souls (PPSA01341):

    Activities::UserActivities::UserActivities::getActivities    0x30 (Vector)
    Activities::GetUsersActivitiesResponse::getUsers             0x30 (Vector)
    Matchmaking::PlayerForRead::getPlayerAttributes              0x68 (Vector)
    Matchmaking::PlayerForRead::getOnlineId                      0x19, 0x14 bytes
    Matchmaking::PlayerForOfferRead::getOnlineId                 0x19, 0x14 bytes
    Matchmaking::GetOfferResponseBody::getPlayers                0x80 (Vector)
    Matchmaking::GetOfferResponseBody::getLocation               0xa8 (IntrusivePtr)
    Matchmaking::GetTicketResponseBody::getPlayers               0xa0 (Vector)
    Matchmaking::GetTicketResponseBody::getTicketAttributes      0x80 (Vector)
    Matchmaking::GetTicketResponseBody::getSubmitter             0xf0 (IntrusivePtr)
    Leaderboards::GetRankingResponseBody::getLastUpdatedDateTime 0x50, 8 bytes
    Leaderboards::RecordScoreResponseBody::getTmpRank            0x30, 4 bytes
    Leaderboards::RecordScoreResponseBody::getTmpSerialRank      0x34, 4 bytes
    Leaderboards::RecordScoreResponseHeaders::getXPsnAtomicOperationId
    TitleCloudStorage::DataStatus::getOwner                      0x98 (IntrusivePtr)
    SessionManager::GetUsersAccountIdPlayerSessionsInvitations-
        ResponseBody::getInvitations                             0x30 (Vector)
    SessionManager::GetUsersAccountIdPlayerSessionsInvitations-
        ResponseBody::invitationsIsSet                           0x48

The vector getters copy the member and bump the reference count at
0x30, which is where every `Common::Vector` keeps it; the `IntrusivePtr`
members and `getOwner` bump at 0x00. That difference is in the module
itself: the vector getters do `add rdi, 0x30` before the shared retain
call and the others do not.

`PlayerForRead::getOnlineId` reads its twenty bytes from 0x19, not from
0x18 — the tail word sits at 0x29, exactly 0x10 past the base, which is
the same shape `Leaderboards::Entry::getOnlineId` already has at 0x69.

`getXPsnAtomicOperationId` returns the stored pointer when it is not
null and otherwise a pointer into the module's zero-filled data
(`0x5e44e8`, inside the segment whose file size stops at `0x5e40e0`), so
the fallback is the empty string.

The last two were left out of the SessionManager PR because they
appeared in the hunks of #16018 and #16052; reading those patches line
by line shows both use the symbol as context only, so nothing there
implements it and it belongs here.

Thirteen declarations were too narrow for what the module returns.
Seven vector getters lacked the structure-return pointer their
`IntrusivePtr` result needs, and six of those also returned `int`.
`getOnlineId` twice, `getLocation` and `getSubmitter` returned `int`,
`getOwner` took no structure-return pointer, and
`getLastUpdatedDateTime` was `const void*` where the module loads a
64-bit slot into `rax`.

`guest_np_cpp_web_api_value_accessors` drives the twelve structure
returns over a member whose object carries a live reference count and
checks the count moves to two at 0x00 or 0x30, reads the online ids from
0x19 and checks the twenty copied bytes against a neighbour that must
not travel, writes a 64-bit timestamp and two 32-bit ranks with `0xff`
neighbours, checks both branches of the operation-id getter, and flips
the one flag byte at 0x48.

The library moves from 1641 to 1658 answered symbols of the 1762 it
exports and the patched prx still exports the same 1762 NIDs; all 18
suites of this library pass.
Three of the seventeen accessors this branch converted have offsets the
debt file records differently for another bundled build, so they go back
to `NotImplemented_nid_no_patch`:

    GetUsersActivitiesResponse::getUsers        +0x30 here, +0x10 in PPSA05347
    RecordScoreResponseBody::getTmpRank         +0x30 here, +0x10 in PPSA05347
    RecordScoreResponseBody::getTmpSerialRank   +0x34 here, +0x14 in PPSA05347

The PPSA05347 module is not readable on this machine, so neither layout
can be shown to be the right one, and an accessor that reads unrelated
memory for a title linked against the other layout must keep throwing
rather than special-case one build. Fourteen accessors remain.

What the module here can support is the opposite direction: reading the
34 offsets that the debt entries record from PPSA21564 back out of the
PPSA01341 module agrees on 34 of 34, class, method and displacement, so
those two builds share one layout family and the values this branch
writes down are not PPSA01341-only.

The debt file gains one entry naming the fourteen accessors and their
offsets, and the `Activities::V1` entry now says that `getActivities`
returns the handle at +0x30 in both measurable builds while `getUsers`
still throws, because its handle is the one that moves.

`guest_np_cpp_web_api_value_accessors` drops the rows for the three
reverted accessors; the library answers 1655 of its 1762 exports and the
patched prx still exports the same 1762 NIDs.
…imit

`tools/check_conventions.py` warns on a debt entry over 1000 characters,
and the entries this branch added ran to 1026 and 1178. They are shorter
and split in two: one for the Matchmaking, Leaderboards and
TitleCloudStorage accessors, one for the SessionManager invitation pair.
The `Activities::V1` sentence about `getActivities` answering while
`getUsers` throws is tightened the same way.
@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 5294a5cbd1, merged onto main 60c460cc55 (7a6de18b9e, 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_value_accessors passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 16018 core/libs/prx/libSceNpCppWebApi/Export.cpp L2444-2448
core/libs/prx/libSceNpCppWebApi/include/Api.hpp L416-417
PR 16052 core/libs/prx/libSceNpCppWebApi/Export.cpp L2444-2448
core/libs/prx/libSceNpCppWebApi/include/Api.hpp L416-417

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Progress report (0774340 → e919319)

📈 System libraries: 40.58% (+0.04%, +14 implemented functions)

✅ 14 implemented
Library Name
libSceNpCppWebApi _ZN3sce2Np9CppWebApi10Activities2V114UserActivities14UserActivities13getActivitiesEv
libSceNpCppWebApi _ZN3sce2Np9CppWebApi11Matchmaking2V113PlayerForRead19getPlayerAttributesEv
libSceNpCppWebApi _ZN3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody10getPlayersEv
libSceNpCppWebApi _ZN3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody10getPlayersEv
libSceNpCppWebApi _ZN3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody19getTicketAttributesEv
libSceNpCppWebApi _ZN3sce2Np9CppWebApi14SessionManager2V154GetUsersAccountIdPlayerSessionsInvitationsResponseBody14getInvitationsEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V113PlayerForRead11getOnlineIdEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V118PlayerForOfferRead11getOnlineIdEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V120GetOfferResponseBody11getLocationEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi11Matchmaking2V121GetTicketResponseBody12getSubmitterEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi12Leaderboards2V122GetRankingResponseBody22getLastUpdatedDateTimeEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi12Leaderboards2V19RecordApi26RecordScoreResponseHeaders24getXPsnAtomicOperationIdEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi14SessionManager2V154GetUsersAccountIdPlayerSessionsInvitationsResponseBody16invitationsIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi17TitleCloudStorage2V110DataStatus8getOwnerEv

Changed libraries (implemented exports)

Library Before After Change
libSceNpCppWebApi 1405/1799 (78.10%) 1419/1799 (78.88%) +0.78%

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label 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 conflict is the tail of `libSceNpCppWebApi/CMakeLists.txt`, where main
gained the DateTime and string blocks from the two merged PRs while this
branch appends its own. All three stay and the file registers fifteen
suites.

`Export.cpp`, `Api.hpp` and the debt file merged without help: the
fourteen accessors this branch answers are still converted, `getUsers`,
`getTmpRank` and `getTmpSerialRank` still call
`NotImplemented_nid_no_patch` as the review asked, and the declaration
corrections this branch carries are intact. `guest_np_cpp_web_api_*` is
20 of 20 after the merge.
@ycbuzi

ycbuzi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Tested 7aaeff1a65 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 2 tests failed out of 5411; 99% tests passed, 2 tests failed out of 5411. 2 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 5411; 100% tests passed, 0 tests failed out of 5411. run

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@Opensource55

Copy link
Copy Markdown
Contributor Author

Merged e083b03cff (a7fa006186). One conflict, in Export.cpp: #13206 landed first with a int(const void*) stub for Activities::UserActivities::UserActivities::getActivities, which this branch answers as void*(void*, const void*). The stub is dropped and the answer kept. That commit also moved ReferenceCountOffset/VectorReferenceCountOffset to the top of the file, so the duplicate definitions on this branch are removed in a follow-up commit.

After the merge: 14 of 14 answered symbols are in the NID export table (1783 entries), ctest -R np_cpp_web_api is 21 of 21, check_conventions.py passes, and git merge-tree a7fa006186 upstream/main is clean. The body now carries those numbers.

Thanks @ycbuzi for the full suite on 7aaeff1a65 — the fourteen answers are unchanged; only the merge commit and the constant cleanup are new.

@Opensource55

Copy link
Copy Markdown
Contributor Author

The windows job on a7fa006186 is red on agc_shader_memory (Timeout at the 120 s limit), 1 of 4520 tests; public_headers 35.4 s is only a warning. Nothing in this branch touches AGC — the diff is Export.cpp, Api.hpp, tests/GuestNpCppWebApiValueAccessors.cpp and the debt file.

Same window and same family on #19481 (agc_shader_empty_table_resolution) and #19526 (agc_shader_memory), so it is the runner, not the diff. I cannot rerun (403, admin only) — a rerun on your side should clear it.

@Opensource55

Copy link
Copy Markdown
Contributor Author

Merged c7102526b5 (3ae0c364e7), 393 commits since the base this branch carried. The merge was clean: no conflict in Export.cpp, the test lists or the debt file.

Re-verified on the merged tree, not on the old one: ninja builds the unpatched and the NID-patched prx; 14 of 14 answered symbols are in the export table (1783 entries); ctest -R np_cpp_web_api is 21 of 21; check_conventions.py passes.

The windows job on the previous head was red on agc_shader_memory timing out at the 120 s ctest limit (1 of 4520 tests), which is why I asked for a rerun rather than changing anything. I cannot rerun jobs from this account (403 Must have admin rights), so the push above is also the way to get a fresh run. If the new one lands green, nothing else in the branch changed.

@Opensource55

Opensource55 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Saw your merge 95d9d5a881 on this branch. I have not touched it: my local branch is reset to your commit and nothing was added on top, so what is pushed is what you left. I had prepared the same CMakeLists resolution locally; that version is discarded.

State of your tree, checked rather than assumed: both registrations are intact — this branch's value_accessors and main's leaderboards_board_definition — 16 add_test entries in total, ctest -R np_cpp_web_api 22 of 22, the 14 answered symbols in the NID export table (1783 entries), and check_conventions.py passes.

Since your merge, main moved to 3e63c9f68f. This branch already contains 8c8a6a2d89, so it is two commits behind; nothing those two touch is used here, and git merge-tree --write-tree against upstream/main is clean.

# Conflicts:
#	core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
@Opensource55

Copy link
Copy Markdown
Contributor Author

Merged 32a2f1e1d7 (e919319). 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. Both registrations were kept — this branch's value_accessors and main's session_manager_values — with add_test(NAME counting 17, main's 16 plus this PR's own.

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_shader_disk_cache_large_file 32.6 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.

@oneandonlydean
oneandonlydean merged commit b756dbb into boykopovar:main Nov 14, 2026
13 checks passed
@Opensource55
Opensource55 deleted the feat/npcpp-remaining-value-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.

4 participants