feat(libSceIcu): implement the invariant character and version helpers #11013
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11013"
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 mantavisual on 2026-10-25T14:11:55Z.
What
Implements five
libSceIcuexports from the PS5 3.20 export table:u_charsToUChars,u_UCharsToChars,u_versionFromString,u_versionFromUStringandu_versionToString. None of them needs Unicode data, and their bodies are the same in every ICU release from 65.1 to 78.1.Firmware 13.42's
libSceIcu.sprxreports ICU 78.1 and exports none of these five (measured by BunnyFl). The PS5 3.20 export table exports all five, and its markers point to ICU 65–68 for that firmware: it hasuloc_openAvailableByType(ICU 65) and lacksubrk_clone(69),u_stringHasBinaryProperty(70) anducnv_clone(71). The code follows ICU 78.1's uinvchar.cpp and putil.cpp. I compared the five bodies in 65.1, 66.1, 67.1, 68.1, 68.2, 72.1 and 78.1; they differ only inNULL/nullptr,UChar/char16_tandFALSE/false, so the code is the same for either firmware. ICU 64'su_UCharsToCharsdiffers, but neither firmware uses 64.u_charsToUCharswidens each byte without sign extension.u_UCharsToCharskeeps the ICU invariant set (ASCII except LF,!#$@[\]^and`{|}~) and writes NUL for every other code unit.u_versionFromStringreads up to four.-separated parts withstrtoul(the guest libc'sstrtoul_nid_postfix, base 10) and truncates each to eight bits. Parsing stops at an empty part or another character, and missing parts become 0. A null string clears the version, and a null version does nothing.u_versionFromUStringreads at most 20 code units, narrows them asu_UCharsToCharsdoes, and parses the result. A null string or version leaves the version unchanged.u_versionToStringwrites at least two parts and omits trailing zero parts. It keeps ICU's digit writer, which drops a zero tens digit after a hundreds digit: 105 becomes15and 100 becomes10. A null version writes an empty string, and a null buffer does nothing.A null buffer with a positive length in either conversion throws
APS5_INVALID_ARG_EX, since ICU dereferences it. The newdocs/dev/debt/libSceIcu.mdentry records that none of this is checked on a console, and the 13.42 version and exports (second commit,37d5137ea0).The layout follows #10961–#10967 (a
CMakeLists.txtfor the library, one header per source included fromlibSceIcu.hpp). Those PRs implement other ICU functions and none of these five, but each addsCMakeLists.txt,libSceIcu.hppand the debt file, so whichever merges second needs a small rebase.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmaine05ba6feeb.guest_icu_version:u_versionFromStringcovers four or five parts, empty and digitless strings, stops atxand.., trailing., leading spaces,+5.-1→ 5.255,256.300.511→ 0.44.255, overflow → 255, and null arguments.u_versionFromUStringcovers variant, non-ASCII and fullwidth characters, the 20-unit limit (20 units read, the 21st ignored), and null arguments.u_versionToStringcovers trailing and inner zeros,0.0,7.0,100.105.109.110→10.15.19.110, a null version and a null buffer; it never writes past the NUL. A round trip covers every part value the digit writer preserves.ctest -R "guest_icu_version|patched_libraries": both pass. The NID-patchedlibSceIcu.prxbuilds, and its export table has the five NIDs.tools/progress.py --module libSceIcu: 5 implemented, 0 stubs.tools/check_test_registration.py build: 1341 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR implements or names these five functions (checked 2026-10-25, including the diffs of #10961–#10967).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 MarcZX10 on 2026-10-25T14:14:36Z.
Review: APPROVED
Reviewed the implementations against ICU 68.2. The invariant character table matches ICU’s bit masks; the conversion loops preserve the full unsigned byte range, replace variant UTF-16 units with NUL, and respect nonpositive lengths. The version parser follows ICU’s
strtoul/delimiter/part-count logic, including null handling and zero-fill, while the formatter preserves ICU’s two-field minimum and digit-writer behavior. I checked the new tests and ran C++20 syntax checks on all three changed translation units; conventions and diff checks pass. The author reports the exhaustive 65,536-code-unit test and focused Windows test pass. Console behavior remains unverified as documented.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:22:06Z.
Review: CHANGES_REQUESTED
The function review remains positive, but this head has an unresolved repository merge-order item. Its new
CMakeLists.txt, umbrella header and debt file overlap #10961–#10967. AZLisme has proposed that #11013 merge first, followed by their disjoint-function series, and provided local combined-build/test evidence; I do not see an acceptance from this PR’s author yet. Please confirm or propose another order in the thread, and record any requiredDepends onentry. This follows CONTRIBUTING.md’s requirement to agree on order for overlapping PRs. No code correction is requested.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T17:27:07Z.
Review: APPROVED
I rechecked the merge-order thread: mantavisual agreed to merge this PR first and to keep
Depends on: none, and AZLisme recorded the follow-up sequence starting at #10961. The prior blocker is resolved. The implementation and test review remains positive; the reported focused Windows run and the independent combined Linux ICU test report cover the added helpers. Current exact-head eligibility, conventions, intake, labels and report checks pass; platform product jobs are skipped by path policy. Approved.