feat(libSceIcu): implement uloc_openAvailableByType #24020

Merged
akaydesu merged 1 commit from upstream-pr/24020 into main 2026-11-20 19:24:44 +00:00
akaydesu commented 2026-11-20 01:05:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akaydesu on 2026-11-20T01:05:34Z.


What

Implements libSceIcu's uloc_openAvailableByType (core/libs/prx/libSceIcu/AvailableLocales.cpp), replacing the NotImplemented_nid_no_patch stub in LegacyExports.cpp and updating its public declaration in include/LegacyExports.hpp:

  • Validates type against [0, ULOC_AVAILABLE_COUNT) before forwarding to ICU 78.1's uloc_openAvailableByType through Icu::OpenHostEnumeration, setting U_ILLEGAL_ARGUMENT_ERROR for out-of-range enum values and preserving ICU's U_MISSING_RESOURCE_ERROR when res_index.res is absent.
  • Wraps the host UEnumeration* in a guest-heap-allocated UEnumeration record with APS5_VABI callbacks for close, count, uNext, next, and reset, with checked guest status/length copies and errno preservation.
  • Adds core/libs/prx/libSceIcu/tests/AvailableLocales.cpp (guest_icu_available_locales_errors and guest_icu_available_locales_data) covering reduced-data parity, invalid ULocAvailableType values, prefailed/warning/null/unreadable/read-only status pointers, and full ULOC_AVAILABLE_DEFAULT / ULOC_AVAILABLE_ONLY_LEGACY_ALIASES / ULOC_AVAILABLE_WITH_LEGACY_ALIASES enumeration against a synthetic res_index.res package loaded via udata_setCommonData.
  • Records the unmeasured PS5 ABI and reduced-data gap in docs/dev/debt/changes/feat-icu-open-available-by-type.md.

Tested

