feat(libc): implement the std::__sce_v2 collate and moneypunct virtuals #17277

Open
Danigamer05 wants to merge 29 commits from upstream-pr/17277 into main
Danigamer05 commented 2026-11-08 17:08:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-08T17:08:21Z.


What

Builds on #16975: this branch contains its commits, and through them #16949, #16944, #16924, #16919, #16560, #16516, #16214, #16178 and #15923, with current main. It needs none of their code, only their place in LocaleSupport.cpp, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change.

Implement the virtuals of std::__sce_v2::collate<char>, collate<wchar_t> and the four moneypunct<char, Intl> and moneypunct<wchar_t, Intl> facets, which _Makeloc builds and use_facet hands to money_get, money_put, regex and any caller that sorts or hashes strings by locale. Before this PR, each of their 24 slots threw NotImplemented_nid_no_patch. 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), vtables 0x18C868 and 0x18CF70 (collate), 0x18CB30, 0x18C9C8, 0x18D1A8 and 0x18D088 (moneypunct):

  • collate::do_compare calls _Strcoll or _Wcscoll, which in this module ignore the collation data: they compare the common prefix as unsigned code units, then the lengths. The facet returns -1, 0 or 1.
  • collate::do_transform grows the result with _Strxfrm or _Wcsxfrm, which copy the range when it fits. The result is the range itself, null bytes included, with the capacity a direct construction gives. A wchar_t range of an odd byte count yields that many characters rounded down, all zero, because the copy never fits.
  • collate::do_hash is 64-bit FNV-1a over the range's bytes. For wchar_t that is both bytes of each character, not the character values.
  • moneypunct returns its fields: do_decimal_point and do_thousands_sep the characters at 0x18 and 0x19 (0x1a for wchar_t), do_grouping a string of the bytes at 0x10, do_curr_symbol, do_positive_sign and do_negative_sign a string of the facet's type from 0x20, 0x28 and 0x30, do_frac_digits the word at 0x38, and do_pos_format and do_neg_format the four pattern bytes at 0x3c and 0x40. Both International values share these functions.

AssignSceV2String and AssignSceV2WideString now share the layout code with the transform through ReserveSceV2String; their output is unchanged. The _Makeloc debt entry lists the new facets among the working ones, and a new entry records the one difference: the module truncates collation lengths to 32 bits.

