Skip to content

feat(libc): export the std::__sce_v2 locale::global, empty, classic and _Locinfo category calls - #16113

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Danigamer05:feat/libc-sce-v2-locale-basics-20261105
Nov 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Danigamer05:feat/libc-sce-v2-locale-basics-20261105

Conversation

@Danigamer05

Copy link
Copy Markdown
Contributor

What

Export the versioned std::__sce_v2 locale::classic, locale::empty, locale::global, locale::_Setgloballocale, _Locimp::_New_Locimp(bool), _Locimp::_Clocptr, _sceLibcLocinfo, and the _Locinfo constructor and _Addcats that take a category, from libc.

Export NID Original address
_ZNSt8__sce_v26locale16_SetgloballocaleEPv kyDNldAZhv4 0xCFD50
_ZNSt8__sce_v26locale7classicEv f0KW1y+Ea0Q 0xCFE30
_ZNSt8__sce_v26locale5emptyEv KA0vt-WXdqQ 0xD0D90
_ZNSt8__sce_v26locale7_Locimp11_New_LocimpEb VUJZ+pCrRn4 0xD0DF0
_ZNSt8__sce_v26locale6globalERKS0_ v+WMV7IIp7w 0xF18A0
_ZNSt8__sce_v28_Locinfo13_Locinfo_ctorEPS0_iPKc 6cl-GjyMBbU 0xF27F0
_ZNSt8__sce_v28_Locinfo16_Locinfo_AddcatsEPS0_iPKc TM74yWf91xI 0xF2860
_ZNSt8__sce_v215_sceLibcLocinfoEPKc dJM+bL2BU9E 0xF28B0
_ZNSt8__sce_v26locale7_Locimp8_ClocptrE HWch8-MtqmQ 0x197900

The behavior comes from the libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6).

They build on main's versioned locale, which shares the unversioned 0x30-byte _Locimp and has the classic locale ready from the start. As in the module:

  • classic() returns a static locale that holds the classic _Locimp, and _Clocptr points at that _Locimp;
  • empty() and _New_Locimp(bool) build a _Locimp with one reference, no facets, category 0 and the name *; empty() makes it transparent and _New_Locimp takes the flag;
  • _Setgloballocale stores the global _Locimp, and _Getgloballocale and _Init(bool) now return that global instead of the classic one, so they follow it once it changes; _Init still takes a reference when its flag is set;
  • global() returns the previous global through _Init(true). When the new locale differs, it releases the old global's reference, installs and retains the new one, and calls setlocale with its name for each category in its mask, or once for all six;
  • _sceLibcLocinfo throws runtime_error("bad locale name") unless the name is "" or "C". The two _Locinfo calls ignore the category, check the name the same way, and store setlocale(LC_ALL, nullptr); the constructor first stores the current name, and both store the classic name only after the check.

_Locimp_ctor and _Locimp_dtor are left for a follow-up, since they need reference counting in _Locimp_Addfac and _New_Locimp(const _Locimp&), which main does not do yet. A new debt entry records what differs here. The existing versioned locale entry now says _Init and _Getgloballocale return the global locale.

Tested

Windows x86-64, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main d893997f1a6. Exact tested commit: d18e1c71325.

Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded.

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

🤖 Generated with Claude Code

…nd _Locinfo category calls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Progress report (dd6efc7 → d18e1c7)

📈 System libraries: 26.91% (+0.02%, +8 implemented functions)

✅ 8 implemented
Library Name
libc _ZNSt8__sce_v215_sceLibcLocinfoEPKc_nid_postfix
libc _ZNSt8__sce_v26locale16_SetgloballocaleEPv_nid_postfix
libc _ZNSt8__sce_v26locale5emptyEv_nid_postfix
libc _ZNSt8__sce_v26locale6globalERKS0__nid_postfix
libc _ZNSt8__sce_v26locale7_Locimp11_New_LocimpEb_nid_postfix
libc _ZNSt8__sce_v26locale7classicEv_nid_postfix
libc _ZNSt8__sce_v28_Locinfo13_Locinfo_ctorEPS0_iPKc_nid_postfix
libc _ZNSt8__sce_v28_Locinfo16_Locinfo_AddcatsEPS0_iPKc_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libc 1629/1649 (98.79%) 1637/1657 (98.79%) +0.01%

@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Windows check of head d18e1c7132, merged onto main d48f11ab16 (bf9c3398ec, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_sce_v2_locale_basics passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants