feat(libc): implement the std::__sce_v2 num_get virtuals for wchar_t floating point #16949

Open
Danigamer05 wants to merge 27 commits from upstream-pr/16949 into main
Danigamer05 commented 2026-11-08 00:22:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-08T00:22:14Z.


What

Builds on #16924 and #16944, which both build on #16919: this branch merges the two, and through them #16560, #16516, #16214, #16178 and #15923, with current main. The merge resolves the two debt entries both rewrite. Until they merge, only the last commit is this PR's change.

Implement the float, double and long double do_get virtuals of std::__sce_v2::num_get<wchar_t>, the last slots of the facet that still threw NotImplemented_nid_no_patch. These slots are not exports, so this PR adds no NID.

The libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6) reads these fields for wchar_t (0xE2530, 0xE2780, 0xE29D0) with the same readers as for char, on 16-bit characters. So this PR only lets the wchar_t vtable use the templated functions of #16944, which were limited to char until it could be checked. The digits, signs, x, e, p and the decimal point come from ctype<wchar_t> and numpunct<wchar_t>, and every comparison uses all 16 bits.

Tested

Windows 11, MinGW GCC 15.2, Release, head on top of #16924 and #16944. Not run on Linux or macOS, not run in a title.

  • guest_sce_v2_num_get_wide now also covers the three slots: decimal and hex fields, hexfloat for long double, characters whose low byte is a digit, e, E or the point, and a non-ASCII separator and decimal point for both readers. It passes, as do guest_sce_v2_num_get_char, guest_sce_v2_num_put_char, guest_sce_v2_num_put_wide, guest_sce_v2_char_facet_virtuals, guest_sce_v2_makeloc, guest_sce_v2_locale, guest_sce_v2_locale_basics, guest_sce_v2_locimp_references, guest_sce_v2_facet_ids, guest_locale, guest_sce_v2_exceptions, guest_sce_v2_string_to_integer and public_headers (14 of 14).
  • The floating-point harness of #16944 on the wide facets, with 16-bit texts that mix ASCII, characters with a high byte and U+FFFF, random 16-bit separators and decimal points, and hexfloat on a quarter of the calls.
    • With the module's conversion functions redirected to this library's: 400,000 calls over 2 seeds, 0 differences.
    • With the module's own: 81 of 200,000 calls differ, all in the last bit of a float (76) or double (5), as for char.
  • Regression on the harnesses of #16944, #16924 and #16919: 30,000 calls each, 0 differences.
  • Negative control: 3 mutations that compare only the low byte of the digits, the exponent letter or the decimal point. The harness catches all 3. The first test run missed 2, so the test was strengthened and those were rerun: it now catches all 3 too.
  • check_conventions, git diff --check: clean. Merges cleanly with main. pr_overlap reports no open PR with the same functions or conflicting code; it could not compare 34 PRs that conflict with main on shared files, and the 4 of them that touch LocaleSupport.cpp (#9526, #11172, #12518, #12704) do not add these virtuals.

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: #16924, #16944
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5207171116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16949). Originally posted by [Danigamer05](https://github.com/Danigamer05) on 2026-11-08T00:22:14Z. --- ### What Builds on #16924 and #16944, which both build on #16919: this branch merges the two, and through them #16560, #16516, #16214, #16178 and #15923, with current `main`. The merge resolves the two debt entries both rewrite. Until they merge, only the last commit is this PR's change. Implement the `float`, `double` and `long double` `do_get` virtuals of `std::__sce_v2::num_get<wchar_t>`, the last slots of the facet that still threw `NotImplemented_nid_no_patch`. These slots are not exports, so this PR adds no NID. The `libc.prx` bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 `483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6`) reads these fields for `wchar_t` (`0xE2530`, `0xE2780`, `0xE29D0`) with the same readers as for `char`, on 16-bit characters. So this PR only lets the `wchar_t` vtable use the templated functions of #16944, which were limited to `char` until it could be checked. The digits, signs, `x`, `e`, `p` and the decimal point come from `ctype<wchar_t>` and `numpunct<wchar_t>`, and every comparison uses all 16 bits. ### 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 GCC 15.2, Release, head on top of #16924 and #16944. Not run on Linux or macOS, not run in a title. - `guest_sce_v2_num_get_wide` now also covers the three slots: decimal and hex fields, `hexfloat` for `long double`, characters whose low byte is a digit, `e`, `E` or the point, and a non-ASCII separator and decimal point for both readers. It passes, as do `guest_sce_v2_num_get_char`, `guest_sce_v2_num_put_char`, `guest_sce_v2_num_put_wide`, `guest_sce_v2_char_facet_virtuals`, `guest_sce_v2_makeloc`, `guest_sce_v2_locale`, `guest_sce_v2_locale_basics`, `guest_sce_v2_locimp_references`, `guest_sce_v2_facet_ids`, `guest_locale`, `guest_sce_v2_exceptions`, `guest_sce_v2_string_to_integer` and `public_headers` (14 of 14). - The floating-point harness of #16944 on the wide facets, with 16-bit texts that mix ASCII, characters with a high byte and U+FFFF, random 16-bit separators and decimal points, and `hexfloat` on a quarter of the calls. - With the module's conversion functions redirected to this library's: 400,000 calls over 2 seeds, 0 differences. - With the module's own: 81 of 200,000 calls differ, all in the last bit of a `float` (76) or `double` (5), as for `char`. - Regression on the harnesses of #16944, #16924 and #16919: 30,000 calls each, 0 differences. - Negative control: 3 mutations that compare only the low byte of the digits, the exponent letter or the decimal point. The harness catches all 3. The first test run missed 2, so the test was strengthened and those were rerun: it now catches all 3 too. - `check_conventions`, `git diff --check`: clean. Merges cleanly with `main`. `pr_overlap` reports no open PR with the same functions or conflicting code; it could not compare 34 PRs that conflict with `main` on shared files, and the 4 of them that touch `LocaleSupport.cpp` (#9526, #11172, #12518, #12704) do not add these virtuals. ### 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: #16924, #16944 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-20 11:49:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:49:48Z.

Review: COMMENTED


Reviewed — comments

A formal decision is not justified because the changed-file audit is incomplete and I could not run the checks in this environment.

What I ran

Reviewed head 100ffa6068237f998d6aebac591e7efa575b8d30 using targeted reader calls. I ran no commands or tests. The author reports Windows 11 and MinGW GCC 15.2 checks; those results were not independently verified.

Results

Check Result Note
Prepared diff review not run Read only selected ranges
Tests and prechecks not run Author-reported results only

Findings

Blocking

No verified blocking finding in the inspected code.

Non-blocking

None.

Not verified

Read the review description, commits, manifest, selected diff ranges, the full GuestSceV2NumGetWide.cpp, changed lines in GuestLocale.hpp, and targeted LocaleSupport.cpp sections. The full diff and remaining changed code were not read: CMakeLists.txt, GuestSceV2CharFacetVirtuals.cpp, GuestSceV2NumGetChar.cpp, GuestSceV2NumPutChar.cpp, GuestSceV2NumPutWide.cpp, and docs/dev/debt/libc.md. Tests, prechecks, and platform behavior were not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5992194276 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16949#pullrequestreview-5992194276). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T11:49:48Z. **Review:** COMMENTED --- # Reviewed — comments A formal decision is not justified because the changed-file audit is incomplete and I could not run the checks in this environment. ## What I ran Reviewed head `100ffa6068237f998d6aebac591e7efa575b8d30` using targeted reader calls. I ran no commands or tests. The author reports Windows 11 and MinGW GCC 15.2 checks; those results were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Prepared diff review | not run | Read only selected ranges | | Tests and prechecks | not run | Author-reported results only | ## Findings ### Blocking No verified blocking finding in the inspected code. ### Non-blocking None. ## Not verified Read the review description, commits, manifest, selected diff ranges, the full `GuestSceV2NumGetWide.cpp`, changed lines in `GuestLocale.hpp`, and targeted `LocaleSupport.cpp` sections. The full diff and remaining changed code were not read: `CMakeLists.txt`, `GuestSceV2CharFacetVirtuals.cpp`, `GuestSceV2NumGetChar.cpp`, `GuestSceV2NumPutChar.cpp`, `GuestSceV2NumPutWide.cpp`, and `docs/dev/debt/libc.md`. Tests, prechecks, and platform behavior were not verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 07:19:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:19:28Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this review; the implementation and tests were not fully read, so a formal merge decision is not justified.

What I ran

  • Inspected the prepared diff and description for head 5076834190f592df65074ddd3e98aee1d430e443.
  • No commands or tests were run. The repository reader was unavailable in this session.

Results

Check Result Note
Diff inspection passed Prepared bundle inspected
Tests not run Only author-reported results available
Full changed-line review not run Not every added line was read

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

The full implementation and all added tests were not read. The changed files listed in the bundle are core/libs/prx/libc/CMakeLists.txt, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp, core/libs/tests/GuestSceV2CharFacetVirtuals.cpp, core/libs/tests/GuestSceV2NumGetChar.cpp, core/libs/tests/GuestSceV2NumGetWide.cpp, core/libs/tests/GuestSceV2NumPutChar.cpp, core/libs/tests/GuestSceV2NumPutWide.cpp, and docs/dev/debt/libc.md. The review bundle lists all nine as included; only excerpts of the diff were inspected, and no repository files were read through repo_read.py. Tests, CI, and console behavior were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6003769808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16949#pullrequestreview-6003769808). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T07:19:28Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this review; the implementation and tests were not fully read, so a formal merge decision is not justified. ## What I ran - Inspected the prepared diff and description for head `5076834190f592df65074ddd3e98aee1d430e443`. - No commands or tests were run. The repository reader was unavailable in this session. ## Results | Check | Result | Note | |---|---|---| | Diff inspection | passed | Prepared bundle inspected | | Tests | not run | Only author-reported results available | | Full changed-line review | not run | Not every added line was read | ## Findings ### Blocking None verified. ### Non-blocking None. ## Not verified The full implementation and all added tests were not read. The changed files listed in the bundle are `core/libs/prx/libc/CMakeLists.txt`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, `core/libs/tests/GuestSceV2CharFacetVirtuals.cpp`, `core/libs/tests/GuestSceV2NumGetChar.cpp`, `core/libs/tests/GuestSceV2NumGetWide.cpp`, `core/libs/tests/GuestSceV2NumPutChar.cpp`, `core/libs/tests/GuestSceV2NumPutWide.cpp`, and `docs/dev/debt/libc.md`. The review bundle lists all nine as included; only excerpts of the diff were inspected, and no repository files were read through `repo_read.py`. Tests, CI, and console behavior were not independently verified. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 13:12:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:12:40Z.

Review: COMMENTED


Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused GuestSceV2NumGetWide fixture passed.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6170472008 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16949#pullrequestreview-6170472008). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T13:12:40Z. **Review:** COMMENTED --- Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused `GuestSceV2NumGetWide` fixture passed. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/16949:upstream-pr/16949'
git switch 'upstream-pr/16949'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/16949'
git switch 'upstream-pr/16949'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/16949'
git switch 'upstream-pr/16949'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/16949'
git switch 'main'
git merge --squash 'upstream-pr/16949'
git switch 'main'
git merge --ff-only 'upstream-pr/16949'
git switch 'main'
git merge 'upstream-pr/16949'
git push origin 'main'
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!16949
No description provided.