feat(icu): implement converter name and signature helpers #12738

Merged
atharvjairath merged 1 commit from upstream-pr/12738 into main 2026-11-08 06:42:26 +00:00
atharvjairath commented 2026-10-29 06:19:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by atharvjairath on 2026-10-29T06:19:21Z.


What

Implement four missing ICU converter helpers:

  • ucnv_compareNames: ASCII converter/alias comparison with ICU's case, punctuation and numeric-run rules.
  • ucnv_io_stripASCIIForCompare and ucnv_io_stripEBCDICForCompare: matching normalization, including in-place output and EBCDIC output bytes.
  • ucnv_detectUnicodeSignature: bounded or NUL-terminated signature detection, including UTF-16/UTF-32 precedence, UTF-7 variants and ICU status/output preservation.

Names and generated NIDs match the pinned PS5 3.20 inventory. Behavior follows ICU 78.1 commit 049e0d6a420629ac7db77256987d083a563287b5, ucnv_io.cpp and ucnv.cpp. Required null normalization pointers throw; the undefined upstream memory access is not reproduced. Console ABI/behavior and cross-firmware availability remain unverified and are recorded in the existing debt file. No new runtime dependency is added.

On exact base 2960e9a6e7e1fc99c4ed180c71495b5eb83464c7, the unchanged progress scanner reports four additional implemented names: ICU 11/120 → 15/124 (9.17% → 12.10%), project 6679/14548 → 6683/14552 (45.91% → 45.92%). These four names were absent, so the denominator increases too; all 107 literal-NID stubs and existing unsupported paths remain. Scanner counts are not a complete firmware API inventory (for example, they include the existing ByteAt callback).

The exact overlap CLI inspected 1420 open PRs against this base. Its 15 reported peers share CMake, umbrella-header or debt insertion sites; none implements these four exports. Current heads and complete shared patches were reviewed, including the six base-conflicted numeric/error/field-position/set/enumeration/iterator branches. No open prerequisite or peer code is imported; later merges must retain both sets of source/header/test/debt additions.

Tested

Exact committed head 26780f3701db3f8f336216d2b6d00c580835ad76, based on 2960e9a6e7e1fc99c4ed180c71495b5eb83464c7:

  • Release Linux GCC 13.3, x86-64 runtime through native ARM QEMU 11.0.3: 4/4 ICU tests pass (0.26 s). Complete real libc and ICU rebuilt in a focused external CMake harness using the repository module/test registrations.
  • Release Windows PE, WinLibs GCC 15.2 UCRT, Wine 9 through the same QEMU: complete real libc/ICU rebuilt; 3/4 tests pass (40.59 s total). The new guest_icu_converter_helpers passes (3.33 s), as do version and unescape. Existing guest_icu_cstring aborts at parser preserves LP64 strtoul results before narrowing, then times out. A separately rebuilt, complete exact-base ICU DLL excluding this change reproduces the same assertion with the same libc and unchanged test executable; Wine loader tracing confirms the control DLL path. This failure remains visible; no assertion, gate or runtime workaround was changed.
  • Independently built upstream ICU 78.1 common library at the pinned commit (stub data; these helpers need no Unicode data): 5,824,042 differential checks, zero mismatches. Includes all pairs of non-NUL name bytes, deterministic random names and signature buffers, every signature byte mutation/truncation, in-place/canary checks, error/warning preservation, optional outputs, NUL input and explicit buffers ending at a protected page.
  • Six external mutation controls fail the unchanged new fixture as expected: leading-zero retention, digit-state leakage across punctuation, wrong EBCDIC fold, reversed comparison, UTF-16 overriding UTF-32, and ignoring a preexisting error.
  • Post-commit conventions and diff checks pass. Public-header audit: 373 libraries / 13418 exports, unique declarations and umbrella coverage verified. Twice-included standalone C++20 umbrella compiles with -Wall -Wextra -Werror. All four focused test registrations and emulator commands verified. Exact python3 tools/pr_overlap.py --branch feat/icu-converter-helpers passes; shared-file review completed.

No native Windows, PS5, title, packaged-product or whole-project runtime validation is claimed. The focused harness disables libc's standalone test registrations; it builds the real library but does not constitute a whole-project test-registration audit. Full maintainer CI is still required.

Representative reproduction:

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
cmake --build build --target guest_icu_converter_helpers_tests
ctest --test-dir build -R '^guest_icu_converter_helpers$' --output-on-failure

