Skip to content

feat(libSceNpWebApi2): add web trace tags and abort push event handles offline - #6

Closed
KernelPanicNT wants to merge 1 commit into
mainfrom
feat/libscenpwebapi2-trace-tag-abort-handle
Closed

KernelPanicNT wants to merge 1 commit into
mainfrom
feat/libscenpwebapi2-trace-tag-abort-handle

Conversation

@KernelPanicNT

Copy link
Copy Markdown
Owner

What

Implements sceNpWebApi2AddWebTraceTag (NID MgsTa76wlEk) and sceNpWebApi2PushEventAbortHandle (NID 1OLgvahaSco) on the existing offline libSceNpWebApi2 model. No other export changes behaviour.

Source of the behaviour. No console measurement is involved; both calls follow shadPS4's PS4 implementation at f47bbd5, adapted to what this library already models:

  • sceNpWebApi2AddWebTraceTag(int64_t request_id, const char* value): shadPS4 returns ORBIS_NP_WEBAPI2_ERROR_INVALID_ARGUMENT for a null value and otherwise adds the value as the X-Psn-WebTrace-Tag header through its request-header path (np_web_api2.cpp L38-L45). The error is 0x80553402 (np_error.h L548), the value this file already returns for a null request id in sceNpWebApi2CreateRequest. Here the header goes through the existing sceNpWebApi2AddHttpRequestHeader, which accepts every request id and keeps nothing, since no request reaches a server.
  • sceNpWebApi2PushEventAbortHandle(int lib_ctx_id, int handle_id): the signature is shadPS4's (np_web_api2.cpp L229-L232); its abortPushEventHandle looks up the library context and the handle and marks the handle aborted. This library does not track push event handles (sceNpWebApi2PushEventCreateHandle hands out an id, sceNpWebApi2PushEventDeleteHandle accepts any handle) and nothing waits on one offline, so for a known library context there is nothing to abort and the call returns 0. This is the model of sceNpWebApi2PushEventSetHandleTimeout, merged in feat(exports): export the calls PPSA01317 imports boykopovar/AnyPS5#4834: the library context is checked against the contexts sceNpWebApi2Initialize created, the handle is not.

Changes:

  • core/libs/prx/libSceNpWebApi2/Export.cpp: the two exports take their signatures and the behaviour above. The other exports are unchanged.
  • core/libs/tests/GuestNpWebApi2.cpp: guest_np_web_api2 covers a trace tag on a live request, a null value (0x80553402), abort on a live context with a handle of that context and with an unknown handle, and abort after sceNpWebApi2Terminate, which throws.
  • docs/dev/debt/libSceNpWebApi2.md: both entries under Unknown function info record the PS4 origin, the commit-pinned shadPS4 lines and the cases below.

What stays throwing or differs, and why:

  • sceNpWebApi2PushEventAbortHandle on an unknown library context throws std::invalid_argument, as sceNpWebApi2PushEventSetHandleTimeout and sceNpWebApi2GetMemoryPoolStats do: shadPS4 returns LIB_CONTEXT_NOT_FOUND (0x80553404) there, but that is PS4 numbering and the PS5 result is unverified.
  • An unknown handle on a known context returns 0, where shadPS4 returns HANDLE_NOT_FOUND (0x8055340d): handles are not tracked here, and tracking them would change what CreateHandle, DeleteHandle and CreateFilter return for every title. The debt entry states this.
  • Both signatures are PS4 ones and unverified on the PS5.

Progress: libSceNpWebApi2 27/29 → 29/29; system libraries 3249/3678 (88.34%) → 3251/3678 (88.39%) by tools/progress.py on the branch base caee23f.

Tested

Head bec511d872b11fb9ef3763b8f3dfa504d6ccb541, base 84b01f9cd042e1d2e9e112f8783aa5a9d26399ee.

  • Linux (Ubuntu 22.04, GCC 12.3.0, Ninja, Release, BUILD_TESTING=ON, tests run under QEMU 8.2 user mode with -cpu EPYC-Rome because the build host lacks AVX2): guest_np_web_api2_tests 5/5 passes.
  • Negative control: keep the tests and replace only core/libs/prx/libSceNpWebApi2/Export.cpp with the base version: guest_np_web_api2_tests fails with sceNpWebApi2PushEventAbortHandle not implemented. Restoring the PR source and rebuilding passes guest_np_web_api2_tests 5/5.
  • Windows: fork Build workflow pending; result added here when it finishes.
  • Conventions checker and git diff --check pass. The Linux job of the Build workflow now targets the project's self-hosted runner, so it was not run on the fork; no title was run.

Duplicate and overlap check

Checked the files of all 443 open PRs on 2026-10-14 and searched open, merged and closed PRs for both function names and the NID 1OLgvahaSco. No open PR touches libSceNpWebApi2/Export.cpp, GuestNpWebApi2.cpp or docs/dev/debt/libSceNpWebApi2.md, and none names either function.

History of the same exports:

The branch is one commit on caee23f; none of the newer commits on main (84b01f9) touch these files, and it merges without conflicts.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude)

…s offline

sceNpWebApi2AddWebTraceTag follows shadPS4: a null value returns
INVALID_ARGUMENT and any other value is added as the X-Psn-WebTrace-Tag
header through sceNpWebApi2AddHttpRequestHeader.

sceNpWebApi2PushEventAbortHandle returns success for a known library
context, since push event handles are not tracked and nothing waits on
one offline. An unknown context throws, as in
sceNpWebApi2PushEventSetHandleTimeout, because its PS5 error code is
unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Progress report (e34c479 → bec511d)

📈 System libraries: 88.76% (+0.05%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceNpWebApi2 sceNpWebApi2AddWebTraceTag
libSceNpWebApi2 sceNpWebApi2PushEventAbortHandle

@KernelPanicNT

Copy link
Copy Markdown
Owner Author

Withdrawn: open upstream PR boykopovar#5929 already implements the same functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant