feat(icu): implement ten resource bundle accessors #14123

Closed
CobaltMoth482 wants to merge 4 commits from upstream-pr/14123 into main
CobaltMoth482 commented 2026-10-31 19:47:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CobaltMoth482 on 2026-10-31T19:47:33Z.


What

Implements ten existing libSceIcu resource-bundle stubs as one in-memory resource-access topic: res_read, res_countArrayItems, res_getAlias, res_getArrayItem, res_getBinaryNoTrace, res_getIntVectorNoTrace, res_getResource, res_getStringNoTrace, res_getTableItemByIndex, and res_getTableItemByKey.

Names and independently calculated NIDs match the PS5 3.20 inventory. Names/NIDs do not establish prototypes. The source-compatible signatures, structures and behavior follow ICU 78.1 uresdata.h and uresdata.cpp, cross-checked against ICU 65.1's identical structure fields. Implementation independently written; no third-party source or runtime dependency added.

Handles legacy/string-v2 values, binary and integer vectors, all three tables, both arrays, pooled offsets and formats 1–3. Caller-owned data must satisfy upstream accessor preconditions; no loading, allocation or pool ownership is invented. The 64-byte ResourceData/20-byte data-info ABI and firmware compatibility are not console-verified. Existing debt records these limits. For declared input lengths 0–3, res_read deliberately throws after clearing output rather than reading beyond the declared range; upstream malformed-input partial-state equivalence is not claimed.

Prior unchanged progress scan: libSceIcu 28/2475 → 38/2475 (+10 implemented exports, unchanged denominator). The subsequent rebase leaves the ICU source inventory unchanged. No game-unblock or percentage-point claim.

Also cross-checked against pinned ICU 68.2 (github.com/unicode-org/icu@84e1f26ea7/icu4c/source/common/uresdata.cpp): the ten target functions and res_init preserve the same logic as 78.1, and ResourceData/UDataInfo fields match. On ASCII builds both useNativeStrcmp branches resolve to strcmp; EBCDIC is unsupported. This does not verify the console version or ABI.

Tested

Linux x86-64 / GCC 14.2.0. Refreshed candidate 64fcfaa02c139f8fa319319b3e0b9bf5b43237a8 on main 121b2e37af75278e3d84a2f43869730030b112ed (2026-10-31).

  • Strict C++20 -O2 -Wall -Wextra -Werror behavioral fixture: passed for all ten exports; covers resource tags/layouts, empty/wrong types, pooling, index boundaries, malformed headers and error/output preservation.
  • Fresh ASan+UBSan fixture: passed, leak detection disabled.
  • Fresh independently built actual ICU 78.1 common library at pinned 049e0d6a420629ac7db77256987d083a563287b5: 261,295 differential assertions passed, including complete parser output-state checks and ignored-field/negative-table-count cases. Candidate+harness sanitizer run passed; oracle DSO uninstrumented. Four fresh mutation controls rejected. The historical 261,143 count differs only because the rebuilt harness splits error/state checks in 152 cases; this is accounting, not additional functions.
  • Focused shared-library fixture and original resource-public-type regression passed. A minimal external CMake harness using the actual ICU module CMake file built the module and both resource CTests passed (2/2). It permits unresolved unrelated guest-libc symbols and supplies host test wrappers; this is not product-link/guest-loader validation.
  • Fresh public-header audit: 394 libraries / 24,929 exports, unique declarations and standalone headers passed. Conventions and whitespace checks passed.
  • Fresh full configuration blocked at CMakeLists.txt:534: required XRandR development support missing. Guard not disabled. No full product build/CTest, Windows, guest-loader, title/homebrew or console execution. Maintainer full CI remains required.
  • Required overlap CLI and manual peer controls are disclosed below; no false automated clean-overlap result is claimed.

Repository target guest_icu_resource_readers_tests; CTest guest_icu_resource_readers.

Overlap and merge ordering