The commands above are the repository test target; local platform results used the focused harness described above. Full recipes, source/binary hashes, oracle, mutation and failure/control logs are retained in /private/tmp/anyps5-icu-converter-20261029.

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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5063332450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12738). Originally posted by [atharvjairath](https://github.com/atharvjairath) on 2026-10-29T06:19:21Z. --- ### What Implement four missing ICU converter helpers: - `ucnv_compareNames`: ASCII converter/alias comparison with ICU's case, punctuation and numeric-run rules. - `ucnv_io_stripASCIIForCompare` and `ucnv_io_stripEBCDICForCompare`: matching normalization, including in-place output and EBCDIC output bytes. - `ucnv_detectUnicodeSignature`: bounded or NUL-terminated signature detection, including UTF-16/UTF-32 precedence, UTF-7 variants and ICU status/output preservation. Names and generated NIDs match the pinned [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c). Behavior follows ICU 78.1 commit `049e0d6a420629ac7db77256987d083a563287b5`, [ucnv_io.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ucnv_io.cpp) and [ucnv.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ucnv.cpp). Required null normalization pointers throw; the undefined upstream memory access is not reproduced. Console ABI/behavior and cross-firmware availability remain unverified and are recorded in the existing debt file. No new runtime dependency is added. On exact base `2960e9a6e7e1fc99c4ed180c71495b5eb83464c7`, the unchanged progress scanner reports four additional implemented names: ICU **11/120 → 15/124 (9.17% → 12.10%)**, project **6679/14548 → 6683/14552 (45.91% → 45.92%)**. These four names were absent, so the denominator increases too; all 107 literal-NID stubs and existing unsupported paths remain. Scanner counts are not a complete firmware API inventory (for example, they include the existing `ByteAt` callback). The exact overlap CLI inspected 1420 open PRs against this base. Its 15 reported peers share CMake, umbrella-header or debt insertion sites; none implements these four exports. Current heads and complete shared patches were reviewed, including the six base-conflicted numeric/error/field-position/set/enumeration/iterator branches. No open prerequisite or peer code is imported; later merges must retain both sets of source/header/test/debt additions. ### Tested Exact committed head `26780f3701db3f8f336216d2b6d00c580835ad76`, based on `2960e9a6e7e1fc99c4ed180c71495b5eb83464c7`: - Release Linux GCC 13.3, x86-64 runtime through native ARM QEMU 11.0.3: **4/4 ICU tests pass (0.26 s)**. Complete real libc and ICU rebuilt in a focused external CMake harness using the repository module/test registrations. - Release Windows PE, WinLibs GCC 15.2 UCRT, Wine 9 through the same QEMU: complete real libc/ICU rebuilt; **3/4 tests pass (40.59 s total)**. The new `guest_icu_converter_helpers` passes (3.33 s), as do version and unescape. Existing `guest_icu_cstring` aborts at `parser preserves LP64 strtoul results before narrowing`, then times out. A separately rebuilt, complete **exact-base ICU DLL excluding this change** reproduces the same assertion with the same libc and unchanged test executable; Wine loader tracing confirms the control DLL path. This failure remains visible; no assertion, gate or runtime workaround was changed. - Independently built upstream ICU 78.1 common library at the pinned commit (stub data; these helpers need no Unicode data): **5,824,042 differential checks, zero mismatches**. Includes all pairs of non-NUL name bytes, deterministic random names and signature buffers, every signature byte mutation/truncation, in-place/canary checks, error/warning preservation, optional outputs, NUL input and explicit buffers ending at a protected page. - Six external mutation controls fail the unchanged new fixture as expected: leading-zero retention, digit-state leakage across punctuation, wrong EBCDIC fold, reversed comparison, UTF-16 overriding UTF-32, and ignoring a preexisting error. - Post-commit conventions and diff checks pass. Public-header audit: **373 libraries / 13418 exports**, unique declarations and umbrella coverage verified. Twice-included standalone C++20 umbrella compiles with `-Wall -Wextra -Werror`. All four focused test registrations and emulator commands verified. Exact `python3 tools/pr_overlap.py --branch feat/icu-converter-helpers` passes; shared-file review completed. No native Windows, PS5, title, packaged-product or whole-project runtime validation is claimed. The focused harness disables libc's standalone test registrations; it builds the real library but does not constitute a whole-project test-registration audit. Full maintainer CI is still required. Representative reproduction: ```sh cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON cmake --build build --target guest_icu_converter_helpers_tests ctest --test-dir build -R '^guest_icu_converter_helpers$' --output-on-failure ``` The commands above are the repository test target; local platform results used the focused harness described above. Full recipes, source/binary hashes, oracle, mutation and failure/control logs are retained in `/private/tmp/anyps5-icu-converter-20261029`. <!-- 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. --> ### 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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
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!12738
No description provided.