feat(libSceLibcInternal): implement the codecvt<char,char,_Mbstatet> conversion members #18081

Merged
jaqb merged 2 commits from upstream-pr/18081 into main 2026-11-13 08:28:35 +00:00
jaqb commented 2026-11-10 10:42:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jaqb on 2026-11-10T10:42:33Z.


What

Implements nine std::codecvt<char,char,_Mbstatet> exports of libSceLibcInternal that threw through NotImplemented_nid_no_patch:

  • do_always_noconv (7tIwDZyyKHo), do_in (P+q1OLiErP0), do_out (Uc+-Sx0UZ3U), do_unshift (iCWgjeqMHvg) and do_length (Xk7IZcfHDD8) repeat the libc.prx facet in core/libs/prx/libc/src/LocaleSupport.cpp: do_always_noconv is true, do_in and do_out return noconv with both next pointers at the range starts, do_unshift returns ok with the next pointer at the start of the output range, do_length returns the shorter of the range and the count.
  • in (TNexGlwiVEQ), out (14xKj+SV72o), unshift (N7z+Dnk1cS0) and length (ikBt0lqkxPc) call the object's vtable through GuestLocale::CodecvtVtable, at the libc.prx slot offsets 0x38, 0x40, 0x48 and 0x50.

The exports move from Err.cpp to a new CodecvtChar.cpp; their declarations move from ErrExports.hpp to Api.hpp with real prototypes. sceLibcInternalPending3_035_nid_no_patch becomes sceLibcInternalCodecvtCharDoLength_nid_no_patch.

Source of the behaviour: the existing libc facet, which docs/dev/debt/libc.md records as built from a console libc.prx. Nothing was compared with the console's libSceLibcInternal.sprx and no title was seen calling these exports. The nine "import resolution only" debt entries are replaced by one entry stating that, including that the virtual dispatch of the four members and the slot order of vtable aK1Ymf-NhAs are unverified, and that do_length returns 64 bits where Dinkumware <xlocale> declares int.

Tested

Windows 11, MinGW-w64 GCC (WinLibs), Release, full configure. Built guest_libc_internal_codecvt_char_tests, guest_libc_internal_constant_members_tests, guest_libc_internal_unexpected_tests and guest_err_tests and ran:

  • guest_libc_internal_codecvt_char (new): the five virtuals, the four members on a facet built from them, agreement with the facet libc's _Getcat builds, and dispatch of the four members to an overriding vtable. Passed.
  • guest_libc_internal_constant_members, guest_libc_internal_unexpected, guest_err, public_headers. Passed.
  • python tools/check_conventions.py --base upstream/main. Passed.

Not tested: Linux, any title or homebrew, the rest of the test suite. tools/pr_overlap.py was not run (no gh on this machine); open pull requests were searched by hand for these symbols and NIDs.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5239912189 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18081). Originally posted by [jaqb](https://github.com/jaqb) on 2026-11-10T10:42:33Z. --- ### What Implements nine `std::codecvt<char,char,_Mbstatet>` exports of libSceLibcInternal that threw through `NotImplemented_nid_no_patch`: - `do_always_noconv` (`7tIwDZyyKHo`), `do_in` (`P+q1OLiErP0`), `do_out` (`Uc+-Sx0UZ3U`), `do_unshift` (`iCWgjeqMHvg`) and `do_length` (`Xk7IZcfHDD8`) repeat the `libc.prx` facet in `core/libs/prx/libc/src/LocaleSupport.cpp`: `do_always_noconv` is true, `do_in` and `do_out` return `noconv` with both next pointers at the range starts, `do_unshift` returns `ok` with the next pointer at the start of the output range, `do_length` returns the shorter of the range and the count. - `in` (`TNexGlwiVEQ`), `out` (`14xKj+SV72o`), `unshift` (`N7z+Dnk1cS0`) and `length` (`ikBt0lqkxPc`) call the object's vtable through `GuestLocale::CodecvtVtable`, at the `libc.prx` slot offsets 0x38, 0x40, 0x48 and 0x50. The exports move from `Err.cpp` to a new `CodecvtChar.cpp`; their declarations move from `ErrExports.hpp` to `Api.hpp` with real prototypes. `sceLibcInternalPending3_035_nid_no_patch` becomes `sceLibcInternalCodecvtCharDoLength_nid_no_patch`. Source of the behaviour: the existing libc facet, which `docs/dev/debt/libc.md` records as built from a console `libc.prx`. Nothing was compared with the console's `libSceLibcInternal.sprx` and no title was seen calling these exports. The nine "import resolution only" debt entries are replaced by one entry stating that, including that the virtual dispatch of the four members and the slot order of vtable `aK1Ymf-NhAs` are unverified, and that `do_length` returns 64 bits where Dinkumware `<xlocale>` declares `int`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, MinGW-w64 GCC (WinLibs), Release, full configure. Built `guest_libc_internal_codecvt_char_tests`, `guest_libc_internal_constant_members_tests`, `guest_libc_internal_unexpected_tests` and `guest_err_tests` and ran: - `guest_libc_internal_codecvt_char` (new): the five virtuals, the four members on a facet built from them, agreement with the facet libc's `_Getcat` builds, and dispatch of the four members to an overriding vtable. Passed. - `guest_libc_internal_constant_members`, `guest_libc_internal_unexpected`, `guest_err`, `public_headers`. Passed. - `python tools/check_conventions.py --base upstream/main`. Passed. Not tested: Linux, any title or homebrew, the rest of the test suite. `tools/pr_overlap.py` was not run (no `gh` on this machine); open pull requests were searched by hand for these symbols and NIDs. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [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!18081
No description provided.