feat(libSceNpCommon): implement sceNpGetNavSdkVersion #12830

Merged
hypermoist merged 7 commits from upstream-pr/12830 into main 2026-11-08 17:09:21 +00:00
hypermoist commented 2026-10-29 11:52:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-29T11:52:36Z.


What

Implements sceNpGetNavSdkVersion in place of its NotImplemented stub. The signature and behaviour are read from libSceNpCommon.sprx of firmware 13.60 (disassembly, not measured on a console).

This is stacked on #12829, which is stacked on #12825. Only the last commit (feat(libSceNpCommon): implement sceNpGetNavSdkVersion) is new. All three edit the same debt-file entry.

void sceNpGetNavSdkVersion(char* version): the module clears 8 bytes at version, writes 00.82 into them and returns without setting a result. So the declaration changes from the placeholder int (void) to void (char*), like the sibling sceNpGetSdkVersion. There is no null check, as in the module.

The debt file replaces the "signature unknown" entry and the entry that said the function throws with one entry that states the source. It notes that other firmware versions may carry another string.

Tested

Linux (CachyOS, GCC, Release): ctest --test-dir build -R 'np_common|public_headers' --output-on-failure, 70/70 passed. The clock case of GuestNpCommon.cpp checks the 8 bytes and that nothing is written past them.

Comparison against the firmware code: I relinked the 13.60 module with this repo's relinker and ran the function under unicorn (x86-64 emulation on a PC, not a console) on a buffer prefilled with x. It wrote 00.82\0\0\0 and left the following bytes unchanged, the same as this implementation.

Windows not built. Not run on a console.

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: #12829
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5067482664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12830). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-29T11:52:36Z. --- ### What Implements `sceNpGetNavSdkVersion` in place of its `NotImplemented` stub. The signature and behaviour are read from `libSceNpCommon.sprx` of firmware 13.60 (disassembly, not measured on a console). **This is stacked on #12829, which is stacked on #12825.** Only the last commit (`feat(libSceNpCommon): implement sceNpGetNavSdkVersion`) is new. All three edit the same debt-file entry. `void sceNpGetNavSdkVersion(char* version)`: the module clears 8 bytes at `version`, writes `00.82` into them and returns without setting a result. So the declaration changes from the placeholder `int (void)` to `void (char*)`, like the sibling `sceNpGetSdkVersion`. There is no null check, as in the module. The debt file replaces the "signature unknown" entry and the entry that said the function throws with one entry that states the source. It notes that other firmware versions may carry another string. ### Tested Linux (CachyOS, GCC, Release): `ctest --test-dir build -R 'np_common|public_headers' --output-on-failure`, 70/70 passed. The `clock` case of `GuestNpCommon.cpp` checks the 8 bytes and that nothing is written past them. **Comparison against the firmware code:** I relinked the 13.60 module with this repo's relinker and ran the function under unicorn (x86-64 emulation on a PC, not a console) on a buffer prefilled with `x`. It wrote `00.82\0\0\0` and left the following bytes unchanged, the same as this implementation. Windows not built. Not run on a console. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #12829 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
rooklz commented 2026-10-29 12:04:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T12:04:25Z.

Review: APPROVED


I reviewed only the commit this PR adds (git diff rev-12829..rev-12830, @9079bcca6f).

Checks

  • I built the function exactly as written, together with the two new test rows, as a standalone program on macOS arm64 (clang, ASan+UBSan). It passes.
  • I tried 5 single-line mutants and the new rows catch all 5: strcpy (no zero padding), a 6-byte copy, a 9-byte copy (writes past the buffer), snprintf(version, 8, ...) (leaves bytes 6–7 unwritten) and a wrong string (0.82).
  • tools/nid_names.py --name sceNpGetNavSdkVersion gives QmDEFikd3VA, which matches the removed debt entry. Nothing else in the tree (CMake, tools, exports) refers to the old int (void) placeholder.
  • check_conventions.py --base rev-12829 --head rev-12830 passes. git diff --check and git merge-tree against main 5454cd2e45 are both clean.
  • pr_overlap --branch finds only #12836. That conflict (PendingExportsRound7.cpp, Api.hpp, the debt file) comes from #12825, not from this commit: #12825 conflicts with #12836 in the same way, and #12836 already says whichever lands second will rebase.

Notes (non-blocking)

  • The function follows the 13.60 disassembly, but it sits in Export.cpp, next to the shadPS4-derived sceNpGetSdkVersion, and not in Runtime.cpp/Strings.cpp, which the debt file describes as 13.60-derived as a whole. The new debt entry names its source, so nothing is wrong. It might still be tidier to move it later.
  • The line "all test done locally on actual hardware" contradicts "Not run on a console", as it did in #12825/#12829.

AI-assisted review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5697356551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12830#pullrequestreview-5697356551). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-29T12:04:25Z. **Review:** APPROVED --- I reviewed only the commit this PR adds (`git diff rev-12829..rev-12830`, @9079bcca6f). **Checks** - I built the function exactly as written, together with the two new test rows, as a standalone program on macOS arm64 (clang, ASan+UBSan). It passes. - I tried 5 single-line mutants and the new rows catch all 5: `strcpy` (no zero padding), a 6-byte copy, a 9-byte copy (writes past the buffer), `snprintf(version, 8, ...)` (leaves bytes 6–7 unwritten) and a wrong string (`0.82`). - `tools/nid_names.py --name sceNpGetNavSdkVersion` gives `QmDEFikd3VA`, which matches the removed debt entry. Nothing else in the tree (CMake, tools, exports) refers to the old `int (void)` placeholder. - `check_conventions.py --base rev-12829 --head rev-12830` passes. `git diff --check` and `git merge-tree` against main 5454cd2e45 are both clean. - `pr_overlap --branch` finds only #12836. That conflict (PendingExportsRound7.cpp, Api.hpp, the debt file) comes from #12825, not from this commit: #12825 conflicts with #12836 in the same way, and #12836 already says whichever lands second will rebase. **Notes (non-blocking)** - The function follows the 13.60 disassembly, but it sits in `Export.cpp`, next to the shadPS4-derived `sceNpGetSdkVersion`, and not in `Runtime.cpp`/`Strings.cpp`, which the debt file describes as 13.60-derived as a whole. The new debt entry names its source, so nothing is wrong. It might still be tidier to move it later. - The line "all test done locally on actual hardware" contradicts "Not run on a console", as it did in #12825/#12829. AI-assisted review.
CnRJay commented 2026-11-01 19:54:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:54:07Z.

Review: COMMENTED


sceNpGetNavSdkVersion is one getter, but the diff is +317/-68 across 8 files. Please say what else it carries.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729937338 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12830#pullrequestreview-5729937338). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:54:07Z. **Review:** COMMENTED --- `sceNpGetNavSdkVersion` is one getter, but the diff is +317/-68 across 8 files. Please say what else it carries.
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!12830
No description provided.