feat(libSceNKWebKit): implement the exports the 11.00 module answers with a constant #13936

Merged
edubox merged 2 commits from upstream-pr/13936 into main 2026-11-01 12:42:00 +00:00
edubox commented 2026-10-31 13:12:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-10-31T13:12:06Z.


What

137 exports that Export.cpp declared as throwing stubs answer with a constant in the PS5 11.00 libSceNKWebKit:

  • 111 end in xor eax,eax; ret and return 0.
  • 13 load an immediate with mov eax,imm32; ret and return it (values 8, 10, 88, 0xffffffff and a few four-character codes).
  • 13 return true through mov al,1; ret.

src/ConstantExports.cpp reproduces those values. The set was built by recomputing each declared symbol's NID, looking it up in the 11.00 dynamic symbol table and checking the body and size of every selected address against the image, so the claim is what those addresses do, not a guessed prototype.

The declarations stay the no-parameter int placeholders from the inventory, so only the 32-bit return value is measured: a caller expecting a wider value, a pointer or a floating-point return is not covered, and neither are their arguments. docs/dev/debt/libSceNKWebKit.md drops the 134 inventory rows that no longer throw (7,574 → 7,437 of the 8,703 listed declarations, 131 → 128 in the prototype-unknown group) and gains an entry with the measurement and that limit. Only 11.00 was measured.

