feat(libc): implement the std::__sce_v2 messages virtuals #17296
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17296"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-08T17:27:13Z.
What
Builds on #17277: this branch contains its commits, and through them #16975, #16949, #16944, #16924, #16919, #16560, #16516, #16214, #16178 and #15923, with current
main. It needs none of their code, only their place inLocaleSupport.cpp, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change.Implement the three virtuals of
std::__sce_v2::messages<char>andmessages<wchar_t>, which_Makelocbuilds anduse_facethands to callers that look up translated strings. Before this PR, each of their six slots threwNotImplemented_nid_no_patch. These slots are not exports, so this PR adds no NID.The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6), vtables0x18C8C8and0x18CFD0:do_openreturns -1: the module has no message catalogs.do_getreturns a copy of the default string, built as the module's copy constructor builds it. A default of at most 15charor 7wchar_tunits is copied with the whole 16-byte buffer it is read from; a longer one gets a capacity from its length,length | 15orlength | 7, and its units are copied with the one after them. The source buffer is chosen by the default's capacity, as the module does.do_closedoes nothing.The
_Makelocdebt entry listsmessagesamong the working facets.Tested
Windows 11, MinGW GCC 15.2, Release, head on top of #17277. Not run on Linux or macOS, not run in a title.
guest_sce_v2_messages:do_open,do_close, anddo_getwith short, long and short-on-heap defaults for both character types, checking sizes, capacities, the copied inline buffer and the unit after a long default._Makeloc. Defaults of 0 to 4,400 units, inline or on the heap, with random bytes after the length and capacities that do not match the length. It compares the result, the returned string's size, capacity, inline buffer or heap contents, and the allocations each side makes: 900,000 calls over 3 seeds (about 396,000 heap defaults and 303,000 allocated results), 0 differences.guest_sce_v2_*, locale, string andpublic_headerstest): all pass.check_conventions,git diff --check: clean. Merges cleanly withmain.pr_overlapreports no open PR with the same functions or conflicting code; it could not compare 45 PRs that conflict withmainon shared files, and of the 4 that touchLocaleSupport.cpp(#9526, #11172, #12518, #12704) none adds these virtuals.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-08T18:33:02Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
4860ac9cf3:tools/check_conventions.pypassed;git diff --checkclean.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_messages_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_testsfailed to build.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T22:02:53Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
49b19761b0:tools/check_conventions.pypassed;git diff --checkclean.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_messages_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_testsfailed to build.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:09:09Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
faf01748c3:tools/check_conventions.pypassed;git diff --checkclean.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_messages_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_testsbuilt cleanly.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_messages,guest_sce_v2_num_get_char,guest_sce_v2_num_get_wide,guest_sce_v2_facet_ids):core/libs/prx/libc/include/Api.hpp,core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/src/LocaleSupport.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.std::min(const int64_t&, long long int)) incore/libs/prx/libc/src/LocaleSupport.cpphas been resolved and all 10guest_sce_v2_*test targets build and pass on Linux x86_64.std::__sce_v2::messages<char>andmessages<wchar_t>virtual functions (do_open,do_get,do_close) incore/libs/prx/libc/src/LocaleSupport.cppfor SSO threshold logic (15char/ 7wchar_t), dynamic capacity calculation (length | 15/length | 7), and null-terminator copying.guest_sce_v2_messages_testsincore/libs/prx/libc/CMakeLists.txtandGuestSceV2Messages.cppexercisesdo_open,do_get(both SSO and heap-allocated strings), anddo_closefor narrow and widemessagesfacets, and fails when the implementation is reverted.tools/check_conventions.pypassed,git diff --checkclean, and technical debt updated indocs/dev/debt/libc.md).SceV2locale changes and test targets.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T21:35:46Z.
Review: COMMENTED
Reviewed messages facets — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
bf56220c779453962d012f8191192f654831cd01, basemain. The change is the stacked branch as shown indiff.patch; the messages virtuals are the last commit of this PR.commits.md,manifest.json,files.jsonanddiff.patch. Read the messages virtuals and their registration incore/libs/prx/libc/src/LocaleSupport.cpp, the messages testcore/libs/tests/GuestSceV2Messages.cpp, the messages block ofcore/libs/prx/libc/CMakeLists.txt, and the_Makelocentries ofdocs/dev/debt/libc.md.repo_read.py:Results
_Makelocdebt entryFindings
Blocking
None.
Non-blocking
core/libs/tests/GuestSceV2Messages.cpp:90—long_comes fromdo_getwith a 40-unit default, so its buffer is allocated throughAllocateStringStorageand never freed.core/libs/tests/GuestSceV2Messages.cpp:95(copiedEnd) leaks the same way. The process exits right after, so this does not affect the result, but the test allocates two heap strings it never releases.Not verified
do_getcopy rule, the0x20messages category, the vtable addresses and the SHA-256 oflibc.prx. I have no access to the module binary here.core/libs/prx/libc/src/LocaleSupport.cpp(num_put, num_get, codecvt, collate, moneypunct, money_get/put and time_get/put implementations and their registration), and the hunks ofcore/libs/prx/libc/include/GuestLocale.hppbeyond theSceV2IosBasechange.core/libs/tests/GuestSceV2CharFacetVirtuals.cpp,GuestSceV2CodecvtWide.cpp,GuestSceV2CollateMoneypunct.cpp,GuestSceV2Makeloc.cpp,GuestSceV2NumGetChar.cpp,GuestSceV2NumGetWide.cpp,GuestSceV2NumPutChar.cpp,GuestSceV2NumPutWide.cpp, andcore/libs/prx/libc/include/Api.hppbeyond its added declarations.core/libs/prx/libc/CMakeLists.txt(new line 502) does not listGuestSceV2Exceptions.S, which the_Makeloctest target does. I did not check whether this test needs it._Facet_Registerchange (LocaleSupport.cpp, around the_Facet_Registerdefinition) now prepends a node, and the matching debt sentence was removed. I saw the change in the diff but did not read the surrounding code.To get this to a good state
Nothing is required. The non-blocking point above is optional.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T11:39:25Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a38d4007e8:tools/check_conventions.pypassed.guest_sce_v2_char_facet_virtuals_tests,guest_sce_v2_codecvt_wide_tests,guest_sce_v2_collate_moneypunct_tests,guest_sce_v2_messages_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_testsbuilt cleanly.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_messages,guest_sce_v2_num_get_char,guest_sce_v2_num_get_wide):core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/src/LocaleSupport.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:48:23Z.
Review: COMMENTED
Reviewed — comments
The messages facet implementation appears consistent with the described behavior, but the full change is not verified because several changed files were not reviewed.
What I ran
Reviewed head
a38d4007e813743a7cc8a0d221370f7536cc52fausing the pinnedrepo_read.pyreader. I read the prepared description, commit list, diff, manifest, and review-folder README; I did not run tests or other commands.Results
Findings
Blocking
None verified in the inspected messages implementation.
Non-blocking
None.
Not verified
The reviewed material included
core/libs/prx/libc/CMakeLists.txt,core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/src/LocaleSupport.cpp,core/libs/tests/GuestSceV2Messages.cpp, anddocs/dev/debt/libc.md(the relevant implementation and test ranges, plus the prepared diff). The changed filescore/libs/tests/GuestSceV2CharFacetVirtuals.cpp,core/libs/tests/GuestSceV2CodecvtWide.cpp,core/libs/tests/GuestSceV2CollateMoneypunct.cpp,core/libs/tests/GuestSceV2NumGetChar.cpp,core/libs/tests/GuestSceV2NumGetWide.cpp,core/libs/tests/GuestSceV2NumPutChar.cpp, andcore/libs/tests/GuestSceV2NumPutWide.cppwere not read. Their behavior and tests are not verified. No tests were run in this review; platform and in-title behavior were not confirmed.To get this to a good state
Nothing is required for the inspected messages implementation. The unreviewed changed files need review before a formal approval is justified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:16:21Z.
Review: COMMENTED
Reviewed — no blocking findings
The messages virtuals match the stated behavior in the inspected source; one test fixture may read beyond its backing string allocation.
What I ran
Inspected the prepared diff and source at head
07fda02256d1f751de8687e835649e9cc3740df6; no build or tests were run.Results
Findings
Blocking
None.
Non-blocking
core/libs/tests/GuestSceV2Messages.cpp:98-104: the short-on-heap fixture points at astd::basic_stringwith only two characters but claims capacity 31. The implementation copies the full inline buffer for a short default, so this fixture can read beyond the string's allocated storage. Back it with a buffer sized to the claimed capacity before testing this case.Not verified
Read
review/description.md,review/commits.md,review/manifest.json,review/diff.patch, the completeGuestSceV2Messages.cpp, and the messages implementation inLocaleSupport.cpp. Did not read the other changed files, including the broader locale facet additions and tests; those changes are not reviewed here. Did not verify author-reported test results or run a negative control.To get this to a good state
Nothing is required. The test-fixture point above is optional.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:12:35Z.
Review: COMMENTED
Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused
GuestSceV2Messagesfixture passed.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.