feat(libSceIcu): implement u_getVersion and u_errorName #11115

Merged
mantavisual merged 14 commits from upstream-pr/11115 into main 2026-11-02 19:45:25 +00:00
mantavisual commented 2026-10-25 18:31:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mantavisual on 2026-10-25T18:31:59Z.


What

Implements u_getVersion and u_errorName, two libSceIcu exports that firmware 13.42's module still has. Per BunnyFl's export list, both are among its 299 exports and in the 3.20 table.

  • u_getVersion writes {78, 1, 0, 0}, as ICU 78.1's putil.cpp does by parsing U_ICU_VERSION ("78.1") with u_versionFromString. That matches the 78.1.0.0 BunnyFl measured on 13.42. A null array does nothing, as in u_versionFromString. It reuses #11013's u_versionFromString.
  • u_errorName returns the names in ICU 78.1's utypes.cpp: eight tables starting at -128, 0, 0x10000, 0x10100, 0x10200, 0x10300, 0x10400 and 0x10500, 156 codes in all. Every other code gets [BOGUS UErrorCode]. The tables were generated from that file, and I checked every name against the UErrorCode value in 78.1's utypes.h. All tables are full, so there are no null entries. ICU's U_BRK_VARIABLE_REDFINITION spelling is kept. The strings are static, so repeated calls return the same pointer.

Both report ICU 78.1 whatever firmware is emulated. The 3.20 module was ICU 65–68 and has no names for codes added since (the U_MF_* codes, for example). The new docs/dev/debt/libSceIcu.md entry records that, and that only the version was measured on the console.

Depends on #11088, which is stacked on #11013, because all three add to the new CMakeLists.txt, libSceIcu.hpp and debt file. Until those merge, this diff also shows their commits. This PR's own change is the last commit, eb607ba588. The agreed ICU order is #11013 → #10961 → … → #10967 → #11088, and this PR comes right after #11088.

