refactor(libc): name the 12 Cyberpunk stubs the NID database resolves #2301

Merged
parl0v merged 1 commit from upstream-pr/2301 into main 2026-10-09 21:07:39 +00:00
parl0v commented 2026-10-09 15:04:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-09T15:04:02Z.


What

tools/nid_names.py resolves 14 libcCyberUnknown* stubs, and the earlier pull requests that implemented them (#492, #1952, #1981) are closed. Two of them are being implemented in their own pull requests, abs (Ye20uNnlglA) in #2316 and __powidf2 (H+8UBOwfScI) in #2158, so this leaves those two alone. As in #1145, it renames the other 12 so a NotImplemented failure names the real function. Behaviour is unchanged: every one still throws.

NID Old New
5Lf51jvohTQ libcCyberUnknown03 _Mtx_destroy
7yMFgcS8EPA libcCyberUnknown05 _Cnd_destroy
CyXs2l-1kNA libcCyberUnknown07 _Iswctype
JhVR7D4Ax6Y libcCyberUnknown09 _WStoul
SreZybSRWpU libcCyberUnknown10 _Cnd_init
VsP3daJgmVA libcCyberUnknown11 _Cnd_broadcast
YaHc3GS7y7g libcCyberUnknown12 _Mtx_init
gTuXQwP9rrs libcCyberUnknown13 _Mtx_unlock
iS4aWbUonl0 libcCyberUnknown14 _Mtx_lock
vEaqE-7IZYc libcCyberUnknown16 _Cnd_wait
rWSuTWY2JN0 libcCyberUnknown18 vsnprintf_s
tfNbpqL3D0M libcCyberUnknown19 vsscanf_s

Each name hashes to its NID with compute_nid. The functions follow the _nid_postfix convention, so the APS5_EXPORT aliases go.

Side effect on the export table: the stubs were also exported under their own names, which nid_patcher hashed into 12 extra NIDs (for example compute_nid("libcCyberUnknown03")) that no Sony module has. Those are gone. The 12 real NIDs above are still exported: libc.prx goes from 1483 to 1471 exports, and the 12 removed are exactly the hashes of the old stub names.

The comments above vsnprintf_s and vsscanf_s (file-size idiom from #358) are left as they are; #1981 discussed that they don't match the names.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, on d70b8998.

  • python tools/nid_names.py: 22 unknowns / 14 suggestions before, 10 unknowns / 2 suggestions after (the two left to #2158 and #2316).
  • libc.prx export table compared with objdump -p before and after, as above.
  • Full ctest: 506/507 passed (1 skipped by design); guest_sce_net fails on this host on main too, fixed by #2295.
  • tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions (tools/pr_overlap.py: no shared exports; #2158 and #2316 edit the neighbouring stubs, so whichever lands second needs a rebase)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4802205102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2301). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-09T15:04:02Z. --- ### What `tools/nid_names.py` resolves 14 `libcCyberUnknown*` stubs, and the earlier pull requests that implemented them (#492, #1952, #1981) are closed. Two of them are being implemented in their own pull requests, `abs` (`Ye20uNnlglA`) in #2316 and `__powidf2` (`H+8UBOwfScI`) in #2158, so this leaves those two alone. As in #1145, it renames the other 12 so a `NotImplemented` failure names the real function. Behaviour is unchanged: every one still throws. | NID | Old | New | |---|---|---| | `5Lf51jvohTQ` | `libcCyberUnknown03` | `_Mtx_destroy` | | `7yMFgcS8EPA` | `libcCyberUnknown05` | `_Cnd_destroy` | | `CyXs2l-1kNA` | `libcCyberUnknown07` | `_Iswctype` | | `JhVR7D4Ax6Y` | `libcCyberUnknown09` | `_WStoul` | | `SreZybSRWpU` | `libcCyberUnknown10` | `_Cnd_init` | | `VsP3daJgmVA` | `libcCyberUnknown11` | `_Cnd_broadcast` | | `YaHc3GS7y7g` | `libcCyberUnknown12` | `_Mtx_init` | | `gTuXQwP9rrs` | `libcCyberUnknown13` | `_Mtx_unlock` | | `iS4aWbUonl0` | `libcCyberUnknown14` | `_Mtx_lock` | | `vEaqE-7IZYc` | `libcCyberUnknown16` | `_Cnd_wait` | | `rWSuTWY2JN0` | `libcCyberUnknown18` | `vsnprintf_s` | | `tfNbpqL3D0M` | `libcCyberUnknown19` | `vsscanf_s` | Each name hashes to its NID with `compute_nid`. The functions follow the `_nid_postfix` convention, so the `APS5_EXPORT` aliases go. Side effect on the export table: the stubs were also exported under their own names, which `nid_patcher` hashed into 12 extra NIDs (for example `compute_nid("libcCyberUnknown03")`) that no Sony module has. Those are gone. The 12 real NIDs above are still exported: `libc.prx` goes from 1483 to 1471 exports, and the 12 removed are exactly the hashes of the old stub names. The comments above `vsnprintf_s` and `vsscanf_s` (file-size idiom from #358) are left as they are; #1981 discussed that they don't match the names. ### Tested Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `BUILD_TESTING=ON`, on d70b8998. - `python tools/nid_names.py`: 22 unknowns / 14 suggestions before, 10 unknowns / 2 suggestions after (the two left to #2158 and #2316). - `libc.prx` export table compared with `objdump -p` before and after, as above. - Full `ctest`: 506/507 passed (1 skipped by design); `guest_sce_net` fails on this host on `main` too, fixed by #2295. - `tools/check_conventions.py --base origin/main` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (`tools/pr_overlap.py`: no shared exports; #2158 and #2316 edit the neighbouring stubs, so whichever lands second needs a rebase) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [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
adriadam10 commented 2026-10-09 21:07:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:07:36Z.


Checked all 12 names with compute_nid (each matches its NID), the diff (rename only, every function still throws, no leftover references to the old names), build + ctest (517/517) on top of current main, and a clean merge-tree. Same pattern as #1145. Merging once CI is green; whichever of #2158 / #2316 lands second needs a rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089277640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2301#issuecomment-6089277640). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T21:07:36Z. --- Checked all 12 names with `compute_nid` (each matches its NID), the diff (rename only, every function still throws, no leftover references to the old names), build + ctest (517/517) on top of current `main`, and a clean merge-tree. Same pattern as #1145. Merging once CI is green; whichever of #2158 / #2316 lands second needs a rebase.
github-actions[bot] commented 2026-10-09 21:09:48 +00:00 (Migrated from github.com)

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


Progress report (d70b899 → 9cea268)

➖ System libraries: 84.69% (+0.0%, +12 declared, -12 removed functions)

🆕 12 declared as stubs
Library Name
libc _Cnd_broadcast_nid_postfix
libc _Cnd_destroy_nid_postfix
libc _Cnd_init_nid_postfix
libc _Cnd_wait_nid_postfix
libc _Iswctype_nid_postfix
libc _Mtx_destroy_nid_postfix
libc _Mtx_init_nid_postfix
libc _Mtx_lock_nid_postfix
libc _Mtx_unlock_nid_postfix
libc _WStoul_nid_postfix
libc vsnprintf_s_nid_postfix
libc vsscanf_s_nid_postfix
🗑️ 12 removed
Library Name
libc libcCyberUnknown03
libc libcCyberUnknown05
libc libcCyberUnknown07
libc libcCyberUnknown09
libc libcCyberUnknown10
libc libcCyberUnknown11
libc libcCyberUnknown12
libc libcCyberUnknown13
libc libcCyberUnknown14
libc libcCyberUnknown16
libc libcCyberUnknown18
libc libcCyberUnknown19
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089307515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2301#issuecomment-6089307515). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T21:09:48Z. --- <!-- progress-report --> ### Progress report (d70b899 → 9cea268) ➖ **System libraries**: 84.69% (+0.0%, +12 declared, -12 removed functions) <details> <summary>🆕 12 declared as stubs</summary> | Library | Name | | - | - | | libc | `_Cnd_broadcast_nid_postfix` | | libc | `_Cnd_destroy_nid_postfix` | | libc | `_Cnd_init_nid_postfix` | | libc | `_Cnd_wait_nid_postfix` | | libc | `_Iswctype_nid_postfix` | | libc | `_Mtx_destroy_nid_postfix` | | libc | `_Mtx_init_nid_postfix` | | libc | `_Mtx_lock_nid_postfix` | | libc | `_Mtx_unlock_nid_postfix` | | libc | `_WStoul_nid_postfix` | | libc | `vsnprintf_s_nid_postfix` | | libc | `vsscanf_s_nid_postfix` | </details> <details> <summary>🗑️ 12 removed</summary> | Library | Name | | - | - | | libc | `libcCyberUnknown03` | | libc | `libcCyberUnknown05` | | libc | `libcCyberUnknown07` | | libc | `libcCyberUnknown09` | | libc | `libcCyberUnknown10` | | libc | `libcCyberUnknown11` | | libc | `libcCyberUnknown12` | | libc | `libcCyberUnknown13` | | libc | `libcCyberUnknown14` | | libc | `libcCyberUnknown16` | | libc | `libcCyberUnknown18` | | libc | `libcCyberUnknown19` | </details>
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!2301
No description provided.