fix(libSceNpCppWebApi): name the exports the NID database resolves #8086

Merged
Arararararagi merged 1 commit from upstream-pr/8086 into main 2026-10-20 05:15:04 +00:00
Arararararagi commented 2026-10-19 20:45:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Arararararagi on 2026-10-19T20:45:33Z.


What

The 73 sceNpCppWebApiUnknown<nn> exports of libSceNpCppWebApi were placeholders carrying an APS5_EXPORT alias: the loader bound the NID a title imports through the alias symbol, and also bound the hash of the invented name sceNpCppWebApiUnknown<nn>, which no guest imports.

aerolib names every one of the 73, and each name recomputes to the NID a title imports, so the name is not guessed (tools/nid_names.py, compute_nid(name) == nid; same evidence chain as the existing sceNpGetSandboxInfo, scePsmlMfsr* and sceVoiceQoSSetConnectionAttribute entries). Each placeholder is replaced by the real symbol name and the alias is dropped, as the other 205 definitions in Export.cpp already do, and the block is sorted by demangled name so the Common instantiations and the V1/V5 accessors stay together; NotImplemented_nid_no_patch takes __func__ now that there is a real name to report. docs/dev/debt/libSceNpCppWebApi.md records what is still unknown about them: a mangled name gives the class, the method and the argument types, but not the layouts the arguments point at, the values the caller reads back, the console's errors or any title call site.

Behaviour is unchanged: every one of the 73 still throws. No title-side call site is known for any of them; they exist because a dump that ships no libSceNpCppWebApi.prx imports them.

Tested

Not tested on a title, a console or on hardware.

  • core/libs/nid Nid::ComputeNid, the function the loader resolves host symbols with, run against the 73 (NID, name) pairs of this diff: 73 names checked, 0 mismatched, both with an empty library name and with libSceNpCppWebApi, so every name still resolves to the NID the title imports.
  • Built the library before and after on the same machine and toolchain (cmake --build build --target libSceNpCppWebApi) and compared nm -D --defined-only on the two libSceNpCppWebApi.prx: both export 359 NIDs, and a comm of the sorted lists reports 0 NIDs bound only on main and 0 bound only here. Dropping the aliases loses no import.
  • The translation unit binds 278 distinct NIDs here against 351 on main; the difference is exactly the 73 hashes of the invented sceNpCppWebApiUnknown<nn> names, whose names match, and no symbol name binds two NIDs.
  • ctest --test-dir build -R guest_np_cpp_web_api: 2/2 passed.
  • python3 tools/nid_names.py: 95 unknown stubs before, 22 after. The 22 are the ones no database names.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • python3 -m unittest discover -s tools/tests: 690 tests, skipped=10; the single error is test_shader_cache_runtime_sources.py, which calls unittest.main() at import and reads its source path from argv, so it only runs under its CMake registration.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4927185619 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8086). Originally posted by [Arararararagi](https://github.com/Arararararagi) on 2026-10-19T20:45:33Z. --- ### What The 73 `sceNpCppWebApiUnknown<nn>` exports of `libSceNpCppWebApi` were placeholders carrying an `APS5_EXPORT` alias: the loader bound the NID a title imports through the alias symbol, and also bound the hash of the invented name `sceNpCppWebApiUnknown<nn>`, which no guest imports. aerolib names every one of the 73, and each name recomputes to the NID a title imports, so the name is not guessed (`tools/nid_names.py`, `compute_nid(name) == nid`; same evidence chain as the existing `sceNpGetSandboxInfo`, `scePsmlMfsr*` and `sceVoiceQoSSetConnectionAttribute` entries). Each placeholder is replaced by the real symbol name and the alias is dropped, as the other 205 definitions in `Export.cpp` already do, and the block is sorted by demangled name so the `Common` instantiations and the V1/V5 accessors stay together; `NotImplemented_nid_no_patch` takes `__func__` now that there is a real name to report. `docs/dev/debt/libSceNpCppWebApi.md` records what is still unknown about them: a mangled name gives the class, the method and the argument types, but not the layouts the arguments point at, the values the caller reads back, the console's errors or any title call site. Behaviour is unchanged: every one of the 73 still throws. No title-side call site is known for any of them; they exist because a dump that ships no `libSceNpCppWebApi.prx` imports them. ### Tested Not tested on a title, a console or on hardware. - `core/libs/nid` `Nid::ComputeNid`, the function the loader resolves host symbols with, run against the 73 `(NID, name)` pairs of this diff: 73 names checked, 0 mismatched, both with an empty library name and with `libSceNpCppWebApi`, so every name still resolves to the NID the title imports. - Built the library before and after on the same machine and toolchain (`cmake --build build --target libSceNpCppWebApi`) and compared `nm -D --defined-only` on the two `libSceNpCppWebApi.prx`: both export 359 NIDs, and a `comm` of the sorted lists reports 0 NIDs bound only on `main` and 0 bound only here. Dropping the aliases loses no import. - The translation unit binds 278 distinct NIDs here against 351 on `main`; the difference is exactly the 73 hashes of the invented `sceNpCppWebApiUnknown<nn>` names, whose names match, and no symbol name binds two NIDs. - `ctest --test-dir build -R guest_np_cpp_web_api`: 2/2 passed. - `python3 tools/nid_names.py`: 95 unknown stubs before, 22 after. The 22 are the ones no database names. - `python3 tools/check_conventions.py --base origin/main`: passed. - `python3 -m unittest discover -s tools/tests`: 690 tests, `skipped=10`; the single error is `test_shader_cache_runtime_sources.py`, which calls `unittest.main()` at import and reads its source path from `argv`, so it only runs under its CMake registration. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!8086
No description provided.