Skip to content

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

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
parl0v:refactor/libc-name-cyber-stubs
Oct 9, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
parl0v:refactor/libc-name-cyber-stubs

Conversation

@parl0v

@parl0v parl0v commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 d70b899.

Checklist

  • Based on current main; no other open PR implements the same functions (tools/pr_overlap.py: no shared exports; feat(libc): implement __powidf2 #2158 and feat(libc): implement abs #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

@parl0v
parl0v force-pushed the refactor/libc-name-cyber-stubs branch from 65195a9 to 9cea268 Compare October 9, 2026 15:33
@parl0v parl0v changed the title refactor(libc): name the 14 Cyberpunk stubs the NID database resolves refactor(libc): name the 12 Cyberpunk stubs the NID database resolves Oct 9, 2026
@github-actions github-actions Bot added the libc label Oct 9, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 merged commit bbc4438 into boykopovar:main Oct 9, 2026
7 of 8 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants