Repository navigation
feat(libSceNpCppWebApi): answer the last value accessors of five APIs - #19546
oneandonlydean merged 10 commits into
Conversation
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.
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
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.
|
Progress report (0774340 → e919319)📈 System libraries: 40.58% (+0.04%, +14 implemented functions) ✅ 14 implemented
Changed libraries (implemented exports)
|
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.
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
|
Merged After the merge: 14 of 14 answered symbols are in the NID export table (1783 entries), Thanks @ycbuzi for the full suite on |
|
The Same window and same family on #19481 ( |
|
Merged Re-verified on the merged tree, not on the old one: The |
|
Saw your merge State of your tree, checked rather than assumed: both registrations are intact — this branch's Since your merge, |
# Conflicts: # core/libs/prx/libSceNpCppWebApi/CMakeLists.txt
|
Merged Re-verified on the merged tree: The |
What
Fourteen remaining stubs in
libSceNpCppWebApiare single field reads of the same shapes as the ones already answered, so they are answered here fromlibSceNpCppWebApi.prxin Demon's Souls (PPSA01341 v01.007.000,libSceNpCppWebApi.prxsha256d03d64abc6f82a2a6b0b9e992782f98b7f488fd225a8553132b41e23bdad5b10):Activities::UserActivities::UserActivities::getActivities[rsi + 0x30], retain at +0x30Matchmaking::PlayerForRead::getPlayerAttributes[rsi + 0x68], retain at +0x30Matchmaking::PlayerForRead::getOnlineId[rsi + 0x19]Matchmaking::PlayerForOfferRead::getOnlineId[rsi + 0x19]Matchmaking::GetOfferResponseBody::getPlayers[rsi + 0x80], retain at +0x30Matchmaking::GetOfferResponseBody::getLocation[rsi + 0xa8], retain at +0x00Matchmaking::GetTicketResponseBody::getPlayers[rsi + 0xa0], retain at +0x30Matchmaking::GetTicketResponseBody::getTicketAttributes[rsi + 0x80], retain at +0x30Matchmaking::GetTicketResponseBody::getSubmitter[rsi + 0xf0], retain at +0x00Leaderboards::GetRankingResponseBody::getLastUpdatedDateTimemov rax, [rdi + 0x50]Leaderboards::RecordScoreResponseHeaders::getXPsnAtomicOperationId[rdi + 0x10],""when nullTitleCloudStorage::DataStatus::getOwner[rsi + 0x98], retain at +0x00SessionManager::GetUsersAccountIdPlayerSessionsInvitationsResponseBody::getInvitations[rsi + 0x30], retain at +0x30SessionManager::GetUsersAccountIdPlayerSessionsInvitationsResponseBody::invitationsIsSetmovzx eax, byte [rdi + 0x48]The vector getters bump the reference count at 0x30, which is where every
Common::Vectorkeeps it; theIntrusivePtrmembers andgetOwnerbump at 0x00. That difference is in the module itself: the vector getters doadd rdi, 0x30before 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::getOnlineIdreads 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.getXPsnAtomicOperationIdreturns the stored pointer when it is not null, and otherwise a pointer into the module's zero-filled data: theleatargets0x5e44e8, inside the segment starting at0x5e4000whose file size stops at0x5e40e0, so the fallback reads as the empty string.The three accessors that stay throwing
GetUsersActivitiesResponse::getUsersandRecordScoreResponseBody::getTmpRank/getTmpSerialRankare not converted, although the first version of this PR converted them:docs/dev/debt/libSceNpCppWebApi.mdrecords thegetUsersvector handle at +0x30 in one bundled build and +0x10 in the PPSA05347 one;getTmpRank/getTmpSerialRankat +0x30/+0x34 in one build and +0x10/+0x14 in the other.Accessors whose offsets differ between builds keep calling
NotImplemented_nid_no_patchrather 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
IntrusivePtrresult needs (six of those also returnedint), andgetLastUpdatedDateTimewasconst void*where the module loads a 64-bit slot intorax.The debt file gains one entry naming these fourteen accessors and their offsets, and the
Activities::V1entry now says thatgetActivitiesanswers whilegetUsersstill throws and why.Merged with
e083b03cffmainmoved 242 commits while this PR was open, and the merge (a7fa006186) conflicted once, inExport.cpp: #13206 merged first and added aint(const void*)stub forActivities::UserActivities::UserActivities::getActivitiesin the same block where this branch answers it as the structure-returningvoid*(void*, const void*). The stub was dropped and the answer kept. The same commit movedReferenceCountOffset/VectorReferenceCountOffsetto 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/mainis 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.0xffon 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.NotImplementedstubs — the export list still holds 1783 NIDs, so nothing was dropped.ctest -R np_cpp_web_apireports 21 of 21 on this branch after merginge083b03cff: the 20 suitesmainhas plus this PR's own.Checklist
main; no other open PR implements the same functions — the three open PRs that touch thisExport.cpp(feat(libSceNpCppWebApi): allocate String, Vector and IntrusivePtr objects from the LibContext #16018, feat(libSceNpCppWebApi): implement the shared transaction bookkeeping #16052 and feat(npcppwebapi): add InGameCatalog V5 Container and Sku accessors #19674) define none of these symbols, checked line by line against their patches; feat(libSceNpCppWebApi): complete the InGameCatalog and Leaderboards offline surface #13206 has since merged and added a stub forgetActivities, dropped here in favour of this branch's answerNotImplemented_nid_no_patch); the three conflicted accessors are back to throwing.mdfiles or images added to the repository — the debt file is updated in place