feat(libSceIcu): implement ten Unicode script-property exports #16507

Closed
hyvvs wants to merge 6 commits from upstream-pr/16507 into main
hyvvs commented 2026-11-06 23:13:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-06T23:13:07Z.


What

Replace ten throwing libSceIcu script-property exports with real guest-callable SysV wrappers around pinned ICU 78.1 source (Unicode 17): uscript_getScript, uscript_getShortName, uscript_hasScript, uscript_getName, uscript_getScriptExtensions, uscript_getSampleString, uscript_getUsage, uscript_isRightToLeft, uscript_breaksBetweenLetters and uscript_isCased.

Source: ICU 78.1 uchar.cpp, propname.cpp, uscript_props.cpp, public uscript.h. The wrapper forwards Unicode-property queries without synthetic tables. Script-name pointers are borrowed from native static storage; callers own sample buffers and script-extension arrays. An at-most-256-element temporary enum array avoids incompatible C++ enum pointer aliasing; error/preflight/overflow status is preserved. UBool is a one-byte return by guest ABI. A null UErrorCode returns a safe sentinel rather than allowing upstream's fault, documented in technical debt.

This is an independent script-only follow-up to #13578. Its identical ICU submodule gitlink 049e0d6a4206 and icu_common bootstrap are included so this standalone PR can be built against main; coordinate merging #13578 before landing this PR, then keep one copy of the shared infrastructure. No ucnv_*, ubrk_* or uloc_* exports are touched.

Open-PR overlap audit: python tools/pr_overlap.py --branch feat/worker16-icu-normalization was run against all 1,839 open PRs. It exits 2 (fail closed) because of shared ICU inventory files and broad .gitmodules edits. I independently inspected exact open heads #14144 (f4e37256), #14340 (40f5f737) and #14443 (d61bf05d): all seven flagged overlapping uscript_* entries are still unconditional NotImplemented_nid_no_patch stubs, not competing implementations. #13578 supplies the shared build infrastructure, and #16490 overlaps only technical-debt text. These source-level merge conflicts need coordinated integration despite zero duplicate functional uscript_* implementations.

Version/firmware limitation: The PS5 3.20 NID inventory and guest-side ICU 68 names do not prove that retail firmware uses ICU 78.1 tables. Script IDs introduced after ICU 68 can differ. The 10 signatures follow the matching public ICU C ABI, but neither console execution nor exact console Unicode/ICU version was measured. This is explicitly debt, not a claim of exact native PS5 Unicode results. NFKC normalization remains unimplemented: pinned ICU common alone reports data-file error 4 without the normalization package.

Tested

  • Windows 11, MinGW GCC 15.2, real repository CMake Release -DBUILD_TESTING=ON: built libSceIcu.prx and independently linked guest_icu_script_tests.exe; ctest --test-dir build-worker16/windows-release -R '^guest_icu_script$' -C Release --output-on-failure: 1/1 passed.
  • Windows MinGW focused standalone shared-library Release and separate guest executable: CTest 1/1 passed.
  • WSL Ubuntu GCC 13.3, -O1 -g -DNDEBUG -fsanitize=address,undefined -fno-omit-frame-pointer, ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 UBSAN_OPTIONS=halt_on_error=1: focused shared-library guest CTest 1/1 passed.
  • Direct pinned ICU 78.1 differential: 218 script codes (-2..215), ~30,000 sampled Unicode code points, script-extension arrays, names, sample outputs, properties, and invalid/preflight/error cases agree with the native C APIs.
  • python tools/check_conventions.py --base HEAD^ passes, git diff HEAD^ HEAD --check passes.
  • PS5 console: not tested. GPU paths not changed.

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: #13578
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5196052364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16507). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-11-06T23:13:07Z. --- ### What Replace ten throwing `libSceIcu` script-property exports with real guest-callable SysV wrappers around pinned ICU 78.1 source (Unicode 17): `uscript_getScript`, `uscript_getShortName`, `uscript_hasScript`, `uscript_getName`, `uscript_getScriptExtensions`, `uscript_getSampleString`, `uscript_getUsage`, `uscript_isRightToLeft`, `uscript_breaksBetweenLetters` and `uscript_isCased`. Source: [ICU 78.1 `uchar.cpp`](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uchar.cpp), [`propname.cpp`](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/propname.cpp), [`uscript_props.cpp`](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uscript_props.cpp), [public `uscript.h`](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/unicode/uscript.h). The wrapper forwards Unicode-property queries without synthetic tables. Script-name pointers are borrowed from native static storage; callers own sample buffers and script-extension arrays. An at-most-256-element temporary enum array avoids incompatible C++ enum pointer aliasing; error/preflight/overflow status is preserved. `UBool` is a one-byte return by guest ABI. A null UErrorCode returns a safe sentinel rather than allowing upstream's fault, documented in technical debt. This is an **independent script-only follow-up to #13578**. Its identical ICU submodule gitlink `049e0d6a4206` and `icu_common` bootstrap are included so this standalone PR can be built against main; coordinate merging #13578 before landing this PR, then keep one copy of the shared infrastructure. No `ucnv_*`, `ubrk_*` or `uloc_*` exports are touched. **Open-PR overlap audit:** `python tools/pr_overlap.py --branch feat/worker16-icu-normalization` was run against all 1,839 open PRs. It exits 2 (fail closed) because of shared ICU inventory files and broad `.gitmodules` edits. I independently inspected exact open heads #14144 (`f4e37256`), #14340 (`40f5f737`) and #14443 (`d61bf05d`): **all seven flagged overlapping `uscript_*` entries are still unconditional `NotImplemented_nid_no_patch` stubs, not competing implementations**. #13578 supplies the shared build infrastructure, and #16490 overlaps only technical-debt text. These source-level merge conflicts need coordinated integration despite **zero duplicate functional `uscript_*` implementations**. **Version/firmware limitation:** The PS5 3.20 NID inventory and guest-side ICU 68 names do not prove that retail firmware uses ICU 78.1 tables. Script IDs introduced after ICU 68 can differ. The 10 signatures follow the matching public ICU C ABI, but neither console execution nor exact console Unicode/ICU version was measured. This is explicitly debt, not a claim of exact native PS5 Unicode results. NFKC normalization remains unimplemented: pinned ICU common alone reports data-file error 4 without the normalization package. ### Tested - Windows 11, MinGW GCC 15.2, **real repository CMake Release** `-DBUILD_TESTING=ON`: built `libSceIcu.prx` and independently linked `guest_icu_script_tests.exe`; `ctest --test-dir build-worker16/windows-release -R '^guest_icu_script$' -C Release --output-on-failure`: **1/1 passed**. - Windows MinGW focused standalone shared-library Release and separate guest executable: CTest **1/1 passed**. - WSL Ubuntu GCC 13.3, `-O1 -g -DNDEBUG -fsanitize=address,undefined -fno-omit-frame-pointer`, `ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 UBSAN_OPTIONS=halt_on_error=1`: focused shared-library guest CTest **1/1 passed**. - Direct pinned ICU 78.1 differential: 218 script codes (-2..215), ~30,000 sampled Unicode code points, script-extension arrays, names, sample outputs, properties, and invalid/preflight/error cases agree with the native C APIs. - `python tools/check_conventions.py --base HEAD^` **passes**, `git diff HEAD^ HEAD --check` **passes**. - PS5 console: **not tested**. GPU paths not changed. ### Checklist - [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: #13578 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes

Pull request closed

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!16507
No description provided.