Tested

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

  • New test guest_sce_v2_collate_moneypunct: ordering, unsigned code units, prefixes and null bytes in do_compare; short, long, empty and odd-sized ranges in do_transform, with their capacities; pinned FNV-1a values in do_hash; every moneypunct slot for both character types and both International values, on the C locale's facets and on facets with set fields.
  • Differential harness against the module's own code, loaded and relocated, with the facets from each side's _Makeloc and the module's own _Strcoll, _Strxfrm, _Wcscoll and _Wcsxfrm. Inputs: random ranges up to 4,200 code units with null bytes, high bytes, shared prefixes, odd byte counts for wchar_t and null pointers for empty ranges; and moneypunct facets whose fields are set to random characters, strings up to 4,200 units, digit counts and patterns. It compares results, the returned string's 32 bytes, contents and terminator, and the allocations each side makes.
    • The C locale's moneypunct slots: 36 calls, 0 differences.
    • 900,000 random calls over 3 seeds, 0 differences: about 675,000 collate calls (with about 179,000 heap-allocated results and all three orderings) and 225,000 moneypunct calls.
  • The libc tests built from this head, without the tests that drive the GPU, audio or controllers (149: every guest_sce_v2_*, locale, string and public_headers test): all pass.
  • Negative control: 11 single-change mutations. The final test catches all 11. The harness reports differences for 10; with the eleventh, do_hash per character, the mutated code steps past the end of an odd-sized range and the harness crashes before its first comparison.
  • 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 45 PRs that conflict with main on shared files, and of the 4 that touch LocaleSupport.cpp (#9526, #11172, #12518, #12704) none adds 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: #16975
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5213319781 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277). Originally posted by [Danigamer05](https://github.com/Danigamer05) on 2026-11-08T17:08:21Z. --- ### What Builds on #16975: this branch contains its commits, and through them #16949, #16944, #16924, #16919, #16560, #16516, #16214, #16178 and #15923, with current `main`. It needs none of their code, only their place in `LocaleSupport.cpp`, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change. Implement the virtuals of `std::__sce_v2::collate<char>`, `collate<wchar_t>` and the four `moneypunct<char, Intl>` and `moneypunct<wchar_t, Intl>` facets, which `_Makeloc` builds and `use_facet` hands to `money_get`, `money_put`, `regex` and any caller that sorts or hashes strings by locale. Before this PR, each of their 24 slots threw `NotImplemented_nid_no_patch`. 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`), vtables `0x18C868` and `0x18CF70` (`collate`), `0x18CB30`, `0x18C9C8`, `0x18D1A8` and `0x18D088` (`moneypunct`): - `collate::do_compare` calls `_Strcoll` or `_Wcscoll`, which in this module ignore the collation data: they compare the common prefix as unsigned code units, then the lengths. The facet returns -1, 0 or 1. - `collate::do_transform` grows the result with `_Strxfrm` or `_Wcsxfrm`, which copy the range when it fits. The result is the range itself, null bytes included, with the capacity a direct construction gives. A `wchar_t` range of an odd byte count yields that many characters rounded down, all zero, because the copy never fits. - `collate::do_hash` is 64-bit FNV-1a over the range's bytes. For `wchar_t` that is both bytes of each character, not the character values. - `moneypunct` returns its fields: `do_decimal_point` and `do_thousands_sep` the characters at `0x18` and `0x19` (`0x1a` for `wchar_t`), `do_grouping` a `string` of the bytes at `0x10`, `do_curr_symbol`, `do_positive_sign` and `do_negative_sign` a string of the facet's type from `0x20`, `0x28` and `0x30`, `do_frac_digits` the word at `0x38`, and `do_pos_format` and `do_neg_format` the four pattern bytes at `0x3c` and `0x40`. Both `International` values share these functions. `AssignSceV2String` and `AssignSceV2WideString` now share the layout code with the transform through `ReserveSceV2String`; their output is unchanged. The `_Makeloc` debt entry lists the new facets among the working ones, and a new entry records the one difference: the module truncates collation lengths to 32 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 #16975. Not run on Linux or macOS, not run in a title. - New test `guest_sce_v2_collate_moneypunct`: ordering, unsigned code units, prefixes and null bytes in `do_compare`; short, long, empty and odd-sized ranges in `do_transform`, with their capacities; pinned FNV-1a values in `do_hash`; every `moneypunct` slot for both character types and both `International` values, on the C locale's facets and on facets with set fields. - Differential harness against the module's own code, loaded and relocated, with the facets from each side's `_Makeloc` and the module's own `_Strcoll`, `_Strxfrm`, `_Wcscoll` and `_Wcsxfrm`. Inputs: random ranges up to 4,200 code units with null bytes, high bytes, shared prefixes, odd byte counts for `wchar_t` and null pointers for empty ranges; and `moneypunct` facets whose fields are set to random characters, strings up to 4,200 units, digit counts and patterns. It compares results, the returned string's 32 bytes, contents and terminator, and the allocations each side makes. - The C locale's `moneypunct` slots: 36 calls, 0 differences. - 900,000 random calls over 3 seeds, 0 differences: about 675,000 `collate` calls (with about 179,000 heap-allocated results and all three orderings) and 225,000 `moneypunct` calls. - The libc tests built from this head, without the tests that drive the GPU, audio or controllers (149: every `guest_sce_v2_*`, locale, string and `public_headers` test): all pass. - Negative control: 11 single-change mutations. The final test catches all 11. The harness reports differences for 10; with the eleventh, `do_hash` per character, the mutated code steps past the end of an odd-sized range and the harness crashes before its first comparison. - `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 45 PRs that conflict with `main` on shared files, and of the 4 that touch `LocaleSupport.cpp` (#9526, #11172, #12518, #12704) none adds 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: #16975 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-08 18:30:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-08T18:30:27Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against a8263bfa80:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_sce_v2_char_facet_virtuals_tests, guest_sce_v2_codecvt_wide_tests, guest_sce_v2_collate_moneypunct_tests, guest_sce_v2_facet_ids_tests, guest_sce_v2_makeloc_tests, guest_sce_v2_num_get_char_tests, guest_sce_v2_num_get_wide_tests, guest_sce_v2_num_put_char_tests, guest_sce_v2_num_put_wide_tests failed to build.
    core/libs/prx/libc/src/LocaleSupport.cpp:2953:49: error: no matching function for call to ‘min(const int64_t&, long long int)’
    
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819090112 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-5819090112). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-08T18:30:27Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `a8263bfa80`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_sce_v2_char_facet_virtuals_tests`, `guest_sce_v2_codecvt_wide_tests`, `guest_sce_v2_collate_moneypunct_tests`, `guest_sce_v2_facet_ids_tests`, `guest_sce_v2_makeloc_tests`, `guest_sce_v2_num_get_char_tests`, `guest_sce_v2_num_get_wide_tests`, `guest_sce_v2_num_put_char_tests`, `guest_sce_v2_num_put_wide_tests` failed to build. ``` core/libs/prx/libc/src/LocaleSupport.cpp:2953:49: error: no matching function for call to ‘min(const int64_t&, long long int)’ ``` - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 22:02:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T22:02:26Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 3701c28f26:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_sce_v2_char_facet_virtuals_tests, guest_sce_v2_codecvt_wide_tests, guest_sce_v2_collate_moneypunct_tests, guest_sce_v2_facet_ids_tests, guest_sce_v2_makeloc_tests, guest_sce_v2_num_get_char_tests, guest_sce_v2_num_get_wide_tests, guest_sce_v2_num_put_char_tests, guest_sce_v2_num_put_wide_tests failed to build.
    core/libs/prx/libc/src/LocaleSupport.cpp:2970:49: error: no matching function for call to ‘min(const int64_t&, long long int)’
    
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5882702561 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-5882702561). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T22:02:26Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `3701c28f26`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_sce_v2_char_facet_virtuals_tests`, `guest_sce_v2_codecvt_wide_tests`, `guest_sce_v2_collate_moneypunct_tests`, `guest_sce_v2_facet_ids_tests`, `guest_sce_v2_makeloc_tests`, `guest_sce_v2_num_get_char_tests`, `guest_sce_v2_num_get_wide_tests`, `guest_sce_v2_num_put_char_tests`, `guest_sce_v2_num_put_wide_tests` failed to build. ``` core/libs/prx/libc/src/LocaleSupport.cpp:2970:49: error: no matching function for call to ‘min(const int64_t&, long long int)’ ``` - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-15 21:09:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:09:25Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 225eb97633:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_sce_v2_char_facet_virtuals_tests, guest_sce_v2_codecvt_wide_tests, guest_sce_v2_collate_moneypunct_tests, guest_sce_v2_facet_ids_tests, guest_sce_v2_makeloc_tests, guest_sce_v2_num_get_char_tests, guest_sce_v2_num_get_wide_tests, guest_sce_v2_num_put_char_tests, guest_sce_v2_num_put_wide_tests built cleanly.
  • CTest (guest_sce_v2_makeloc, guest_sce_v2_char_facet_virtuals, guest_sce_v2_num_put_char, guest_sce_v2_num_put_wide, guest_sce_v2_codecvt_wide, guest_sce_v2_collate_moneypunct, guest_sce_v2_num_get_char, guest_sce_v2_num_get_wide, guest_sce_v2_facet_ids):
    1/9 Test  #846: guest_sce_v2_makeloc ...............   Passed    0.02 sec
    2/9 Test  #847: guest_sce_v2_char_facet_virtuals ...   Passed    0.03 sec
    3/9 Test  #848: guest_sce_v2_num_put_char ..........   Passed    0.02 sec
    4/9 Test  #849: guest_sce_v2_num_put_wide ..........   Passed    0.02 sec
    5/9 Test  #850: guest_sce_v2_codecvt_wide ..........   Passed    0.02 sec
    6/9 Test  #851: guest_sce_v2_collate_moneypunct ....   Passed    0.03 sec
    7/9 Test  #852: guest_sce_v2_num_get_char ..........   Passed    0.03 sec
    8/9 Test  #853: guest_sce_v2_num_get_wide ..........   Passed    0.03 sec
    9/9 Test #1132: guest_sce_v2_facet_ids .............   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 9
    
  • Negative control: with core/libs/prx/libc/include/Api.hpp, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libc/src/LocaleSupport.cpp: verified std::__sce_v2::collate and collate<wchar_t> virtual implementations (do_compare, do_transform, do_hash) against Sony libc.prx vtables 0x18C868 and 0x18CF70, confirming unsigned code-unit prefix comparison, _Strxfrm/_Wcsxfrm buffer growth and odd-byte wchar_t range handling, and FNV-1a hashing.
    • core/libs/prx/libc/src/LocaleSupport.cpp: verified std::__sce_v2::moneypunct<char, Intl> and moneypunct<wchar_t, Intl> virtual implementations (do_decimal_point, do_thousands_sep, do_grouping, do_curr_symbol, do_positive_sign, do_negative_sign, do_frac_digits, do_pos_format, do_neg_format) and SceV2MoneypunctFacet layout against vtables 0x18CB30, 0x18C9C8, 0x18D1A8, and 0x18D088.
    • core/libs/prx/libc/src/LocaleSupport.cpp: verified LP64/LLP64 portability (including the std::minstd::int64_t fix from #16944 that resolved the previous Ubuntu GCC 13.3 build failure) and confirmed all 9 guest_sce_v2_* test targets build and pass CTest on Linux x86_64 and Windows UCRT.
    • core/libs/prx/libc/CMakeLists.txt and docs/dev/debt/libc.md: verified guest_sce_v2_collate_moneypunct_tests registration, negative control failure when reverted, and technical debt documentation compliance with AGENTS.md.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912945375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-5912945375). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T21:09:25Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `225eb97633`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_sce_v2_char_facet_virtuals_tests`, `guest_sce_v2_codecvt_wide_tests`, `guest_sce_v2_collate_moneypunct_tests`, `guest_sce_v2_facet_ids_tests`, `guest_sce_v2_makeloc_tests`, `guest_sce_v2_num_get_char_tests`, `guest_sce_v2_num_get_wide_tests`, `guest_sce_v2_num_put_char_tests`, `guest_sce_v2_num_put_wide_tests` built cleanly. - **CTest** (`guest_sce_v2_makeloc`, `guest_sce_v2_char_facet_virtuals`, `guest_sce_v2_num_put_char`, `guest_sce_v2_num_put_wide`, `guest_sce_v2_codecvt_wide`, `guest_sce_v2_collate_moneypunct`, `guest_sce_v2_num_get_char`, `guest_sce_v2_num_get_wide`, `guest_sce_v2_facet_ids`): ``` 1/9 Test #846: guest_sce_v2_makeloc ............... Passed 0.02 sec 2/9 Test #847: guest_sce_v2_char_facet_virtuals ... Passed 0.03 sec 3/9 Test #848: guest_sce_v2_num_put_char .......... Passed 0.02 sec 4/9 Test #849: guest_sce_v2_num_put_wide .......... Passed 0.02 sec 5/9 Test #850: guest_sce_v2_codecvt_wide .......... Passed 0.02 sec 6/9 Test #851: guest_sce_v2_collate_moneypunct .... Passed 0.03 sec 7/9 Test #852: guest_sce_v2_num_get_char .......... Passed 0.03 sec 8/9 Test #853: guest_sce_v2_num_get_wide .......... Passed 0.03 sec 9/9 Test #1132: guest_sce_v2_facet_ids ............. Passed 0.02 sec 100% tests passed, 0 tests failed out of 9 ``` - **Negative control**: with `core/libs/prx/libc/include/Api.hpp`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libc/src/LocaleSupport.cpp: verified std::__sce_v2::collate<char> and collate<wchar_t> virtual implementations (do_compare, do_transform, do_hash) against Sony libc.prx vtables 0x18C868 and 0x18CF70, confirming unsigned code-unit prefix comparison, _Strxfrm/_Wcsxfrm buffer growth and odd-byte wchar_t range handling, and FNV-1a hashing. - core/libs/prx/libc/src/LocaleSupport.cpp: verified std::__sce_v2::moneypunct<char, Intl> and moneypunct<wchar_t, Intl> virtual implementations (do_decimal_point, do_thousands_sep, do_grouping, do_curr_symbol, do_positive_sign, do_negative_sign, do_frac_digits, do_pos_format, do_neg_format) and SceV2MoneypunctFacet layout against vtables 0x18CB30, 0x18C9C8, 0x18D1A8, and 0x18D088. - core/libs/prx/libc/src/LocaleSupport.cpp: verified LP64/LLP64 portability (including the std::min<std::int64_t> fix from #16944 that resolved the previous Ubuntu GCC 13.3 build failure) and confirmed all 9 guest_sce_v2_* test targets build and pass CTest on Linux x86_64 and Windows UCRT. - core/libs/prx/libc/CMakeLists.txt and docs/dev/debt/libc.md: verified guest_sce_v2_collate_moneypunct_tests registration, negative control failure when reverted, and technical debt documentation compliance with AGENTS.md. Looks Good To Me
