feat(libs): implement NpCppWebApi IntrusivePtr construction, copy, release and access #631
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/631"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DotDebian on 2026-10-05T09:18:56Z.
What
sce::Np::CppWebApi::Common::IntrusivePtr<T>in the HLElibSceNpCppWebApi: the 26 members already exported (7 default constructors, 2 copy constructors, 8 destructors, 9operator->, 1operator*) were either no-ops that left the guest object uninitialised orNotImplemented. They now behave as the library does:+0x00object,+0x08deletervoid(*)(T*)(may be null),+0x10LibContext*;operator->/operator*return the object pointer, null included;LibContext*is kept). With other references left the three fields are not modified.The reference count is the 32-bit
RefObjectcounter of the pointee: at+0x00for the Leaderboards request/response bodies,UserandRecordScoreResponseHeaders, at+0x30forVector<IntrusivePtr<Entry>>.Not implemented, still throws: the last-reference release of a pointer without a deleter. The library then runs
T's destructor and frees the object from theLibContextmemory pool; the HLE has neither. It cannot be reached today since every factory and request returnsSCE_NP_WEBAPI_ERROR_UNAVAILABLEand no object is ever created.Nothing else in the file changes:
String,Binary,Vector, iterators,LibContext,initialize/terminateand the transactions are untouched, and nothing is added at the end of the file (#545 and #407 append there). #630 implementsCommon::Stringon other lines of the same file; the two are independent.Source of the behaviour. There is no public description of this class, so the layout and the semantics above were read from a disassembly of the retail
libSceNpCppWebApi.prxbundled with one title (a local dump, one build of the module). Export names were matched by hashing the mangled names to their NIDs. No code, listing or data from the module is in this PR.+0x30counter offset for theVectorinstantiation.RefObject(the helpers called hash toRefObject::AddRefandRefObject::Release); that the third field is theLibContext*(it is what the no-deleter path resolves to find the pool).The origin of the layout and the remaining gap are recorded in
docs/dev/TechnicalDebt.md.This only affects titles that run on the HLE module. The relinker converts a title's own
sce_module/libSceNpCppWebApi.prxto a guest module and resolves imports against it first, so a title that ships the library does not reach this code.Tested
Windows 11, MinGW-w64 GCC 15.2.0,
ctest. New testguest_np_cpp_web_api_intrusive_ptr(core/libs/tests/GuestNpCppWebApiIntrusivePtr.cpp) calls all 26 exports on pre-filled memory and fake pointees: zeroing, field copy and count increment, null copy, accessors on null and non-null, destructor on null / shared / last reference with the deleter recorded, counter at+0x30for theVectorinstantiation, and the throw on a last reference without a deleter. It aborts onmainand passes with this change.Full suite: 280 of 282 pass.
agc_driver_f32_output_modifierandagc_driver_scalar_sop1fail on this machine (NVIDIA GPU); both are AGC shader execution tests that link onlylibSceAgcDriverandlibc, which this PR does not change.No title was run.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T09:19:21Z.
Progress report (
53dc19c→f2fb785)📈 System libraries: 79.2% (+0.06%, +10 implemented, -8 reverted functions)
✅ 10 implemented
_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V121GetRankingRequestBodyEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V122GetRankingResponseBodyEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V122RecordScoreRequestBodyEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V123RecordScoreResponseBodyEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V130GetBoardDefinitionResponseBodyEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V14UserEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V15EntryEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V19RecordApi26RecordScoreResponseHeadersEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS2_6BinaryEEptEv_ZNK3sce2Np9CppWebApi6Common12IntrusivePtrINS2_6VectorINS3_INS1_12Leaderboards2V15EntryEEEEEEdeEv⚠️ 8 went back to stubs
_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V121GetRankingRequestBodyEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V122GetRankingResponseBodyEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V122RecordScoreRequestBodyEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V123RecordScoreResponseBodyEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V130GetBoardDefinitionResponseBodyEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V14UserEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_12Leaderboards2V19RecordApi26RecordScoreResponseHeadersEED1Ev_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS2_6VectorINS3_INS1_12Leaderboards2V15EntryEEEEEED1Ev