feat(libSceIcu): implement converter stop and skip callbacks #12692

Merged
Ninot1Quyi merged 3 commits from upstream-pr/12692 into main 2026-10-30 01:52:25 +00:00
Ninot1Quyi commented 2026-10-29 02:34:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ninot1Quyi on 2026-10-29T02:34:51Z.


What

Replace four throwing inventory stubs with typed implementations of UCNV_FROM_U_CALLBACK_STOP, UCNV_FROM_U_CALLBACK_SKIP, UCNV_TO_U_CALLBACK_STOP, and UCNV_TO_U_CALLBACK_SKIP.

STOP preserves the caller's error except for FROM_U's unassigned default-ignorable case. SKIP implements null-context and "i" policies, including default-ignorable precedence, and leaves lifecycle notifications untouched. Converter argument layouts remain opaque because these callbacks do not access them. Headers expose each export once; add a focused runtime fixture and update the remaining-stub debt count from 107 to 103.

Signatures and behavior follow ICU 78.1 ucnv_err.h and ucnv_err.cpp. Names/NIDs are in the pinned PS5 3.20 inventory. This is an independent implementation; no ICU source is vendored or linked.

The debt entry records absent console verification, the ICU 65.1/78.1 difference at U+180F, and guards for undefined upstream inputs. Unaccessed pointers remain unread. Converter execution and other callbacks remain unimplemented.

Overlap: the repository checker scanned all 1,410 open PRs, followed by manual inspection of all 16 ICU candidates. None implements these four functions/NIDs. Mechanical conflicts remain with #10967 (test registration), #12320/#12629/#12630 (debt inventory/count), and #12451 (adjacent debt entry). Preserve both registrations/entries and recount remaining stubs when combining them. #11088/#11115/#11118/#11122/#11132/#11136 already conflict with main and could not be compared automatically; their implementations were checked manually and are distinct. No implementation dependency is required.

Tested

Ubuntu 24.04 x86_64, GCC 13.3, Release, BUILD_TESTING=ON; base 3a2b91981651569163768854a1fcdc7193b6667b.

  • Full project CMake configuration succeeded; built the real libSceIcu, libc/libkernel dependencies, nid_patcher and ICU test targets. Focused CTest: 69/69 passed (four ICU runtime tests, public-header audit, 64 public-header compile shards). The final source-order adjustment was followed by another build and 5/5 runtime/audit checks. The entire repository test suite was not run.
  • Fixture checks all callback reasons in the upstream enum's representable 0–7 domain, context policies, default-ignorable boundaries, status/errno preservation, ignored pointers, and invalid inputs.
  • A temporary oracle containing the pinned official ICU callback bodies and macro passed 11,146,420 differential comparisons, including the full Unicode range. Oracle files are not part of the patch.
  • Complete ICU provider plus the callback fixture passed UBSan with no report.
  • Patched the real libc, libkernel and libSceIcu outputs using the CMake-prescribed nid_patcher arguments. Calls through all four inventory NIDs throw NotImplemented on main; the new exports pass behavioral checks. dladdr confirmed all three PRXs loaded from the isolated patched directory.
  • python3 tools/check_conventions.py --base origin/main, git diff --check, and tools/pr_overlap.py --branch codex/icu-next passed (overlap findings described above).