Tested

  • ctest -R 'nkwebkit|guest_nkwebkit': 9/9 passed, including the new nkwebkit_constants, which calls all 137 exports and compares each result with the measured constant.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • python3 tools/pr_overlap.py --branch feat/nkwebkit-constant-exports --jobs 32: Export.cpp and the debt inventory overlap textually with several open pull requests; none of the exports in this batch is implemented by them (checked their diffs), so the conflicts are in the stub list and the inventory table, not in behaviour.
  • Not tested in a game: none of my converted titles imports libSceNKWebKit (checked their relinker registries), so the 11.00 module is the only evidence.

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:5097807203 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13936). Originally posted by [edubox](https://github.com/edubox) on 2026-10-31T13:12:06Z. --- ### What 137 exports that `Export.cpp` declared as throwing stubs answer with a constant in the PS5 11.00 `libSceNKWebKit`: - 111 end in `xor eax,eax; ret` and return 0. - 13 load an immediate with `mov eax,imm32; ret` and return it (values 8, 10, 88, `0xffffffff` and a few four-character codes). - 13 return true through `mov al,1; ret`. `src/ConstantExports.cpp` reproduces those values. The set was built by recomputing each declared symbol's NID, looking it up in the 11.00 dynamic symbol table and checking the body and size of every selected address against the image, so the claim is what those addresses do, not a guessed prototype. The declarations stay the no-parameter `int` placeholders from the inventory, so only the 32-bit return value is measured: a caller expecting a wider value, a pointer or a floating-point return is not covered, and neither are their arguments. `docs/dev/debt/libSceNKWebKit.md` drops the 134 inventory rows that no longer throw (7,574 → 7,437 of the 8,703 listed declarations, 131 → 128 in the prototype-unknown group) and gains an entry with the measurement and that limit. Only 11.00 was measured. ### Tested - `ctest -R 'nkwebkit|guest_nkwebkit'`: 9/9 passed, including the new `nkwebkit_constants`, which calls all 137 exports and compares each result with the measured constant. - `python3 tools/check_conventions.py --base origin/main`: passed. - `python3 tools/pr_overlap.py --branch feat/nkwebkit-constant-exports --jobs 32`: `Export.cpp` and the debt inventory overlap textually with several open pull requests; none of the exports in this batch is implemented by them (checked their diffs), so the conflicts are in the stub list and the inventory table, not in behaviour. - Not tested in a game: none of my converted titles imports `libSceNKWebKit` (checked their relinker registries), so the 11.00 module is the only evidence. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/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
MarcZX10 commented 2026-10-31 13:36:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T13:36:21Z.

Review: APPROVED


Reviewed — looks good

I reviewed the 137 constant replacements and their test coverage; each replacement has a matching assertion, and I found no blocking source issue.

What I ran

Head 74e157f683cfdd4db2f276e6783ffaf48a80b6b6; PR base cd087bd12c258cf6dbb82e203bafd20d9fe2596c; the merge preview against current main was clean. Environment: Linux, Python 3.11.2, GCC 12.2.0.

git diff --check cd087bd12c258cf6dbb82e203bafd20d9fe2596c...74e157f683cfdd4db2f276e6783ffaf48a80b6b6
python3 tools/check_conventions.py --base cd087bd12c258cf6dbb82e203bafd20d9fe2596c --head 74e157f683cfdd4db2f276e6783ffaf48a80b6b6 --title 'feat(libSceNKWebKit): implement the exports the 11.00 module answers with a constant' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13936-74e157f683cf/pr-body.md
python3 /marc/AnyPS5/tools/pr_stack_check.py 13936 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13936-74e157f683cf/stack

Results

Check Result
Diff whitespace and conventions Passed.
Merge preview Clean against current main.
Source/test mapping Read: CMake globs include src/*.cpp and tests/*.cpp; all 137 new definitions have matching assertions, and all 137 replace throwing stubs.
Hosted Windows and library-portability checks Passed.
Linux and specialized jobs Skipped by the workflow.
Local build and CTest Not run locally. The author reports `ctest -R 'nkwebkit
Unedited conventions-check output
All conventions checks passed.

Findings

Blocking

  • None found in the reviewed source.

Non-blocking

  • None.

Sources

  • The module CMake file at base commit cd087bd12c258cf6dbb82e203bafd20d9fe2596c includes all src/*.cpp files and discovers tests/*.cpp: CMakeLists.txt.
  • The implementation and matching assertions at head 74e157f683cfdd4db2f276e6783ffaf48a80b6b6: ConstantExports.cpp and Constants.cpp.

Not verified

  • I did not build locally, run the CTest suite, or independently inspect the PS5 11.00 module bytes. The 137 return-value measurements and the reported 9/9 CTest run are author-reported evidence, not runs I reproduced.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722929286 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13936#pullrequestreview-5722929286). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T13:36:21Z. **Review:** APPROVED --- # Reviewed — looks good I reviewed the 137 constant replacements and their test coverage; each replacement has a matching assertion, and I found no blocking source issue. ## What I ran Head `74e157f683cfdd4db2f276e6783ffaf48a80b6b6`; PR base `cd087bd12c258cf6dbb82e203bafd20d9fe2596c`; the merge preview against current `main` was clean. Environment: Linux, Python 3.11.2, GCC 12.2.0. ```sh git diff --check cd087bd12c258cf6dbb82e203bafd20d9fe2596c...74e157f683cfdd4db2f276e6783ffaf48a80b6b6 python3 tools/check_conventions.py --base cd087bd12c258cf6dbb82e203bafd20d9fe2596c --head 74e157f683cfdd4db2f276e6783ffaf48a80b6b6 --title 'feat(libSceNKWebKit): implement the exports the 11.00 module answers with a constant' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13936-74e157f683cf/pr-body.md python3 /marc/AnyPS5/tools/pr_stack_check.py 13936 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13936-74e157f683cf/stack ``` ## Results | Check | Result | |---|---| | Diff whitespace and conventions | Passed. | | Merge preview | Clean against current `main`. | | Source/test mapping | Read: CMake globs include `src/*.cpp` and `tests/*.cpp`; all 137 new definitions have matching assertions, and all 137 replace throwing stubs. | | Hosted Windows and library-portability checks | Passed. | | Linux and specialized jobs | Skipped by the workflow. | | Local build and CTest | Not run locally. The author reports `ctest -R 'nkwebkit|guest_nkwebkit'` passed 9/9. | <details><summary>Unedited conventions-check output</summary> ```text All conventions checks passed. ``` </details> ## Findings ### Blocking - None found in the reviewed source. ### Non-blocking - None. ## Sources - The module CMake file at base commit `cd087bd12c258cf6dbb82e203bafd20d9fe2596c` includes all `src/*.cpp` files and discovers `tests/*.cpp`: [`CMakeLists.txt`](https://github.com/boykopovar/AnyPS5/blob/cd087bd12c258cf6dbb82e203bafd20d9fe2596c/core/libs/prx/libSceNKWebKit/CMakeLists.txt). - The implementation and matching assertions at head `74e157f683cfdd4db2f276e6783ffaf48a80b6b6`: [`ConstantExports.cpp`](https://github.com/boykopovar/AnyPS5/blob/74e157f683cfdd4db2f276e6783ffaf48a80b6b6/core/libs/prx/libSceNKWebKit/src/ConstantExports.cpp) and [`Constants.cpp`](https://github.com/boykopovar/AnyPS5/blob/74e157f683cfdd4db2f276e6783ffaf48a80b6b6/core/libs/prx/libSceNKWebKit/tests/Constants.cpp). ## Not verified - I did not build locally, run the CTest suite, or independently inspect the PS5 11.00 module bytes. The 137 return-value measurements and the reported 9/9 CTest run are author-reported evidence, not runs I reproduced.
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!13936
No description provided.