Windows 11 x86-64 (WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release, -DBUILD_TESTING=ON). Built libSceIcu and the enumeration/availability test executables:

  • ctest --test-dir build -R "guest_icu_(available_locales|availability|enumeration|converter_available_names)" --output-on-failure: 5/5 passed (guest_icu_available_locales_errors, guest_icu_available_locales_data, guest_icu_availability, guest_icu_enumeration, guest_icu_converter_available_names).
  • python core/libs/tests/test_public_headers.py --audit-only, python tools/debt_fold.py --check, and python tools/check_conventions.py --base origin/main passed.
  • python tools/pr_overlap.py --names uloc_openAvailableByType reported open: none, and python tools/pr_overlap.py --branch feat/icu-open-available-by-type reported no conflicting lines, exports, or new files against any comparable PR (manual diff inspection of the 28 stale PRs that conflict with main on CMakeLists.txt / LegacyExports.* confirmed none touch uloc_openAvailableByType or AvailableLocales). No console or title run.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5405833988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24020). Originally posted by [akaydesu](https://github.com/akaydesu) on 2026-11-20T01:05:34Z. --- ### What Implements `libSceIcu`'s `uloc_openAvailableByType` (`core/libs/prx/libSceIcu/AvailableLocales.cpp`), replacing the `NotImplemented_nid_no_patch` stub in `LegacyExports.cpp` and updating its public declaration in `include/LegacyExports.hpp`: - Validates `type` against `[0, ULOC_AVAILABLE_COUNT)` before forwarding to ICU 78.1's `uloc_openAvailableByType` through `Icu::OpenHostEnumeration`, setting `U_ILLEGAL_ARGUMENT_ERROR` for out-of-range enum values and preserving ICU's `U_MISSING_RESOURCE_ERROR` when `res_index.res` is absent. - Wraps the host `UEnumeration*` in a guest-heap-allocated `UEnumeration` record with `APS5_VABI` callbacks for `close`, `count`, `uNext`, `next`, and `reset`, with checked guest status/length copies and `errno` preservation. - Adds `core/libs/prx/libSceIcu/tests/AvailableLocales.cpp` (`guest_icu_available_locales_errors` and `guest_icu_available_locales_data`) covering reduced-data parity, invalid `ULocAvailableType` values, prefailed/warning/null/unreadable/read-only status pointers, and full `ULOC_AVAILABLE_DEFAULT` / `ULOC_AVAILABLE_ONLY_LEGACY_ALIASES` / `ULOC_AVAILABLE_WITH_LEGACY_ALIASES` enumeration against a synthetic `res_index.res` package loaded via `udata_setCommonData`. - Records the unmeasured PS5 ABI and reduced-data gap in `docs/dev/debt/changes/feat-icu-open-available-by-type.md`. ### 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. --> Windows 11 x86-64 (WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release, `-DBUILD_TESTING=ON`). Built `libSceIcu` and the enumeration/availability test executables: - `ctest --test-dir build -R "guest_icu_(available_locales|availability|enumeration|converter_available_names)" --output-on-failure`: 5/5 passed (`guest_icu_available_locales_errors`, `guest_icu_available_locales_data`, `guest_icu_availability`, `guest_icu_enumeration`, `guest_icu_converter_available_names`). - `python core/libs/tests/test_public_headers.py --audit-only`, `python tools/debt_fold.py --check`, and `python tools/check_conventions.py --base origin/main` passed. - `python tools/pr_overlap.py --names uloc_openAvailableByType` reported `open: none`, and `python tools/pr_overlap.py --branch feat/icu-open-available-by-type` reported no conflicting lines, exports, or new files against any comparable PR (manual diff inspection of the 28 stale PRs that conflict with `main` on `CMakeLists.txt` / `LegacyExports.*` confirmed none touch `uloc_openAvailableByType` or `AvailableLocales`). No console or title run. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 -->
PrivacyOnion commented 2026-11-20 01:53:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T01:53:30Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 633bd44ec2:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_available_locales_tests built cleanly.
  • CTest (guest_icu_available_locales_errors, guest_icu_available_locales_data):
    1/2 Test #4007: guest_icu_available_locales_errors ...   Passed    0.03 sec
    2/2 Test #4008: guest_icu_available_locales_data .....   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libSceIcu/LegacyExports.cpp, core/libs/prx/libSceIcu/include/LegacyExports.hpp, core/libs/prx/libSceIcu/AvailableLocales.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceIcu/AvailableLocales.cpp correctly validates type range [0, ULOC_AVAILABLE_COUNT) and sets U_ILLEGAL_ARGUMENT_ERROR for out-of-range values
    • Checked HostEnumeration wrapping via Icu::OpenHostEnumeration in core/libs/prx/libSceIcu/AvailableLocales.cpp ensuring guest-allocated UEnumeration callbacks and error translation
    • Verified handling and preservation of pre-existing failure error codes and null status checking via Icu::OpenHostEnumeration
    • Confirmed AGENTS.md compliance: no comments in source code, correct debt fragment added in docs/dev/debt/changes/feat-icu-open-available-by-type.md, and Conventional Commits title
    • Audited tests in core/libs/prx/libSceIcu/tests/AvailableLocales.cpp covering errors, invalid enum values, memory protection boundaries, and synthetic res_index bundle enumeration

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5986359675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24020#pullrequestreview-5986359675). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T01:53:30Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `633bd44ec2`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_available_locales_tests` built cleanly. - **CTest** (`guest_icu_available_locales_errors`, `guest_icu_available_locales_data`): ``` 1/2 Test #4007: guest_icu_available_locales_errors ... Passed 0.03 sec 2/2 Test #4008: guest_icu_available_locales_data ..... Passed 0.02 sec 100% tests passed, 0 tests failed out of 2 ``` - **Negative control**: with `core/libs/prx/libSceIcu/LegacyExports.cpp`, `core/libs/prx/libSceIcu/include/LegacyExports.hpp`, `core/libs/prx/libSceIcu/AvailableLocales.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceIcu/AvailableLocales.cpp correctly validates type range [0, ULOC_AVAILABLE_COUNT) and sets U_ILLEGAL_ARGUMENT_ERROR for out-of-range values - Checked HostEnumeration wrapping via Icu::OpenHostEnumeration in core/libs/prx/libSceIcu/AvailableLocales.cpp ensuring guest-allocated UEnumeration callbacks and error translation - Verified handling and preservation of pre-existing failure error codes and null status checking via Icu::OpenHostEnumeration - Confirmed AGENTS.md compliance: no comments in source code, correct debt fragment added in docs/dev/debt/changes/feat-icu-open-available-by-type.md, and Conventional Commits title - Audited tests in core/libs/prx/libSceIcu/tests/AvailableLocales.cpp covering errors, invalid enum values, memory protection boundaries, and synthetic res_index bundle enumeration Looks Good To Me
MarcZX10 commented 2026-11-20 06:29:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:29:49Z.

Review: APPROVED


Reviewed — looks good

The implementation and all six changed files were reviewed at head 633bd44ec2104d09bceacf33b13b83e2fa1139ff; no concrete defect was found in the code inspected. The author reports five related Windows tests and three checks passed; I did not run them.

What I ran

No commands or tests were run. I read the prepared diff and manifest, all six changed files, and the HostEnumeration.hpp and Enumeration.hpp context used by the implementation.

Results

Check Result Note
Code review passed Implementation and tests inspected
Automated checks not run Results in description are author-reported
Console behavior not run No PS5 or title run reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The review bundle listed all six changed files as included, and I read all six: AvailableLocales.cpp, CMakeLists.txt, LegacyExports.cpp, include/LegacyExports.hpp, tests/AvailableLocales.cpp, and the debt note. I also read HostEnumeration.hpp and Enumeration.hpp. I did not independently run the reported tests or verify PS5 ABI behavior, reduced-data behavior on console, or any other platform/toolchain.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988454788 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24020#pullrequestreview-5988454788). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T06:29:49Z. **Review:** APPROVED --- # Reviewed — looks good The implementation and all six changed files were reviewed at head `633bd44ec2104d09bceacf33b13b83e2fa1139ff`; no concrete defect was found in the code inspected. The author reports five related Windows tests and three checks passed; I did not run them. ## What I ran No commands or tests were run. I read the prepared diff and manifest, all six changed files, and the `HostEnumeration.hpp` and `Enumeration.hpp` context used by the implementation. ## Results | Check | Result | Note | |---|---|---| | Code review | passed | Implementation and tests inspected | | Automated checks | not run | Results in description are author-reported | | Console behavior | not run | No PS5 or title run reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The review bundle listed all six changed files as included, and I read all six: `AvailableLocales.cpp`, `CMakeLists.txt`, `LegacyExports.cpp`, `include/LegacyExports.hpp`, `tests/AvailableLocales.cpp`, and the debt note. I also read `HostEnumeration.hpp` and `Enumeration.hpp`. I did not independently run the reported tests or verify PS5 ABI behavior, reduced-data behavior on console, or any other platform/toolchain. ## To get this to a good state Nothing is required.
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!24020
No description provided.