Repository navigation
feat(libSceNpCppWebApi): read size and operator[] of the Sku, Container and PlayerSession vectors from host bodies - #11248
Conversation
…er and PlayerSession vectors from host bodies
MarcZX10
left a comment
There was a problem hiding this comment.
I checked the shared helpers against the existing VectorBody layout and append/destructor paths. HostVectorSize handles a null body and rejects foreign bodies; HostVectorElement additionally restricts access to the intrusive-pointer element kind. The four exports use the helper matching their ABI, and the new test exercises null/owned/foreign bodies, contiguous order, and retained references. The lack of an operator[] bounds check matches the documented operator[] behavior and the bundled module evidence.
git diff --check and current-main conventions pass. The author reports the focused np_cpp_web_api CTest suite passing 4/4 under Ubuntu 24.04/WSL2. I did not rerun the product test locally because the available build is relinker-only; hosted product jobs are skipped by policy. No concrete defect found.
|
Windows run of this head
AI-assisted: yes (Claude Code) |
|
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.
|
What
Four
Vectoraccessors wereNotImplementedstubs:Vector<IntrusivePtr<InGameCatalog::V5::Sku>>::sizeVector<IntrusivePtr<InGameCatalog::V5::Container>>::sizeVector<IntrusivePtr<InGameCatalog::V5::Container>>::operator[]Vector<IntrusivePtr<SessionManager::V1::PlayerSession>>::operator[]They now do what the
empty,sizeandoperator[]of the other element types already do, which theVectordebt entries describe:sizereturns 0 for a vector that has no body and the element count of a body this library created. It throws on any other body.operator[]returns the element of a body this library created that holdsIntrusivePtrelements. It throws when the vector has no body or holds anything else.Two shared helpers,
HostVectorSizeandHostVectorElement, hold this logic.The module bundled with PPSA21564 (
sce_module/libSceNpCppWebApi.prx, the library's own code) computes the same values on its own layout:Vector<...Sku>::size(0xc23d0),Vector<...Container>::size(0xa8290)(end - begin) / 0x18, from[rdi + 0x28] - [rdi + 0x18]Vector<...Container>::operator[](0xa8390),Vector<...PlayerSession>::operator[](0x287f50)begin + index * 0x18, no bounds checkoperator[]here has no bounds check either.The
sizeofVector<IntrusivePtr<UserProfile::V1::BasicPresence>>and ofVector<unsigned long>is the same one-liner. I left it out because the UserProfile debt line that says they throw sits next to the line #10832 rewrites. It can follow once that PR lands.Tested
On Ubuntu 24.04 under WSL2 (GCC 13.3, Release),
ctest --test-dir build -R np_cpp_web_apipasses all 4 tests.guest_np_cpp_web_api_offlinegainsTestVectorSizeAndElements, which checks:sizes return 0 for a vector without a body, and bothoperator[]s throw on one;pushBacks through theJoinableUservector, bothsizes return 2, and bothoperator[]s return the two elements in order and next to each other;Also run:
python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch feat/npcppwebapi-vector-size-and-indexreports no overlap.git merge-treeagainst fix(npcppwebapi): preserve aliased inputs during growth #9612, fix(libSceNpCppWebApi): count Vector<String> and Vector<unsigned long> references where the bundled module does #10925, feat(libSceNpCppWebApi): iterate Vector<String> with begin, end and the Iterator<String> operators #11221, fix(libSceNpCppWebApi): answer finish, abort and getId for never-started transactions as the module does #11235, feat(libSceNpCppWebApi): fail the InGameCatalog and TitleCloudStorage transactions signed out #10832 and feat(libSceNpCppWebApi): cover the UserProfile models and remaining Common instantiations #9015 merges cleanly.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)