feat(libc): implement the std::__sce_v2 num_get virtuals for wchar_t integers, bool and pointers #16924

Open
Danigamer05 wants to merge 16 commits from upstream-pr/16924 into main
Danigamer05 commented 2026-11-07 22:54:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-07T22:54:50Z.


What

Builds on #16919: this branch contains its commits, and through it #16560, #16516, #16214, #16178 and #15923, with current main merged in. Until they merge, only the last commit is this PR's change.

Implement the same eight do_get virtuals of std::__sce_v2::num_get<wchar_t> that #16919 implements for char: bool, unsigned short, unsigned int, long, unsigned long, long long, unsigned long long and void*. Before this PR, each of them threw NotImplemented_nid_no_patch. The float, double and long double slots still throw. These slots are not exports, so this PR adds no NID.

The behavior comes from the libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6), vtable 0x18CDD0, field reader 0xE3350. The module's wide functions follow the same steps as the char ones, so the code of #16919, already a template on the character type, is now instantiated for 16-bit characters too:

  • The iterator holds a 16-bit character at offset 0xa, reads two bytes from the get area and moves its pointer by two bytes. underflow and uflow end the input only on -1, so U+FFFF is a character.
  • The digits, signs and prefix letters come from ctype<wchar_t>::widen, and every comparison, with them, with the thousands separator and with the bool names, uses all 16 bits.
  • numpunct<wchar_t> gives a 16-bit separator and 16-bit names, while grouping stays narrow.

The _Makeloc and num_get debt entries now cover both facets.

Tested

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

  • New test guest_sce_v2_num_get_wide: every implemented slot, characters whose low byte is a digit, a sign or the separator, U+FFFF from the get area and from underflow, the direct count, a held character, non-ASCII separators and bool names, and digits from a replaced ctype<wchar_t>. 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 differential harness of #16919, run on the wide facets from each side's _Makeloc, with 16-bit texts that mix ASCII, characters with a high byte and U+FFFF, random 16-bit separators, and bool names with non-ASCII characters. It compares the same fields as for char, with the get pointer in bytes.
    • With the module's _Sto*x redirected to this library's: 400,000 calls over 2 seeds, 0 differences.
    • With the module's own _Sto*x: 200,000 calls, 0 differences.
  • char regression on the harness of #16919: 100,000 calls, 0 differences.
  • Negative control: 8 single-change mutations that drop the high byte or step one byte at a time (pointer step, underflow result, get area read, digit lookup, sign, separator, bool names, end of input). The harness catches all 8. The first test run missed 3, so the test was strengthened and those were rerun: it now catches all 8 too.
  • check_conventions, git diff --check: clean. Merges cleanly with main. pr_overlap reports no open PR with the same functions; it could not compare 36 PRs that conflict with main on shared files. Of those, the 5 that touch LocaleSupport.cpp (#7081, #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: #16919
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5206610217 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16924). Originally posted by [Danigamer05](https://github.com/Danigamer05) on 2026-11-07T22:54:50Z. --- ### What Builds on #16919: this branch contains its commits, and through it #16560, #16516, #16214, #16178 and #15923, with current `main` merged in. Until they merge, only the last commit is this PR's change. Implement the same eight `do_get` virtuals of `std::__sce_v2::num_get<wchar_t>` that #16919 implements for `char`: `bool`, `unsigned short`, `unsigned int`, `long`, `unsigned long`, `long long`, `unsigned long long` and `void*`. Before this PR, each of them threw `NotImplemented_nid_no_patch`. The `float`, `double` and `long double` slots still throw. These slots are not exports, so this PR adds no NID. The behavior comes from the `libc.prx` bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 `483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6`), vtable `0x18CDD0`, field reader `0xE3350`. The module's wide functions follow the same steps as the `char` ones, so the code of #16919, already a template on the character type, is now instantiated for 16-bit characters too: - The iterator holds a 16-bit character at offset `0xa`, reads two bytes from the get area and moves its pointer by two bytes. `underflow` and `uflow` end the input only on -1, so U+FFFF is a character. - The digits, signs and prefix letters come from `ctype<wchar_t>::widen`, and every comparison, with them, with the thousands separator and with the `bool` names, uses all 16 bits. - `numpunct<wchar_t>` gives a 16-bit separator and 16-bit names, while `grouping` stays narrow. The `_Makeloc` and `num_get` debt entries now cover both facets. ### 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 #16919. Not run on Linux or macOS, not run in a title. - New test `guest_sce_v2_num_get_wide`: every implemented slot, characters whose low byte is a digit, a sign or the separator, U+FFFF from the get area and from `underflow`, the direct count, a held character, non-ASCII separators and `bool` names, and digits from a replaced `ctype<wchar_t>`. 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 differential harness of #16919, run on the wide facets from each side's `_Makeloc`, with 16-bit texts that mix ASCII, characters with a high byte and U+FFFF, random 16-bit separators, and `bool` names with non-ASCII characters. It compares the same fields as for `char`, with the get pointer in bytes. - With the module's `_Sto*x` redirected to this library's: 400,000 calls over 2 seeds, 0 differences. - With the module's own `_Sto*x`: 200,000 calls, 0 differences. - `char` regression on the harness of #16919: 100,000 calls, 0 differences. - Negative control: 8 single-change mutations that drop the high byte or step one byte at a time (pointer step, `underflow` result, get area read, digit lookup, sign, separator, `bool` names, end of input). The harness catches all 8. The first test run missed 3, so the test was strengthened and those were rerun: it now catches all 8 too. - `check_conventions`, `git diff --check`: clean. Merges cleanly with `main`. `pr_overlap` reports no open PR with the same functions; it could not compare 36 PRs that conflict with `main` on shared files. Of those, the 5 that touch `LocaleSupport.cpp` (#7081, #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: #16919 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-20 12:24:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T12:24:51Z.

Review: COMMENTED


Reviewed — no blocking findings

The review artifacts and repository source were not accessible in this session, so the change could not be verified.

What I ran

Not run; repo_read.py was unavailable.

Results

Check Result Note
Change review not run Source could not be read

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

The description, commits, diff, manifest, changed files, and repository context were not read. No checks were run.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5992604561 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16924#pullrequestreview-5992604561). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T12:24:51Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The review artifacts and repository source were not accessible in this session, so the change could not be verified. ## What I ran Not run; `repo_read.py` was unavailable. ## Results | Check | Result | Note | |---|---|---| | Change review | not run | Source could not be read | ## Findings ### Blocking None verified. ### Non-blocking None. ## Not verified The description, commits, diff, manifest, changed files, and repository context were not read. No checks were run. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 17:44:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:44:13Z.

Review: COMMENTED


I ran guest_sce_v2_num_get_wide and guest_sce_v2_num_get_char with c95d56ec56 and its prerequisite stack integrated into a Linux release build. Both passed. The wide fixture exercises the integer, boolean and pointer slots added here, and the char fixture checks the stacked implementation alongside it.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6175237219 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16924#pullrequestreview-6175237219). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T17:44:13Z. **Review:** COMMENTED --- I ran `guest_sce_v2_num_get_wide` and `guest_sce_v2_num_get_char` with `c95d56ec56` and its prerequisite stack integrated into a Linux release build. Both passed. The wide fixture exercises the integer, boolean and pointer slots added here, and the char fixture checks the stacked implementation alongside it. 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/16924:upstream-pr/16924'
git switch 'upstream-pr/16924'

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