feat(libc): export std::numpunct<wchar_t> id and _Getcat #11773

Merged
edubox merged 2 commits from upstream-pr/11773 into main 2026-11-02 12:26:41 +00:00
edubox commented 2026-10-27 07:35:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-10-27T07:35:33Z.


What

Export std::numpunct<wchar_t>::id (XZNi3XtbWQ4) and implement std::numpunct<wchar_t>::_Getcat (SdXFaufpLIs), the two unversioned libc symbols that the libc.prx of Rayman 30 Aniversario (PPSA33016) and Fatal Frame II (PPSA32802) import and AnyPS5 does not export.

The facet is the same 0x30-byte C-locale object as the narrow numpunct<char>: grouping is a narrow string pointer at offset 0x10, falsename and truename are pointers to 16-bit strings at offsets 0x20 and 0x28, and decimal_point and thousands_sep are 16-bit values at 0x18 and 0x1a. The grouping virtual writes the narrow string with the narrow size and capacity rules (inline capacity 15, heap capacity length | 15), while falsename and truename write the guest 16-bit string with the same rules as collate<wchar_t>::do_transform (inline capacity 7, heap capacity length | 7, two bytes per unit). _Getcat returns 4, as the narrow entry does.

Console evidence: in the libc.prx shipped by PPSA33016 (unwrapped, dynsym), XZNi3XtbWQ4 is an 8-byte STT_OBJECT in .data, and SdXFaufpLIs is a 0x17b-byte function at 0xa2670 that allocates 0x30 bytes, stores the vtable, the empty grouping string, 16-bit '.' and ',', pointers to the 16-bit strings "false" and "true", and returns 4.

Tested

  • guest_locale_tests passes. The new checks cover the wide id's 8-byte size, the facet's 16-bit ./,, the narrow empty grouping, and the 16-bit "false"/"true".
  • Rayman 30 Aniversario PPSA33016: with this change the title resolves both NIDs and loads; it presented 11 frames in 120 s with no undefined symbol or crash. The title also imports the _Cnd_register_at_thread_exit/_Cnd_unregister_at_thread_exit pair, so that run used a local build that includes those registrations; this PR does not depend on that work.
  • Fatal Frame II PPSA32802 imports the same two NIDs, but its run aborts later in a guest formatting path (__stack_chk_fail) that never reaches the wide facet, so it is not used as evidence here.

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 (PPSA33016 and PPSA32802 import these NIDs; neither has a Game bring-up discussion)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5030287940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11773). Originally posted by [edubox](https://github.com/edubox) on 2026-10-27T07:35:33Z. --- ### What Export `std::numpunct<wchar_t>::id` (`XZNi3XtbWQ4`) and implement `std::numpunct<wchar_t>::_Getcat` (`SdXFaufpLIs`), the two unversioned libc symbols that the `libc.prx` of Rayman 30 Aniversario (PPSA33016) and Fatal Frame II (PPSA32802) import and AnyPS5 does not export. The facet is the same 0x30-byte C-locale object as the narrow `numpunct<char>`: `grouping` is a narrow string pointer at offset 0x10, `falsename` and `truename` are pointers to 16-bit strings at offsets 0x20 and 0x28, and `decimal_point` and `thousands_sep` are 16-bit values at 0x18 and 0x1a. The `grouping` virtual writes the narrow string with the narrow size and capacity rules (inline capacity 15, heap capacity `length | 15`), while `falsename` and `truename` write the guest 16-bit string with the same rules as `collate<wchar_t>::do_transform` (inline capacity 7, heap capacity `length | 7`, two bytes per unit). `_Getcat` returns 4, as the narrow entry does. Console evidence: in the `libc.prx` shipped by PPSA33016 (unwrapped, dynsym), `XZNi3XtbWQ4` is an 8-byte `STT_OBJECT` in `.data`, and `SdXFaufpLIs` is a 0x17b-byte function at 0xa2670 that allocates 0x30 bytes, stores the vtable, the empty grouping string, 16-bit `'.'` and `','`, pointers to the 16-bit strings `"false"` and `"true"`, and returns 4. ### Tested - `guest_locale_tests` passes. The new checks cover the wide id's 8-byte size, the facet's 16-bit `.`/`,`, the narrow empty grouping, and the 16-bit `"false"`/`"true"`. - Rayman 30 Aniversario PPSA33016: with this change the title resolves both NIDs and loads; it presented 11 frames in 120 s with no undefined symbol or crash. The title also imports the `_Cnd_register_at_thread_exit`/`_Cnd_unregister_at_thread_exit` pair, so that run used a local build that includes those registrations; this PR does not depend on that work. - Fatal Frame II PPSA32802 imports the same two NIDs, but its run aborts later in a guest formatting path (`__stack_chk_fail`) that never reaches the wide facet, so it is not used as evidence here. ### 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 (PPSA33016 and PPSA32802 import these NIDs; neither has a Game bring-up discussion) - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!11773
No description provided.