MarcZX10 commented 2026-11-17 21:40:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T21:40:27Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head a8ba18cdfdea3ce9cd911872908dc4402b32ca26, base main. The diff is the whole stack against main, not only the last commit (see Findings).
  • Read description.md, commits.md, manifest.json, files.json, and all of diff.patch (13 reviewed files, no exclusions) in paged reads.
  • Read the house rules sections "Readable reviews", "Accuracy and evidence" and "Standard PR response format".
  • Repository context through the reader only:
python3 repo_read.py search g_sceV2LocimpMutex core/libs/prx/libc
python3 repo_read.py search mbrtowc_nid_postfix core/libs/prx/libc
python3 repo_read.py cat core/libs/prx/libc/src/LocaleSupport.cpp 1 30
  • No build, no test run, no merge preview (house rules: no builds for an initial review).

Results

Check Result Note
Diff read, 13 reviewed files passed Hunks read; full files not opened
Build and unit tests not run Author reports 149 libc tests passing on MinGW
Merge preview with main not run Author reports a clean merge
Lock type and wrapper signatures passed Checked with the reader
Raw reader output
a8ba18cdfdea3ce9cd911872908dc4402b32ca26:core/libs/prx/libc/src/LocaleSupport.cpp:1771:std::recursive_mutex g_sceV2LocimpMutex;
7 matching lines at a8ba18cdfdea.
a8ba18cdfdea3ce9cd911872908dc4402b32ca26:core/libs/prx/libc/include/Api.hpp:1022:std::size_t APS5_VABI mbrtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count, void* state);
11 matching lines at a8ba18cdfdea.

