Repository navigation
feat(libs): restore libSceNpCppWebApi for dumps that ship no copy - #6901
Conversation
be4f4aa to
db64dc1
Compare
Progress report (12e42b2 → 8f3849e)📉 System libraries: 80.52% (-1.99%, +196 implemented, +164 declared functions) ✅ 196 implemented
⚪ 139 behaviourally empty (constant return or throw)
🆕 164 declared as stubs
|
db64dc1 to
c5cfbb9
Compare
|
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.
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.
|
c5cfbb9 to
8cd400a
Compare
|
Overlap check against open PRs (the three that conflict with base could not be auto-compared, so I checked their hunks by hand): CONTRIBUTING.md is clean — #6044 edits the test-docs block near the top, this PR only amends the module-replacement bullet and drops one checklist line. The one real interaction is in core/libs/CMakeLists.txt: #6044 replaces library test registrations with add_library_test(...); if it lands first, the two guest_np_cpp_web_api add_test blocks here should become add_library_test(modules NAME ...) instead. Happy to adapt on rebase either way. |
|
Runtime data for this PR, with Marvel's Wolverine (PPSA03671 01.001.005). Setup: Windows 11 Pro 26300, RTX 4080 SUPER 16 GB (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release.
Not checked: anything after the splash card. AI-assisted: yes |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the work and for the audit of the 147 imports; the approach (a host fallback only consulted when the dump ships no copy) is fine and the CONTRIBUTING wording is accepted. Points to fix:
Export.cpp:9:SCE_NP_WEBAPI_ERROR_UNAVAILABLE = 0x80552901does not exist. In shadPS4 (np_error.h:450) and fpPS4 (np_error.pas:375)0x80552901isSCE_NP_WEBAPI_ERROR_OUT_OF_MEMORY, and the 0x80552901-0x8055291A range has no "unavailable" code. As written, every factory, API call andstart/readDatareports out-of-memory to the title. Pick the code a signed-out/offline console returns from the real library (e.g.NOT_SIGNED_IN0x80552907 if that is what you measured, or what the removed module returned), name it after the reference constant, and say in the debt file where it comes from.docs/dev/debt/libSceNpCppWebApi.md: the setters/ctors/dtors that succeed without storing state (Leaderboardsset*,ParameterTo*::initialize, RecordScore, etc.) are only mentioned for SessionManager2V1. List all of them, and put the no-ops under a### Silent stubssection as your checklist says (there is none in the file).- The layouts (0x18
IntrusivePtr, 0x20String, refcount at 0x30 forVector) are cited as measured on PPSA21564; please put the evidence (offsets/disassembly) in the PR body so it can be checked.
Everything else I checked looks right: the tests pin the deep-copy / refcount / free behaviour and would fail without the change, and the runtime data from @ionut27001 on PPSA03671 is a useful confirmation.
|
All three points addressed in
Verified: |
|
Checked the follow-up against the three points: the offline code is now |
What
Restores
libSceNpCppWebApi(removed in 79057e9) for dumps that ship no copy of the module, extended to the full 147-import surface audited in #1033. All exports resolve by exact symbol name through the NID patcher; the patched.prxwas verified to export all 147 NIDs.Behaviour, matching the offline-console model of the original module:
Common::initialize/terminate,InitParams,LibContext, parameter ctors/dtors and setters: succeed (bookkeeping only).Common::String::append: allocates/grows the host buffer, copies existing and appended text, NUL-terminates and updatesbufferSize(capacity at 0x10).~Stringfrees the buffer instead of throwing.Vector<String>/Vector<IntrusivePtr<T>>: lazy shared backing body with refcount at 0x30 (same convention as the adopted-body ctor).pushBackdeep-copiesStringcontents and bumpsIntrusivePtrelement refcounts;~Vectorreleases every reference it holds.IntrusivePtr<Vector<...>>adopt-ctor stores the caller's body + deleter and releases through the 0x30 refcount, so title-owned vectors round-trip correctly.PlayerSessionsApicalls and transactionstart/getResponse: returnSCE_NP_WEBAPI_ERROR_UNAVAILABLE(0x80552901).begin/end/[]:NotImplemented_nid_no_patch— unreachable once every request fails.docs/dev/debt/libSceNpCppWebApi.md(measured against the removed module's PPSA21564-era layouts).Layout evidence (PPSA21564 bundled module)
The three layouts the code depends on were read out of the
libSceNpCppWebApi.prxshipped inside that title (unwrapped withtools/unwrap_self.py, inspected in objdump/Ghidra):IntrusivePtr= 0x18 bytes: its copy-ctor/dtor entry points move three qwords (object,deleter,LibContext*) and bump/release a dword atobject+0x00- the reference count sits at the pointee base.String= 0x20 bytes: ctor/dtor touch refcount dword@0x00,bufferptr@0x08,bufferSize@0x10,LibContext*@0x18.Vectorshared body: refcount at+0x30- the same offset the adopted-body path uses (0x28 reserved/magic header, then refcount@0x30, element kind,elements,size,capacityfilling to0x50).pushBack<Vector<String>>allocates a fresh buffer per element and copies contents rather than bumping the source refcount - observed in the push path that distinguishes String elements fromIntrusivePtrelements (elementKind).Tested
kernel_sys,access,path_case,utime,file_timestamps,filesystem) that only fail under the DrvFs/mnt/dmount and pass when run from/tmp— environment artifacts, unrelated to this change.GpuIndirectArgumentsMisalignedWriterAhead.cppdoes not compile with MinGW GCC (alignas(65536)) #6716alignas(65536)MinGW object-file limit.guest_needed_modulesis intermittently blocked by Windows Defender on its synthetic test executables (passed on earlier runs; environmental).guest_np_cpp_web_api_stringandguest_np_cpp_web_api_intrusive_ptrpass on both toolchains. New coverage: append +pushBack+ temp-string destruction (deep copy survives),IntrusivePtrelement refcount release, adopted-vector-body destruction, vector body refcount at 0x30.libSceNpCppWebApi.prxexports all 147 required NIDs (checked withcompute_nid).check_conventionsandcheck_test_registration: clean.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs indocs/dev/debt/libSceNpCppWebApi.md.mdfiles or images added to the repository