Tested

Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on #11088 (a43b228a4a).

  • New guest_icu_error_name:
    • Both ends of every table and the codes just outside them, including -129, -119, -1, 32, 0x10023, 0x10121, 0x1020e, 0x10316, 0x10409 and 0x10502.
    • Spot checks in the middle of tables, including U_BRK_VARIABLE_REDFINITION at 0x10206.
    • INT32_MIN and INT32_MAX.
    • A sweep from -0x200 to 0x105ff: exactly 156 distinct U_-prefixed names, none null, each a stable pointer.
  • guest_icu_version now also checks that u_getVersion gives 78.1.0.0 ("78.1" through u_versionToString), and that a null array is accepted.
  • ctest -R "guest_icu_|patched_libraries": all 4 pass. The NID-patched libSceIcu.prx has 31 NID exports, including iRm8tkU1ir4 (u_getVersion) and cY8dSl6Rqr4 (u_errorName).
  • tools/progress.py --module libSceIcu: 31 implemented, 0 stubs. tools/check_test_registration.py build: 1343 test executables, none built and not run.
  • python3 tools/check_conventions.py --base origin/main passes. Overlap: no open PR implements either function (checked 2026-10-25). #10961, #10963 and #10966 cite u_getVersion's measurement in their debt text only.

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: #11088
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5007502168 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11115). Originally posted by [mantavisual](https://github.com/mantavisual) on 2026-10-25T18:31:59Z. --- ### What Implements `u_getVersion` and `u_errorName`, two `libSceIcu` exports that firmware 13.42's module still has. Per [BunnyFl's export list](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6401310351), both are among its 299 exports and in the 3.20 table. - `u_getVersion` writes `{78, 1, 0, 0}`, as ICU 78.1's [putil.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/putil.cpp) does by parsing `U_ICU_VERSION` (`"78.1"`) with `u_versionFromString`. That matches the 78.1.0.0 [BunnyFl measured](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6400470698) on 13.42. A null array does nothing, as in `u_versionFromString`. It reuses #11013's `u_versionFromString`. - `u_errorName` returns the names in ICU 78.1's [utypes.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/utypes.cpp): eight tables starting at -128, 0, 0x10000, 0x10100, 0x10200, 0x10300, 0x10400 and 0x10500, 156 codes in all. Every other code gets `[BOGUS UErrorCode]`. The tables were generated from that file, and I checked every name against the `UErrorCode` value in 78.1's `utypes.h`. All tables are full, so there are no null entries. ICU's `U_BRK_VARIABLE_REDFINITION` spelling is kept. The strings are static, so repeated calls return the same pointer. Both report ICU 78.1 whatever firmware is emulated. The 3.20 module was ICU 65–68 and has no names for codes added since (the `U_MF_*` codes, for example). The new `docs/dev/debt/libSceIcu.md` entry records that, and that only the version was measured on the console. **Depends on #11088**, which is stacked on #11013, because all three add to the new `CMakeLists.txt`, `libSceIcu.hpp` and debt file. Until those merge, this diff also shows their commits. This PR's own change is the last commit, `eb607ba588`. The [agreed ICU order](https://github.com/boykopovar/AnyPS5/pull/11088#issuecomment-6401396662) is #11013 → #10961 → … → #10967 → #11088, and this PR comes right after #11088. ### Tested Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, on #11088 (`a43b228a4a`). - New `guest_icu_error_name`: - Both ends of every table and the codes just outside them, including -129, -119, -1, 32, 0x10023, 0x10121, 0x1020e, 0x10316, 0x10409 and 0x10502. - Spot checks in the middle of tables, including `U_BRK_VARIABLE_REDFINITION` at 0x10206. - `INT32_MIN` and `INT32_MAX`. - A sweep from -0x200 to 0x105ff: exactly 156 distinct `U_`-prefixed names, none null, each a stable pointer. - `guest_icu_version` now also checks that `u_getVersion` gives 78.1.0.0 (`"78.1"` through `u_versionToString`), and that a null array is accepted. - `ctest -R "guest_icu_|patched_libraries"`: all 4 pass. The NID-patched `libSceIcu.prx` has 31 NID exports, including `iRm8tkU1ir4` (`u_getVersion`) and `cY8dSl6Rqr4` (`u_errorName`). - `tools/progress.py --module libSceIcu`: 31 implemented, 0 stubs. `tools/check_test_registration.py build`: 1343 test executables, none built and not run. - `python3 tools/check_conventions.py --base origin/main` passes. Overlap: no open PR implements either function (checked 2026-10-25). #10961, #10963 and #10966 cite `u_getVersion`'s measurement in their debt text only. ### 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: #11088 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 18:40:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:40:08Z.

Review: APPROVED


Reviewed exact head eb607ba588. I compared all eight u_errorName name tables against the pinned ICU 78.1 utypes.cpp; every entry and range matches, including the standard, transliterator, format, break, regex, IDNA, plugin, and warning ranges. I independently built and ran GuestIcuErrorName with GCC 12.2; it passed the boundary and complete-range checks. The ICU source also confirms u_getVersion delegates to u_versionFromString with U_ICU_VERSION, and the submitted version helper follows the same parsing/formatting algorithm. The PR reports all four focused ICU tests passing and hosted conventions/intake checks are green; the full hosted product jobs are skipped. Its declared dependency on #11088 is appropriate for the shared ICU helpers.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644686316 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11115#pullrequestreview-5644686316). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T18:40:08Z. **Review:** APPROVED --- Reviewed exact head eb607ba588901b81824e28011a213137757c7637. I compared all eight `u_errorName` name tables against the pinned ICU 78.1 `utypes.cpp`; every entry and range matches, including the standard, transliterator, format, break, regex, IDNA, plugin, and warning ranges. I independently built and ran `GuestIcuErrorName` with GCC 12.2; it passed the boundary and complete-range checks. The ICU source also confirms `u_getVersion` delegates to `u_versionFromString` with `U_ICU_VERSION`, and the submitted version helper follows the same parsing/formatting algorithm. The PR reports all four focused ICU tests passing and hosted conventions/intake checks are green; the full hosted product jobs are skipped. Its declared dependency on #11088 is appropriate for the shared ICU helpers.
thepoppfish commented 2026-10-25 18:47:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thepoppfish on 2026-10-25T18:47:28Z.

Review: APPROVED


Reviewed exact last-commit delta eb607ba588901b81824e28011a213137757c7637 over a43b228a4ac1ce6316037802a613b8e40851c35c (#11088). Approve; no actionable findings in the two new exports, their declarations/registration/tests or their new debt entry.

The eight ranges and all156 names match ICU78.1, including the historical U_BRK_VARIABLE_REDFINITION spelling and all holes returning [BOGUS UErrorCode]. The subtraction is widened to64 bits before indexing, so the signed32-bit endpoints do not overflow. u_getVersion delegates to the existing parser with the fixed78.1 string, matching upstream putil.cpp. The documented choice to report78.1 on older firmware remains explicit.

Independent Windows11 build26200 / GCC16.2.0-6 UCRT / CMake4.3.1 / Ninja1.13.2:

  • Compiled the complete unchanged ICU78.1 utypes.cpp with its pinned public headers as a separate native reference. Source/header manifest:13 files from tag commit 049e0d6a420629ac7db77256987d083a563287b5. Only the reference symbol name/static-build macros are changed; no reference table or function body is reconstructed from the PR. -fno-strict-enums permits the intended invalid-code ABI probes.
  • Compared 168,610 codes against the actual production ErrorName.cpp: every integer in[-0x400,0x10800),100,000 deterministic arbitrary signed32-bit values, and INT32_MIN/MAX. Zero name mismatches, nulls or unstable pointers; exactly156 named codes and156 distinct names in the continuous range. Each production result is called twice to check pointer stability:337,220 production calls and168,610 reference calls in this additional probe.
  • Executed the complete committed GuestIcuErrorName.cpp fixture unchanged. It passes, including table boundaries, unknown gaps/extremes and its own continuous sweep.
  • Actual Version.cpp/Invariant.cpp: 61 guarded buffer offsets plus a null-pointer call, all pass. Each populated buffer contains exactly78.1.0.0 in the four destination bytes and preserves every guard byte. This version harness supplies a host-strtoull adapter for the existing guest-strtoul boundary; it validates the new fixed-literal call and writes, not general guest-libc integer parsing or the complete parent version fixture.
  • Both locally registered external-harness CTests pass (2/2, zero skips,0.27s total). Current conventions against main a7a2eece499ef8925c93765dbbcc9f4d9461a2f0 and whitespace checks pass; author checkout is clean.

The new commit is directly on the current #11088 head, and the authors have recorded #11088 after #10967, followed by this PR. This approval covers the new commit's delta; it does not certify a future rebase/composition of every ICU topic or independently repeat the parent's numeric tests, full patched shared-library/NID checks, Linux/macOS or hosted product jobs. The linked firmware78.1 version observation was obtained from the firmware module in an emulator; I did not perform a retail-console measurement or compare error names on a console.

AI-assisted review and native comparison; all local runs stated above actually executed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644710099 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11115#pullrequestreview-5644710099). Originally posted by [thepoppfish](https://github.com/thepoppfish) on 2026-10-25T18:47:28Z. **Review:** APPROVED --- Reviewed exact last-commit delta `eb607ba588901b81824e28011a213137757c7637` over `a43b228a4ac1ce6316037802a613b8e40851c35c` (#11088). Approve; no actionable findings in the two new exports, their declarations/registration/tests or their new debt entry. The eight ranges and all156 names match ICU78.1, including the historical `U_BRK_VARIABLE_REDFINITION` spelling and all holes returning `[BOGUS UErrorCode]`. The subtraction is widened to64 bits before indexing, so the signed32-bit endpoints do not overflow. `u_getVersion` delegates to the existing parser with the fixed78.1 string, matching [upstream putil.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/putil.cpp). The documented choice to report78.1 on older firmware remains explicit. Independent Windows11 build26200 / GCC16.2.0-6 UCRT / CMake4.3.1 / Ninja1.13.2: - Compiled the complete unchanged [ICU78.1 `utypes.cpp`](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/utypes.cpp) with its pinned public headers as a separate native reference. Source/header manifest:13 files from tag commit `049e0d6a420629ac7db77256987d083a563287b5`. Only the reference symbol name/static-build macros are changed; no reference table or function body is reconstructed from the PR. `-fno-strict-enums` permits the intended invalid-code ABI probes. - Compared **168,610 codes** against the actual production `ErrorName.cpp`: every integer in[-0x400,0x10800),100,000 deterministic arbitrary signed32-bit values, and INT32_MIN/MAX. **Zero name mismatches, nulls or unstable pointers**; exactly156 named codes and156 distinct names in the continuous range. Each production result is called twice to check pointer stability:337,220 production calls and168,610 reference calls in this additional probe. - Executed the complete committed `GuestIcuErrorName.cpp` fixture unchanged. It passes, including table boundaries, unknown gaps/extremes and its own continuous sweep. - Actual `Version.cpp`/`Invariant.cpp`: **61 guarded buffer offsets plus a null-pointer call**, all pass. Each populated buffer contains exactly78.1.0.0 in the four destination bytes and preserves every guard byte. This version harness supplies a host-`strtoull` adapter for the existing guest-`strtoul` boundary; it validates the new fixed-literal call and writes, not general guest-libc integer parsing or the complete parent version fixture. - Both locally registered external-harness CTests pass (**2/2**, zero skips,0.27s total). Current conventions against main `a7a2eece499ef8925c93765dbbcc9f4d9461a2f0` and whitespace checks pass; author checkout is clean. The new commit is directly on the current #11088 head, and the authors have recorded #11088 after #10967, followed by this PR. This approval covers the new commit's delta; it does not certify a future rebase/composition of every ICU topic or independently repeat the parent's numeric tests, full patched shared-library/NID checks, Linux/macOS or hosted product jobs. The linked firmware78.1 version observation was obtained from the firmware module in an emulator; I did not perform a retail-console measurement or compare error names on a console. AI-assisted review and native comparison; all local runs stated above actually executed.
MarcZX10 commented 2026-10-29 08:45:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:45:04Z.

Review: APPROVED


Re-reviewed exact head 795a7c4ac79be762952d7bf4ca0c838c700a8337 after the main merge. The current-main merge preview is clean and its effective change is the previously reviewed ICU implementation/tests plus the resolved CMake/debt conflicts; the author reports no other code changes. The exact-head Windows workflow, conventions and report checks pass; Linux/product jobs are skipped. I did not rerun the ICU CTest targets locally, so this update relies on the earlier source review and the author’s merge-only description.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694978489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11115#pullrequestreview-5694978489). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:45:04Z. **Review:** APPROVED --- Re-reviewed exact head `795a7c4ac79be762952d7bf4ca0c838c700a8337` after the main merge. The current-main merge preview is clean and its effective change is the previously reviewed ICU implementation/tests plus the resolved CMake/debt conflicts; the author reports no other code changes. The exact-head Windows workflow, conventions and report checks pass; Linux/product jobs are skipped. I did not rerun the ICU CTest targets locally, so this update relies on the earlier source review and the author’s merge-only description.
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!11115
No description provided.