The required tools/pr_overlap.py scan covered 1,678 open PRs / 19 shared-file peers and exited 2 (failed closed), not a clean result. Fifteen peers already conflict with main. Its scan ran before a final CMake-only source-line relocation; manual controls were then rerun against the exact final candidate for all 19 peers / 59 shared files / 118 base-vs-candidate merge invocations. No duplicate reader names/NIDs or new-path collisions were found. Final CMake controls add no conflicts, including #13274 and #14050 (both clean). The remaining fifteen peers retain their existing base conflicts.

Only #14050 (locale_getKeywordsStart) introduces candidate-caused conflicts: adjacent independent edits in Export.cpp, Identified.hpp, and shared debt counts (one conflict per file). There is no functional dependency, and no peer code is incorporated. Whichever change lands second must rebase, retaining both implementations/registrations and recomputing debt counts (82 total / 62 named after composing these two current patches). No union build was performed. This PR is based on main, not stacked on #14050.

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:5100967198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123). Originally posted by [CobaltMoth482](https://github.com/CobaltMoth482) on 2026-10-31T19:47:33Z. --- ### What Implements ten existing libSceIcu resource-bundle stubs as one in-memory resource-access topic: `res_read`, `res_countArrayItems`, `res_getAlias`, `res_getArrayItem`, `res_getBinaryNoTrace`, `res_getIntVectorNoTrace`, `res_getResource`, `res_getStringNoTrace`, `res_getTableItemByIndex`, and `res_getTableItemByKey`. Names and independently calculated NIDs match the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c). Names/NIDs do not establish prototypes. The source-compatible signatures, structures and behavior follow [ICU 78.1 uresdata.h](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uresdata.h) and [uresdata.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uresdata.cpp), cross-checked against ICU 65.1's identical structure fields. Implementation independently written; no third-party source or runtime dependency added. Handles legacy/string-v2 values, binary and integer vectors, all three tables, both arrays, pooled offsets and formats 1–3. Caller-owned data must satisfy upstream accessor preconditions; no loading, allocation or pool ownership is invented. The 64-byte ResourceData/20-byte data-info ABI and firmware compatibility are **not console-verified**. Existing debt records these limits. For declared input lengths 0–3, res_read deliberately throws after clearing output rather than reading beyond the declared range; upstream malformed-input partial-state equivalence is not claimed. Prior unchanged progress scan: **libSceIcu 28/2475 → 38/2475 (+10 implemented exports, unchanged denominator)**. The subsequent rebase leaves the ICU source inventory unchanged. No game-unblock or percentage-point claim. Also cross-checked against pinned ICU 68.2 (https://github.com/unicode-org/icu/blob/84e1f26ea77152936e70d53178a816dbfbf69989/icu4c/source/common/uresdata.cpp): the ten target functions and res_init preserve the same logic as 78.1, and ResourceData/UDataInfo fields match. On ASCII builds both useNativeStrcmp branches resolve to strcmp; EBCDIC is unsupported. This does not verify the console version or ABI. ### Tested Linux x86-64 / GCC 14.2.0. Refreshed candidate `64fcfaa02c139f8fa319319b3e0b9bf5b43237a8` on main `121b2e37af75278e3d84a2f43869730030b112ed` (2026-10-31). - Strict C++20 `-O2 -Wall -Wextra -Werror` behavioral fixture: passed for all ten exports; covers resource tags/layouts, empty/wrong types, pooling, index boundaries, malformed headers and error/output preservation. - Fresh ASan+UBSan fixture: passed, leak detection disabled. - Fresh independently built actual ICU 78.1 common library at pinned `049e0d6a420629ac7db77256987d083a563287b5`: **261,295 differential assertions passed**, including complete parser output-state checks and ignored-field/negative-table-count cases. Candidate+harness sanitizer run passed; oracle DSO uninstrumented. Four fresh mutation controls rejected. The historical 261,143 count differs only because the rebuilt harness splits error/state checks in 152 cases; this is accounting, not additional functions. - Focused shared-library fixture and original resource-public-type regression passed. A minimal external CMake harness using the actual ICU module CMake file built the module and both resource CTests passed (2/2). It permits unresolved unrelated guest-libc symbols and supplies host test wrappers; this is not product-link/guest-loader validation. - Fresh public-header audit: 394 libraries / 24,929 exports, unique declarations and standalone headers passed. Conventions and whitespace checks passed. - Fresh full configuration **blocked** at CMakeLists.txt:534: required XRandR development support missing. Guard not disabled. No full product build/CTest, Windows, guest-loader, title/homebrew or console execution. Maintainer full CI remains required. - Required overlap CLI and manual peer controls are disclosed below; no false automated clean-overlap result is claimed. Repository target `guest_icu_resource_readers_tests`; CTest `guest_icu_resource_readers`. ### Overlap and merge ordering The required `tools/pr_overlap.py` scan covered **1,678 open PRs / 19 shared-file peers** and exited **2 (failed closed)**, not a clean result. Fifteen peers already conflict with main. Its scan ran before a final CMake-only source-line relocation; manual controls were then rerun against the exact final candidate for **all 19 peers / 59 shared files / 118 base-vs-candidate merge invocations**. No duplicate reader names/NIDs or new-path collisions were found. Final CMake controls add no conflicts, including #13274 and #14050 (both clean). The remaining fifteen peers retain their existing base conflicts. Only #14050 (`locale_getKeywordsStart`) introduces candidate-caused conflicts: adjacent independent edits in `Export.cpp`, `Identified.hpp`, and shared debt counts (one conflict per file). There is **no functional dependency**, and no peer code is incorporated. Whichever change lands second must rebase, retaining both implementations/registrations and recomputing debt counts (82 total / 62 named after composing these two current patches). No union build was performed. This PR is based on main, not stacked on #14050. <!-- 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 -->
slopgobblercobbler commented 2026-10-31 20:01:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-10-31T20:01:53Z.

Review: COMMENTED


Audited the implementation in core/libs/prx/libSceIcu/ResourceReaders.{hpp,cpp}:

  1. Resource Bundle Layout & ABI Alignment:

    • Verified static assertions for IcuResourceData (64 bytes) and field offsets (pRoot, p16BitUnits, poolBundleKeys, rootRes, localKeyLimit, poolBundleStrings, etc.) matching standard ICU uresdata.h.
    • Verified IcuDataInfo (20 bytes) format header layout and magic/endianness checks (info->size >= 20, little-endian ASCII ResB, format versions 1 to 3).
  2. Error Code & Memory Safety:

    • res_read cleanly respects UErrorCode: returns immediately if *error > 0 (U_FAILURE), and correctly sets *error = 3 (U_INVALID_FORMAT_ERROR) on malformed headers, invalid root resource types, or truncated index tables.
    • Pointer and alignment invariants (Require(data != nullptr), 32-bit alignment of data buffer) protect against undefined memory access.
    • Out-of-bounds table searches safely return 0xffffffff (RES_BOGUS) and set *index = -1.
  3. Table & Leaf Accessors:

    • Complete coverage across table types (types 2, 4, 5: 16-bit keys, 32-bit keys, 16-bit values), arrays (types 8 and 9), aliases, binary payloads, and int vectors.
    • String access accurately decodes legacy UTF-16 strings as well as string-v2 length encodings across both local and pooled bundles.
  4. Test Suite & Technical Debt:

    • Verified test assertions in tests/ResourceReaders.cpp covering leaves, strings, arrays, tables, negative table bounds, and format validation.
    • Technical debt in docs/dev/debt/libSceIcu.md properly documents the unmeasured console behavior and malformed input handling within convention limits.

Clean, high-quality implementation of the resource bundle readers.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724708807 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123#pullrequestreview-5724708807). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-10-31T20:01:53Z. **Review:** COMMENTED --- Audited the implementation in `core/libs/prx/libSceIcu/ResourceReaders.{hpp,cpp}`: 1. Resource Bundle Layout & ABI Alignment: - Verified static assertions for `IcuResourceData` (64 bytes) and field offsets (`pRoot`, `p16BitUnits`, `poolBundleKeys`, `rootRes`, `localKeyLimit`, `poolBundleStrings`, etc.) matching standard ICU `uresdata.h`. - Verified `IcuDataInfo` (20 bytes) format header layout and magic/endianness checks (`info->size >= 20`, little-endian ASCII `ResB`, format versions 1 to 3). 2. Error Code & Memory Safety: - `res_read` cleanly respects `UErrorCode`: returns immediately if `*error > 0` (`U_FAILURE`), and correctly sets `*error = 3` (`U_INVALID_FORMAT_ERROR`) on malformed headers, invalid root resource types, or truncated index tables. - Pointer and alignment invariants (`Require(data != nullptr)`, 32-bit alignment of data buffer) protect against undefined memory access. - Out-of-bounds table searches safely return `0xffffffff` (`RES_BOGUS`) and set `*index = -1`. 3. Table & Leaf Accessors: - Complete coverage across table types (types 2, 4, 5: 16-bit keys, 32-bit keys, 16-bit values), arrays (types 8 and 9), aliases, binary payloads, and int vectors. - String access accurately decodes legacy UTF-16 strings as well as string-v2 length encodings across both local and pooled bundles. 4. Test Suite & Technical Debt: - Verified test assertions in `tests/ResourceReaders.cpp` covering leaves, strings, arrays, tables, negative table bounds, and format validation. - Technical debt in `docs/dev/debt/libSceIcu.md` properly documents the unmeasured console behavior and malformed input handling within convention limits. Clean, high-quality implementation of the resource bundle readers.
MarcZX10 commented 2026-10-31 20:10:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T20:10:09Z.

Review: APPROVED


Reviewed — looks good

I found no blocking mismatch in the ten resource readers at head 6bbec72587af482b954e73f7352981691810880c against base 0ef9ce78a556d6955d181d6b1401b21634227ec5; the hosted Windows build and test job passed.

The no-build diff, conventions, dependency checks, and public-header audit passed. I checked the test-registration heuristic against CMake; the CTest is registered. The author reports passing ASan and 261,295 ICU differential assertions, which I did not independently rerun. I did not run a local build or C++ tests; Linux and specialized hosted jobs were skipped. Console ABI/runtime behavior remains unverified and is documented as debt.

Sources: resource readers at the reviewed head, ICU 78.1 reference at pinned commit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724738210 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123#pullrequestreview-5724738210). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T20:10:09Z. **Review:** APPROVED --- # Reviewed — looks good I found no blocking mismatch in the ten resource readers at head `6bbec72587af482b954e73f7352981691810880c` against base `0ef9ce78a556d6955d181d6b1401b21634227ec5`; the hosted Windows build and test job passed. The no-build diff, conventions, dependency checks, and public-header audit passed. I checked the test-registration heuristic against CMake; the CTest is registered. The author reports passing ASan and 261,295 ICU differential assertions, which I did not independently rerun. I did not run a local build or C++ tests; Linux and specialized hosted jobs were skipped. Console ABI/runtime behavior remains unverified and is documented as debt. Sources: [resource readers at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/6bbec72587af482b954e73f7352981691810880c/core/libs/prx/libSceIcu/ResourceReaders.cpp), [ICU 78.1 reference at pinned commit](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uresdata.cpp).
CnRJay commented 2026-11-01 19:49:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:33Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729922584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123#pullrequestreview-5729922584). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:49:33Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
adriadam10 commented 2026-11-06 15:11:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-06T15:11:37Z.

Review: CHANGES_REQUESTED


The ten readers look good to me. They match ICU uresdata (68.2/78.1), unmet preconditions throw, the test is registered in ctest, and the debt entries are accurate. The differential runs from @RyanIsAinmDom and your own results support it.

One thing blocks the merge: #14050 (locale_getKeywordsStart) has merged, and this branch now conflicts with main in:

  • core/libs/prx/libSceIcu/Export.cpp
  • core/libs/prx/libSceIcu/Identified.hpp
  • docs/dev/debt/libSceIcu.md

"Allow edits from maintainers" is off, so we can't rebase it for you. Please rebase onto current main, keep both implementations, and recompute the debt counts (82 total / 62 named, per your overlap notes). Once it is rebased and CI is green it can go to the merge queue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5802185972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123#pullrequestreview-5802185972). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-06T15:11:37Z. **Review:** CHANGES_REQUESTED --- The ten readers look good to me. They match ICU `uresdata` (68.2/78.1), unmet preconditions throw, the test is registered in ctest, and the debt entries are accurate. The differential runs from @RyanIsAinmDom and your own results support it. One thing blocks the merge: #14050 (`locale_getKeywordsStart`) has merged, and this branch now conflicts with `main` in: - `core/libs/prx/libSceIcu/Export.cpp` - `core/libs/prx/libSceIcu/Identified.hpp` - `docs/dev/debt/libSceIcu.md` "Allow edits from maintainers" is off, so we can't rebase it for you. Please rebase onto current `main`, keep both implementations, and recompute the debt counts (82 total / 62 named, per your overlap notes). Once it is rebased and CI is green it can go to the merge queue.
MarcZX10 commented 2026-11-20 08:47:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T08:47:08Z.

Review: COMMENTED


Reviewed — no blocking findings

The reviewed diff shows no verified blocking defect; this review did not run the reported checks, so a formal approval is not justified.

What I ran

Reviewed head 31d690c126158aab72e8c01e20eeb1d87e8c27bf using the prepared diff and the pinned repository reader. No build or tests were run in this session.

Results

Check Result Note
Code review passed Changed code and tests inspected
Build and tests not run Results in the description are author reported
Console validation not run ABI and firmware behavior remain unverified

Findings

Blocking

None.

Non-blocking

None.

Sources

Reviewed changed files at the pinned commit: core/libs/prx/libSceIcu/CMakeLists.txt, Export.cpp, Identified.hpp, ResourceReaders.cpp, ResourceReaders.hpp, libSceIcu.hpp, tests/ResourceReaders.cpp, and docs/dev/debt/libSceIcu.md.

Not verified

The reported Linux fixtures, sanitizer runs, ICU differential checks, and CMake harness were not run in this session. Full product build, Windows, guest-loader, title/homebrew, and console behavior were not verified. All eight changed files were inspected in the prepared diff; full text was read for six of eight, while Export.cpp and Identified.hpp were inspected through their diff hunks. No excluded changed files were listed.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989811970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14123#pullrequestreview-5989811970). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T08:47:08Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The reviewed diff shows no verified blocking defect; this review did not run the reported checks, so a formal approval is not justified. ## What I ran Reviewed head `31d690c126158aab72e8c01e20eeb1d87e8c27bf` using the prepared diff and the pinned repository reader. No build or tests were run in this session. ## Results | Check | Result | Note | |---|---|---| | Code review | passed | Changed code and tests inspected | | Build and tests | not run | Results in the description are author reported | | Console validation | not run | ABI and firmware behavior remain unverified | ## Findings ### Blocking None. ### Non-blocking None. ## Sources Reviewed changed files at [the pinned commit](https://github.com/boykopovar/AnyPS5/tree/31d690c126158aab72e8c01e20eeb1d87e8c27bf): `core/libs/prx/libSceIcu/CMakeLists.txt`, `Export.cpp`, `Identified.hpp`, `ResourceReaders.cpp`, `ResourceReaders.hpp`, `libSceIcu.hpp`, `tests/ResourceReaders.cpp`, and `docs/dev/debt/libSceIcu.md`. ## Not verified The reported Linux fixtures, sanitizer runs, ICU differential checks, and CMake harness were not run in this session. Full product build, Windows, guest-loader, title/homebrew, and console behavior were not verified. All eight changed files were inspected in the prepared diff; full text was read for six of eight, while `Export.cpp` and `Identified.hpp` were inspected through their diff hunks. No excluded changed files were listed. ## To get this to a good state Nothing is required.

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