feat(libSceNpWebApi): presence, VSH and internal initialize, internal requests and notification callbacks #13671
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13671"
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 zaryabzip on 2026-10-30T22:57:54Z.
What
Implements six more libSceNpWebApi exports. Each follows shadPS4 (0614ce32) and fits the library's existing context model:
sceNpWebApiInitializeForPresence(libHttpCtxId, poolSize)andsceNpWebApiVshInitialize(libHttpCtxId, poolSize): create a library context the same waysceNpWebApiInitializedoes. shadPS4 records a context type for each, 3 and 4, and never reads it (source, VSH).sceNpWebApiIntInitialize(args): takes the 32-byteNpWebApiIntInitializeArgsfrom shadPS4's declaration. A null pointer or astructSizeother than 0x20 returnsINVALID_ARGUMENT. Otherwise it creates a context fromlibHttpCtxIdandpoolSize(source). Thenameisn't kept, because nothing reads it.sceNpWebApiIntCreateRequest(titleUserCtxId, apiGroup, path, method, contentParameter, internalArgs, requestId): creates a request likesceNpWebApiCreateRequest(second commit). A null group or path, or a method past PATCH, returnsINVALID_ARGUMENTwhatever the SDK version. Then a content length without a type returnsINVALID_CONTENT_PARAMETER, as shadPS4 checks. Its internal arguments are three pointers (shadPS4's struct). shadPS4 accepts them only when all three are null, so with a field set the call throws after the user context check (third commit).sceNpWebApiRegisterNotificationCallback(titleUserCtxId, callback, userArg)andsceNpWebApiUnregisterNotificationCallback(titleUserCtxId):INVALID_ARGUMENTfor a null callback, checked first. ThenLIB_CONTEXT_NOT_FOUNDorUSER_CONTEXT_NOT_FOUNDfrom the library's existing lookup, then 0, as shadPS4's internal functions do. shadPS4 stores the callback but never calls it. No NP notification can arrive offline, so it isn't kept here.This is the same pattern merged #8485 used for libSceNpWebApi2's
InitializeForPresenceandIntInitialize. The six names leave the inventory table. Three debt entries, placed among the existing ones after the table, record what isn't kept. Nothing is measured on a console. libSceNpWebApi goes from 26 to 32 of 88.The new
GuestNpWebApiInitialize.cpplooks the six up at runtime and calls them through their declared types and the public argument structs. It's a separate test file because open #9920 and #11371 editGuestNpWebApi.cpp. Its CMake block sits at the end ofCMakeLists.txt.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both at
6ca3d01f3emerged intomain6b48aee5d2. The head,8b44d36b83, changes only the test, to call the exports through their declared types; it passes the same way on both hosts merged intomain5857e2e98f.libSceNpWebApi/include/Api.hpprebuilds with no warnings, and thestatic_asserts hold.ctest -R "^guest_np_web_api": 3 of 3 pass on both hosts, including the newguest_np_web_api_initialize(NpWebApi initialize and notification tests passed). Each passes 3 of 3 on--repeat until-fail:3. The throw for internal arguments with a field set reaches the test asstd::runtime_erroron both hosts (across the DLL boundary on Windows), and the calls after it on the same mutex succeed.6ca3d01f3e: on thatmainwith only the new test file and itsCMakeLists.txtblock, the test builds and then aborts withsceNpWebApiInitializeForPresence not implementedon both hosts (Windows exit 0xc0000409, Linux SIGABRT). At the head the test uses the structs this PR adds toApi.hpp, so it no longer builds onmain.tools/check_conventions.pypasses. The branch merges cleanly withmainand with open #9920 and #11371, which also editlibSceNpWebApi.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T23:02:46Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
IntCreateRequestcurrently reports success while ignoring non-null internal arguments that the cited reference requires to contain only null fields.What I ran
Reviewed head
41fd24dcca0e46d858bf5cde102106036a8d0d44against PR basec8a871aa5a1a0ab1afec823b81aa11265251d177. The current targetmainwas6b48aee5d2ea9fce6155163d78f8ce8dc84f7827; the stack helper previewed the exact PR head cleanly against it. Environment: Debian GNU/Linux 12, x86_64, Python 3.11.2; no compiler or build was run.Results
${LIBS_INCLUDE_DIR}path form. Manual inspection confirms the CMake file adds the test executable and registersguest_np_web_api_initialize. No weak-assertion signal was reported.main6b48aee5d2ea9fce6155163d78f8ce8dc84f7827; no declared dependency found.ceaba04c52tree based onmain3b0523ab91, not the current PR head/base.Unedited output from local checks
Findings
Blocking
sceNpWebApiIntCreateRequestdiscardsinternalArgsand creates a request for any value. The cited shadPS4 implementation checks a non-null structure's three fields and asserts that all are null; this PR's description says those arguments are not read. Under the repository rule for unknown behavior, silently accepting unsupported non-null fields as success is not established. Please validate the supported null-field case and reject or explicitly fail/record unsupported values; add a test for a non-null argument structure with at least one non-null field. The shadPS4 assertion is a reference, not console evidence, so do not assume an undocumented error code.Non-blocking
The author-reported focused test run is on an earlier tree, not the exact reviewed head. A current-head run would make the test evidence conclusive.
Sources
Not verified
No C++ build, local test run, Windows/macOS execution, or console behavior was tested. Hosted CI was pending. The author-reported tests were not run by me and do not identify the current PR head as the tested SHA.
To get this to a good state
Please handle non-null internal arguments explicitly and add coverage for the unsupported-field case. When the code is updated, I will rerun the same checks on the new head; the focused test command should also be reported for that exact head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T23:19:09Z.
Review: APPROVED
Re-checked — new head, looks good
The updated head now rejects non-null internal request fields instead of silently accepting them and adds regression coverage for that path.
What I ran
Reviewed head
6ca3d01f3ec087e20911c8f3ff01dd9a2d8510c2against PR basec8a871aa5a1a0ab1afec823b81aa11265251d177. Its individual merge preview was clean against currentmain2a1ae91175ccae40a8b8e084573e488f5119682f. Environment: Linux x86_64, Python 3.11.2; no compiler was invoked locally.Results
The exact-head diff and conventions/template checks passed; the direct ABI audit passed with no findings. The precheck aggregate could not run workspace-only helper scripts from its isolated checkout. Its test-quality heuristic flagged the C++ test as possibly unregistered because CMake names the source through
${LIBS_INCLUDE_DIR}; I verified that the executable and CTest target are registered. The individual merge preview was clean.Hosted Windows and completed policy checks passed; Linux and specialized jobs were skipped, and a labels check was still queued at the last refresh. The author reports the focused
^guest_np_web_apisuite passed 3/3 on Windows and Ubuntu WSL2, then 3/3 again on repeat, at this exact head. I did not independently run those tests.Sources
Not verified
I did not build locally or run CTest. I did not test a PS5/title; Linux and specialized hosted jobs were skipped. The test results above are author-reported, not independently reproduced.