feat(libSceNpWebApi2): implement sceNpWebApi2GetMemoryPoolStats #3296

Merged
SynnZer0 merged 1 commit from upstream-pr/3296 into main 2026-10-11 08:46:44 +00:00
SynnZer0 commented 2026-10-11 06:04:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SynnZer0 on 2026-10-11T06:04:04Z.


What

Implements sceNpWebApi2GetMemoryPoolStats (Xweb+naPZ8Y). PPSA21703 (Vampire Survivors, Unity) imports it from its PSN plugin, and on Windows it did not start (FAIL: unresolved ELF import Xweb+naPZ8Y from libSceNpWebApi2.prx). tools/import_audit.py reported it as the title's only absent import. The name was identified by hashing candidate names with the NID formula.

  • sceNpWebApi2Initialize records the pool size of the returned context; sceNpWebApi2Terminate forgets it.
  • sceNpWebApi2GetMemoryPoolStats(int libCtxId, stats*) fills {pool_size, max_inuse_size, current_inuse_size, reserved} with the recorded size and 0 use, as sceHttp2GetMemoryPoolStats does, since nothing is allocated from the pool. A null output or an unknown context throws, because the error codes are unknown.
  • docs/dev/TechnicalDebt.md: the signature and layout are assumed from the Http2 statistics, not confirmed.
  • libSceNpWebApi2/CMakeLists.txt (new) builds the library exactly as the generic rule did, to register guest_np_web_api2.
  • tests/GuestNpWebApi2.cpp (new): two contexts report their own pool sizes, a null output throws, and a terminated context throws.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs 15.2.0posix-14.0.0-ucrt-r7), full build with BUILD_TESTING=ON:

  • ctest: 769/769 passed (includes guest_np_web_api2 and guest_http2).
  • python tools/check_conventions.py --base origin/main: passed.
  • PPSA21703: the import resolves and the title passes this point at startup. It also needs #846 to load its plugins.
  • Linux and macOS: not run.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4816982195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3296). Originally posted by [SynnZer0](https://github.com/SynnZer0) on 2026-10-11T06:04:04Z. --- ### What Implements `sceNpWebApi2GetMemoryPoolStats` (`Xweb+naPZ8Y`). PPSA21703 (Vampire Survivors, Unity) imports it from its PSN plugin, and on Windows it did not start (`FAIL: unresolved ELF import Xweb+naPZ8Y from libSceNpWebApi2.prx`). `tools/import_audit.py` reported it as the title's only absent import. The name was identified by hashing candidate names with the NID formula. - `sceNpWebApi2Initialize` records the pool size of the returned context; `sceNpWebApi2Terminate` forgets it. - `sceNpWebApi2GetMemoryPoolStats(int libCtxId, stats*)` fills `{pool_size, max_inuse_size, current_inuse_size, reserved}` with the recorded size and 0 use, as `sceHttp2GetMemoryPoolStats` does, since nothing is allocated from the pool. A null output or an unknown context throws, because the error codes are unknown. - `docs/dev/TechnicalDebt.md`: the signature and layout are assumed from the Http2 statistics, not confirmed. - `libSceNpWebApi2/CMakeLists.txt` (new) builds the library exactly as the generic rule did, to register `guest_np_web_api2`. - `tests/GuestNpWebApi2.cpp` (new): two contexts report their own pool sizes, a null output throws, and a terminated context throws. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs 15.2.0posix-14.0.0-ucrt-r7), full build with `BUILD_TESTING=ON`: - `ctest`: 769/769 passed (includes `guest_np_web_api2` and `guest_http2`). - `python tools/check_conventions.py --base origin/main`: passed. - PPSA21703: the import resolves and the title passes this point at startup. It also needs #846 to load its plugins. - Linux and macOS: not run. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 06:04:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T06:04:14Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106076665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3296#issuecomment-6106076665). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T06:04:14Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
github-actions[bot] commented 2026-10-11 08:09:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T08:09:32Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#3337 sceNpWebApi2GetMemoryPoolStats
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106990260 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3296#issuecomment-6106990260). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T08:09:32Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3337 | | `sceNpWebApi2GetMemoryPoolStats` | |
github-actions[bot] commented 2026-10-11 08:39:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T08:39:26Z.


Progress report (71dda5b → c5bcc08)

📈 System libraries: 85.55% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceNpWebApi2 sceNpWebApi2GetMemoryPoolStats
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107214956 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3296#issuecomment-6107214956). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T08:39:26Z. --- <!-- progress-report --> ### Progress report (71dda5b → c5bcc08) 📈 **System libraries**: 85.55% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceNpWebApi2 | `sceNpWebApi2GetMemoryPoolStats` | </details>
adriadam10 commented 2026-10-11 08:45:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:45:38Z.


Rebased onto current main (single conflict in docs/dev/TechnicalDebt.md, adjacent to the Http2/Ssl/Net pool stats line that main now documents as measured on a PS5). I reworded your line to say the layout is assumed for NpWebApi2, not measured. No code changes.

Checked on the rebased tree: scoped build and ctest green, guest_np_web_api2 and guest_http2 pass, unknown signature/errors documented in TechnicalDebt, null output and unknown context throw. Merging once CI is green.

Note: #3337 declares the same export as an unimplemented stub; it should drop it after this lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107261075 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3296#issuecomment-6107261075). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:45:38Z. --- Rebased onto current `main` (single conflict in `docs/dev/TechnicalDebt.md`, adjacent to the Http2/Ssl/Net pool stats line that main now documents as measured on a PS5). I reworded your line to say the layout is assumed for NpWebApi2, not measured. No code changes. Checked on the rebased tree: scoped build and ctest green, `guest_np_web_api2` and `guest_http2` pass, unknown signature/errors documented in TechnicalDebt, null output and unknown context throw. Merging once CI is green. Note: #3337 declares the same export as an unimplemented stub; it should drop it after this lands.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3296
No description provided.