No game/homebrew, console hardware, Windows or macOS execution was performed.

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:5061103431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12692). Originally posted by [Ninot1Quyi](https://github.com/Ninot1Quyi) on 2026-10-29T02:34:51Z. --- ### What Replace four throwing inventory stubs with typed implementations of `UCNV_FROM_U_CALLBACK_STOP`, `UCNV_FROM_U_CALLBACK_SKIP`, `UCNV_TO_U_CALLBACK_STOP`, and `UCNV_TO_U_CALLBACK_SKIP`. STOP preserves the caller's error except for FROM_U's unassigned default-ignorable case. SKIP implements null-context and `"i"` policies, including default-ignorable precedence, and leaves lifecycle notifications untouched. Converter argument layouts remain opaque because these callbacks do not access them. Headers expose each export once; add a focused runtime fixture and update the remaining-stub debt count from 107 to 103. Signatures and behavior follow [ICU 78.1 ucnv_err.h](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/unicode/ucnv_err.h) and [ucnv_err.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ucnv_err.cpp). Names/NIDs are in the pinned [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c). This is an independent implementation; no ICU source is vendored or linked. The debt entry records absent console verification, the ICU 65.1/78.1 difference at U+180F, and guards for undefined upstream inputs. Unaccessed pointers remain unread. Converter execution and other callbacks remain unimplemented. Overlap: the repository checker scanned all 1,410 open PRs, followed by manual inspection of all 16 ICU candidates. None implements these four functions/NIDs. Mechanical conflicts remain with #10967 (test registration), #12320/#12629/#12630 (debt inventory/count), and #12451 (adjacent debt entry). Preserve both registrations/entries and recount remaining stubs when combining them. #11088/#11115/#11118/#11122/#11132/#11136 already conflict with main and could not be compared automatically; their implementations were checked manually and are distinct. No implementation dependency is required. ### 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. --> Ubuntu 24.04 x86_64, GCC 13.3, Release, BUILD_TESTING=ON; base `3a2b91981651569163768854a1fcdc7193b6667b`. - Full project CMake configuration succeeded; built the real libSceIcu, libc/libkernel dependencies, nid_patcher and ICU test targets. Focused CTest: **69/69 passed** (four ICU runtime tests, public-header audit, 64 public-header compile shards). The final source-order adjustment was followed by another build and **5/5** runtime/audit checks. The entire repository test suite was not run. - Fixture checks all callback reasons in the upstream enum's representable 0–7 domain, context policies, default-ignorable boundaries, status/errno preservation, ignored pointers, and invalid inputs. - A temporary oracle containing the pinned official ICU callback bodies and macro passed **11,146,420 differential comparisons**, including the full Unicode range. Oracle files are not part of the patch. - Complete ICU provider plus the callback fixture passed UBSan with no report. - Patched the real libc, libkernel and libSceIcu outputs using the CMake-prescribed nid_patcher arguments. Calls through all four inventory NIDs throw NotImplemented on main; the new exports pass behavioral checks. dladdr confirmed all three PRXs loaded from the isolated patched directory. - `python3 tools/check_conventions.py --base origin/main`, `git diff --check`, and `tools/pr_overlap.py --branch codex/icu-next` passed (overlap findings described above). No game/homebrew, console hardware, Windows or macOS execution was performed. ### 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 -->
rooklz commented 2026-10-29 03:26:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T03:26:39Z.

Review: APPROVED


I tested this on macOS, which the body didn't cover. Head is 63529b3c6d.

Standalone build. I built ConverterCallbacks.cpp with the PR's GuestIcuConverterCallbacks.cpp under ASan and UBSan on macOS 26 arm64 (Apple clang, -fno-sanitize-recover=undefined). The only shim was NotImplemented_nid_no_patch. It passes in 0.2 s with no sanitizer reports.

Differential against an ICU binary. I compared the four callbacks against Homebrew ICU 78.3's libicuuc (UCNV_*_CALLBACK_{STOP,SKIP}_78, linked as a binary, not read as source). The inputs were:

  • contexts: null, "i", "x", "", "I", "ii", "s", "c"
  • reasons 0–7
  • 9 initial error values (including 0, negatives and warnings)
  • every code point from -2 to 0x110001 for the FROM_U pair

That is 1,283,462,784 calls with 0 differences (3.4 s). 78.3 agrees with the PR's U+180F range.

Mutants. I ran 31 mutants of ConverterCallbacks.cpp:

  • one edge for each of the 17 default-ignorable ranges
  • reason bounds (> 6, dropped < 0)
  • the <= 2 gate on both SKIPs, moved to <= 1 and <= 3
  • reason == 0 widened to <= 1 in FROM STOP and in the FROM SKIP ignorable check
  • the 'i' byte changed to 'I', and the 'i' reason gate dropped
  • the null-context clause dropped
  • TO STOP writing the error
  • the null-error guard dropped

The PR test kills all 31. 29 of them also change results against ICU 78.3. The other two (null-error guard, dropped < 0) only affect inputs ICU leaves undefined, and the debt entry already documents them.

Other checks.

  • check_conventions --base 3a2b919816: clean.
  • git merge-tree against upstream/main 3a2b919816: clean, and pairwise with #10967: clean.
  • With #12451 it conflicts in the debt file, as the body says.

No changes requested.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692495021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12692#pullrequestreview-5692495021). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-29T03:26:39Z. **Review:** APPROVED --- I tested this on macOS, which the body didn't cover. Head is 63529b3c6d. **Standalone build.** I built `ConverterCallbacks.cpp` with the PR's `GuestIcuConverterCallbacks.cpp` under ASan and UBSan on macOS 26 arm64 (Apple clang, `-fno-sanitize-recover=undefined`). The only shim was `NotImplemented_nid_no_patch`. It passes in 0.2 s with no sanitizer reports. **Differential against an ICU binary.** I compared the four callbacks against Homebrew ICU 78.3's `libicuuc` (`UCNV_*_CALLBACK_{STOP,SKIP}_78`, linked as a binary, not read as source). The inputs were: - contexts: null, `"i"`, `"x"`, `""`, `"I"`, `"ii"`, `"s"`, `"c"` - reasons 0–7 - 9 initial error values (including 0, negatives and warnings) - every code point from -2 to 0x110001 for the FROM_U pair That is 1,283,462,784 calls with **0 differences** (3.4 s). 78.3 agrees with the PR's U+180F range. **Mutants.** I ran 31 mutants of `ConverterCallbacks.cpp`: - one edge for each of the 17 default-ignorable ranges - reason bounds (`> 6`, dropped `< 0`) - the `<= 2` gate on both SKIPs, moved to `<= 1` and `<= 3` - `reason == 0` widened to `<= 1` in FROM STOP and in the FROM SKIP ignorable check - the `'i'` byte changed to `'I'`, and the `'i'` reason gate dropped - the null-context clause dropped - TO STOP writing the error - the null-error guard dropped The PR test kills all 31. 29 of them also change results against ICU 78.3. The other two (null-error guard, dropped `< 0`) only affect inputs ICU leaves undefined, and the debt entry already documents them. **Other checks.** - `check_conventions --base 3a2b919816`: clean. - `git merge-tree` against upstream/main 3a2b919816: clean, and pairwise with #10967: clean. - With #12451 it conflicts in the debt file, as the body says. No changes requested.
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!12692
No description provided.