feat(libSceNpWebApi): add user contexts, requests and push event callbacks offline #9797
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9797"
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 Terminev on 2026-10-22T15:33:22Z.
What
Implements ten libSceNpWebApi (PS4) exports offline, following shadPS4 with its network disabled, as the existing exports of this library do:
sceNpWebApiCreateContext,sceNpWebApiDeleteContext: user contexts of the initial user, idslibCtxId << 16 | counter,USER_CONTEXT_ALREADY_EXISTfor a second one.sceNpWebApiCreateRequest,sceNpWebApiDeleteRequest,sceNpWebApiAbortRequest: requests with idsuserCtxId << 32 | counter, argument and content parameter checks before the lookups.sceNpWebApiSendRequest:ABORTEDfor an aborted request, otherwiseNOT_SIGNED_IN, since no user is signed in to PSN.sceNpWebApiRegisterPushEventCallback,sceNpWebApiUnregisterPushEventCallback,sceNpWebApiRegisterServicePushEventCallback,sceNpWebApiUnregisterServicePushEventCallback: callbacks are recorded but never called; no service filter can exist, so a service callback getsSERVICE_PUSH_EVENT_FILTER_NOT_FOUNDfrom SDK 2.50.The SDK-dependent checks (null callback from 1.00, PATCH and existing filter from 2.50) read the compiled SDK version from the process parameters, as libSceAppContent does. With that available,
sceNpWebApiCreateServicePushEventFilternow also rejects the invalid service label from SDK 2.00, which closes that part of its debt entry.sceNpWebApiReadData,sceNpWebApiGetHttpStatusCode, the two header getters andsceNpWebApiUtilityParseNpIdstill throw: no request ever gets a response, and what the console returns for them is not settled by any source.Sources and gaps are in
docs/dev/debt/libSceNpWebApi.md. Where the sources disagree: shadPS4'sterminateContextreturns after deleting the first user context and keeps the library context; this PR keeps the existingsceNpWebApiTerminate, which deletes the library context with its user contexts and requests, and says so in the debt entry.Tested
Linux x86-64 (Intel Xeon @ 2.10GHz with AVX2, FMA, F16C, BMI1, BMI2, LZCNT and MOVBE), GCC 13.3, Release, on
0435d0b25rebased onto main atc661d9fae:ctest -R '^guest_np_web_api$'andctest -R public_headers(65/65) pass. The test covers the new exports at SDK 4.50, 2.00, 1.00 and 0.90 through the process parameters fixture, and pins the results measured on a PS4 Pro in the review thread. SDL was configured with its XRandR and audio checks disabled locally, since that machine lacks those headers; this library and its test do not use SDL.python3 tools/check_conventions.py --base origin/mainandgit diff --checkpass. Not built on Windows. No title tested.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-22T16:18:28Z.
Review: CHANGES_REQUESTED
The implementation and focused test coverage look thorough on inspection. I built the exact PR head successfully with the
guest_np_web_api_teststarget. I could not get a passing local runtime result:ctest -R "^guest_np_web_api$"aborts during libkernel initialization because this host CPU (Xeon E5-1620 v2) lacks LZCNT, BMI1, BMI2, MOVBE and AVX2, which the repository documents as required for PS5 title execution. The PR description reports the focused test passing on Linux with GCC 13.3; current hosted checks are conventions, intake and labels only.The branch is eight commits behind current
main(8499ea52e571b0edfc1feecfd3f6b9944012b359). CONTRIBUTING.md requires branches to be based on and kept up to date withmain. Please sync the branch, resolve any conflicts, rerun the focused test on a supported host, and update the test evidence before merge.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:54:48Z.
Review: COMMENTED
Thanks for rebasing and adding the supported-host test result. The refreshed head
f5c41260d83f654e7502070e9bf2ae7aecec5158has a clean merge tree with currentmain(11f976b27c16ed91633f00039dba5dfd97dd7cc1); conventions andgit diff --checkalso pass. I confirmed the updated Tested section reportsguest_np_web_apipassing on a CPU with the required feature set. The earlier base/runtime request is resolved. The PR’s current hosted checks show conventions and labels passing; full product builds are not in this check set. I have not independently rerun the runtime test in this VM because its CPU lacks the required features.