Findings

Blocking

None.

Non-blocking

  1. The char and wchar_t money and numpunct facets ignore parts of localeconv that the unsigned short facets copy. core/libs/prx/libc/src/LocaleSupport.cpp:1653 sets the char negative sign to g_sceV2Minus and the positive sign to empty, and :1593 sets grouping to empty. The unsigned short facets read monetary[5], monetary[6] and grouping from localeconv (:1689, :1621). The tests pin the empty currency for char (core/libs/tests/GuestSceV2Makeloc.cpp, TestConventions) but not the signs or the grouping under a non-C localeconv. Confirm against the module, or add a case. Failure scenario: a locale whose monetary negative sign is (, where moneypunct<char>::do_negative_sign returns - and the unsigned short facet returns (.

  2. Wide ctype table ownership differs from narrow. core/libs/prx/libc/src/LocaleSupport.cpp:752 frees the table for any nonzero deleteMode. The narrow destructor at :746-747 frees for > 0 and calls the array delete for < 0. GuestSceV2Makeloc.cpp sets -1 on the wide facet and expects a plain free. If the module distinguishes the two, a wide facet built with the array mode would be released with free. Not verified against the module.

  3. The diff is larger than the description says. The description states that only the last commit is this PR's change while the others merge. diff.patch against main includes the ctype, numpunct, num_put, num_get and codecvt virtuals and the facet framework (core/libs/prx/libc/src/LocaleSupport.cpp:647 onward), roughly 4,000 added lines beyond the collate and moneypunct work. A reviewer who trusts the description would review the wrong scope. Either the description or the base should change before merge.

Not verified

  • The build, the new test targets, and the author's MinGW run were not reproduced here.
  • The values in the tests (FNV-1a constants, moneypunct fields, the $+xv default pattern, facet ids and vtable slot indices) were checked for internal consistency between the tests and the code, not against libc.prx.
  • Callers of UseSceV2Facet and the per-call cost of its locking and grouping copy were not measured.
  • Full file text in files/ was not opened; every reviewed file was read through its hunks in diff.patch.

To get this to a good state

Nothing is required. The non-blocking points above are optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5947062556 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-5947062556). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T21:40:27Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `a8ba18cdfdea3ce9cd911872908dc4402b32ca26`, base `main`. The diff is the whole stack against `main`, not only the last commit (see Findings). - Read `description.md`, `commits.md`, `manifest.json`, `files.json`, and all of `diff.patch` (13 reviewed files, no exclusions) in paged reads. - Read the house rules sections "Readable reviews", "Accuracy and evidence" and "Standard PR response format". - Repository context through the reader only: ``` python3 repo_read.py search g_sceV2LocimpMutex core/libs/prx/libc python3 repo_read.py search mbrtowc_nid_postfix core/libs/prx/libc python3 repo_read.py cat core/libs/prx/libc/src/LocaleSupport.cpp 1 30 ``` - No build, no test run, no merge preview (house rules: no builds for an initial review). ## Results | Check | Result | Note | |---|---|---| | Diff read, 13 reviewed files | passed | Hunks read; full files not opened | | Build and unit tests | not run | Author reports 149 libc tests passing on MinGW | | Merge preview with `main` | not run | Author reports a clean merge | | Lock type and wrapper signatures | passed | Checked with the reader | <details> <summary>Raw reader output</summary> ``` a8ba18cdfdea3ce9cd911872908dc4402b32ca26:core/libs/prx/libc/src/LocaleSupport.cpp:1771:std::recursive_mutex g_sceV2LocimpMutex; 7 matching lines at a8ba18cdfdea. a8ba18cdfdea3ce9cd911872908dc4402b32ca26:core/libs/prx/libc/include/Api.hpp:1022:std::size_t APS5_VABI mbrtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count, void* state); 11 matching lines at a8ba18cdfdea. ``` </details> ## Findings ### Blocking None. ### Non-blocking 1. **The char and wchar_t money and numpunct facets ignore parts of localeconv that the unsigned short facets copy.** `core/libs/prx/libc/src/LocaleSupport.cpp:1653` sets the `char` negative sign to `g_sceV2Minus` and the positive sign to empty, and `:1593` sets grouping to empty. The unsigned short facets read `monetary[5]`, `monetary[6]` and `grouping` from localeconv (`:1689`, `:1621`). The tests pin the empty currency for `char` (`core/libs/tests/GuestSceV2Makeloc.cpp`, `TestConventions`) but not the signs or the grouping under a non-C localeconv. Confirm against the module, or add a case. Failure scenario: a locale whose `monetary` negative sign is `(`, where `moneypunct<char>::do_negative_sign` returns `-` and the unsigned short facet returns `(`. 2. **Wide ctype table ownership differs from narrow.** `core/libs/prx/libc/src/LocaleSupport.cpp:752` frees the table for any nonzero `deleteMode`. The narrow destructor at `:746-747` frees for `> 0` and calls the array delete for `< 0`. `GuestSceV2Makeloc.cpp` sets `-1` on the wide facet and expects a plain free. If the module distinguishes the two, a wide facet built with the array mode would be released with `free`. Not verified against the module. 3. **The diff is larger than the description says.** The description states that only the last commit is this PR's change while the others merge. `diff.patch` against `main` includes the ctype, numpunct, num_put, num_get and codecvt virtuals and the facet framework (`core/libs/prx/libc/src/LocaleSupport.cpp:647` onward), roughly 4,000 added lines beyond the collate and moneypunct work. A reviewer who trusts the description would review the wrong scope. Either the description or the base should change before merge. ## Not verified - The build, the new test targets, and the author's MinGW run were not reproduced here. - The values in the tests (FNV-1a constants, moneypunct fields, the `$+xv` default pattern, facet ids and vtable slot indices) were checked for internal consistency between the tests and the code, not against `libc.prx`. - Callers of `UseSceV2Facet` and the per-call cost of its locking and grouping copy were not measured. - Full file text in `files/` was not opened; every reviewed file was read through its hunks in `diff.patch`. ## To get this to a good state Nothing is required. The non-blocking points above are optional.
MarcZX10 commented 2026-11-20 12:21:20 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head c3dfec0334f9bb794ecd816826f8acfd1015eddd. I read the prepared description, commit list, diff, manifest, and the changed implementation ranges for the collate and moneypunct virtuals. I did not run commands or tests; the description reports Windows 11/MinGW GCC 15.2 tests and a clean merge with main.

Results

Check Result Note
Diff and targeted code review passed Inspected target virtuals and registration
Automated checks not run Author reports passing checks
Full changed-file coverage not run Several changed files were not read

Findings

Blocking

None identified in the inspected implementation.

Non-blocking

None.

Not verified

I read the changed ranges in core/libs/prx/libc/src/LocaleSupport.cpp that implement the target virtuals, plus the description, commits, manifest, and diff. I did not read every changed file listed in the manifest, including the complete test files, and did not run tests or independently verify the reported behavior. The review bundle’s file manifest indicates 11 changed files; complete changed-file coverage was not established.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5992561424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-5992561424). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T12:21:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `c3dfec0334f9bb794ecd816826f8acfd1015eddd`. I read the prepared description, commit list, diff, manifest, and the changed implementation ranges for the `collate` and `moneypunct` virtuals. I did not run commands or tests; the description reports Windows 11/MinGW GCC 15.2 tests and a clean merge with `main`. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted code review | passed | Inspected target virtuals and registration | | Automated checks | not run | Author reports passing checks | | Full changed-file coverage | not run | Several changed files were not read | ## Findings ### Blocking None identified in the inspected implementation. ### Non-blocking None. ## Not verified I read the changed ranges in `core/libs/prx/libc/src/LocaleSupport.cpp` that implement the target virtuals, plus the description, commits, manifest, and diff. I did not read every changed file listed in the manifest, including the complete test files, and did not run tests or independently verify the reported behavior. The review bundle’s file manifest indicates 11 changed files; complete changed-file coverage was not established. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 07:18:02 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 8b870d3f838d4765325df1807e178a16b96afd0c from the prepared patch and pinned repository reader. No tests or build commands were run.

