feat(libs): implement NpCppWebApi Common::String constructor, destructor and c_str #630
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/630"
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:13:37Z.
What
sce::Np::CppWebApi::Common::Stringin libSceNpCppWebApi. Onmainthe constructor is a silent stub that leaves the guest object uninitialised, andc_str()throws.String(LibContext*)initialises the object: reference count 0, null buffer, buffer size 0, the context pointer.c_str()returns the buffer, or an empty string when the buffer is null. It never returns null.~String()writes nothing for a null buffer. A non-null buffer has to be released through theLibContextallocator, which this library does not implement, so that path throws instead of dropping the buffer silently. No export of this library can fill aStringtoday, so only strings left empty reach the destructor.Source of the layout: disassembly of the retail
libSceNpCppWebApi.prxbundled with one title (Astro Bot, PPSA21564 01.007.000). Functions were located by hashing their mangled names to NIDs. No other build of the module was checked; this is recorded in TechnicalDebt.Observed in that module:
sizeof(String)is 0x20: a 32-bit field at 0x00 written by theRefObjectbase constructor,char*at 0x08, a 64-bit field at 0x10,LibContext*at 0x18. No vtable.c_str(): the pointer at 0x08 when non-null, otherwise the address of a static empty string.Inferred, and not relied on here: the field at 0x00 is an intrusive reference count, and 0x10 holds the allocated byte count including the terminator (from
String::append, which this library does not export).Not included:
Binary,Vector, the iterators andIntrusivePtr. The library gets aCMakeLists.txtonly to register the test.Tested
-DBUILD_TESTING=ON: full build,ctest280/282.guest_np_cpp_web_api_string: constructor on pre-filled storage (field values, nothing written past 0x20),c_str()on an empty string and on a string with a buffer, destructor on an empty string (storage unchanged) and on a string with a buffer (throws). It fails onmainand passes with this change.agc_driver_f32_output_modifierandagc_driver_scalar_sop1, shader tests that run on the GPU (RTX 5080) and do not depend on any file changed here. The first also fails on unmodifiedmainon this machine; the second was not re-run on a cleanmain.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:14:01Z.
Progress report (
8c906ca→6a20036)➖ System libraries: 79.14% (+0.0%, +1 implemented, -1 reverted functions)
✅ 1 implemented
_ZNK3sce2Np9CppWebApi6Common6String5c_strEv⚠️ 1 went back to stubs
_ZN3sce2Np9CppWebApi6Common6StringD1Ev