Results

Check Result Note
Patch and changed code review passed Targeted implementation and registration inspected
Tests and build not run Author reports Windows test results

Findings

Blocking

None found in the inspected code.

Non-blocking

  • SceV2CollationLength divides the byte distance by sizeof(Text) before comparing. That matches the stated behavior for valid ranges; malformed ranges with last < first are not guarded, and their behavior was not established by the review.

Not verified

No programmatic checks were run. I read all files marked included in the manifest: core/libs/prx/libc/CMakeLists.txt, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp, the seven added core/libs/tests/GuestSceV2*.cpp files, and docs/dev/debt/libc.md. No changed files were excluded. The reported Windows build, tests, differential harness, negative control, merge check, and console behavior were not independently verified.

To get this to a good state

Nothing is required. The author-reported checks provide useful supporting evidence; no additional action is required for this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6003761865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-6003761865). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T07:18:02Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `8b870d3f838d4765325df1807e178a16b96afd0c` from the prepared patch and pinned repository reader. No tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Patch and changed code review | passed | Targeted implementation and registration inspected | | Tests and build | not run | Author reports Windows test results | ## Findings ### Blocking None found in the inspected code. ### Non-blocking - `SceV2CollationLength` divides the byte distance by `sizeof(Text)` before comparing. That matches the stated behavior for valid ranges; malformed ranges with `last < first` are not guarded, and their behavior was not established by the review. ## Not verified No programmatic checks were run. I read all files marked included in the manifest: `core/libs/prx/libc/CMakeLists.txt`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, the seven added `core/libs/tests/GuestSceV2*.cpp` files, and `docs/dev/debt/libc.md`. No changed files were excluded. The reported Windows build, tests, differential harness, negative control, merge check, and console behavior were not independently verified. ## To get this to a good state Nothing is required. The author-reported checks provide useful supporting evidence; no additional action is required for this review.
ligmaSec commented 2026-12-03 13:12:36 +00:00 (Migrated from github.com)

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

Review: COMMENTED


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

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6170471143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17277#pullrequestreview-6170471143). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T13:12:36Z. **Review:** COMMENTED --- Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused `GuestSceV2CollateMoneypunct` 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/17277:upstream-pr/17277'
git switch 'upstream-pr/17277'

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