feat(libSceIcu): implement uloc_getCharacterOrientation #23784

Open
HanuBabbar wants to merge 0 commits from upstream-pr/23784 into main
HanuBabbar commented 2026-11-19 16:38:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by HanuBabbar on 2026-11-19T16:38:34Z.


What

  • Implements uloc_getCharacterOrientation in core/libs/prx/libSceIcu/RightToLeft.cpp and removes its NotImplemented_nid_no_patch stub from Export.cpp.
  • Declares ULayoutType and uloc_getCharacterOrientation in core/libs/prx/libSceIcu/include/InventoryExports.hpp.
  • Resolves explicit 4-letter script tags via u_getPropertyValueEnum(UCHAR_SCRIPT, ...) / uscript_isRightToLeft(...), maps canonical RTL language codes without an explicit script to ULOC_LAYOUT_RTL, and falls back to ULOC_LAYOUT_LTR (matching CLDR root) for other valid locales.
  • Returns ULOC_LAYOUT_UNKNOWN without mutating *status when status == nullptr, U_FAILURE(*status), or locale parsing fails.
  • Leaves uloc_isRightToLeft and its existing tests unchanged.
  • Adds unit tests for uloc_getCharacterOrientation in core/libs/prx/libSceIcu/tests/RightToLeft.cpp.
  • Adds the technical debt fragment docs/dev/debt/changes/feat-icu-character-orientation.md.

Tested

  • Windows (MinGW + Ninja): built libSceIcu.prx and guest_icu_right_to_left_tests.exe; ctest --test-dir build -R guest_icu_right_to_left -V passed (1/1).
  • PrivacyOnion's build and ctest of guest_icu_right_to_left passed.
  • python tools/check_conventions.py --base upstream/main — passed.
  • python tools/debt_fold.py --check — passed.
  • python tools/pr_overlap.py --branch HEAD — no overlap.

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:5398997389 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23784). Originally posted by [HanuBabbar](https://github.com/HanuBabbar) on 2026-11-19T16:38:34Z. --- ### What - Implements `uloc_getCharacterOrientation` in `core/libs/prx/libSceIcu/RightToLeft.cpp` and removes its `NotImplemented_nid_no_patch` stub from `Export.cpp`. - Declares `ULayoutType` and `uloc_getCharacterOrientation` in `core/libs/prx/libSceIcu/include/InventoryExports.hpp`. - Resolves explicit 4-letter script tags via `u_getPropertyValueEnum(UCHAR_SCRIPT, ...)` / `uscript_isRightToLeft(...)`, maps canonical RTL language codes without an explicit script to `ULOC_LAYOUT_RTL`, and falls back to `ULOC_LAYOUT_LTR` (matching CLDR `root`) for other valid locales. - Returns `ULOC_LAYOUT_UNKNOWN` without mutating `*status` when `status == nullptr`, `U_FAILURE(*status)`, or locale parsing fails. - Leaves `uloc_isRightToLeft` and its existing tests unchanged. - Adds unit tests for `uloc_getCharacterOrientation` in `core/libs/prx/libSceIcu/tests/RightToLeft.cpp`. - Adds the technical debt fragment `docs/dev/debt/changes/feat-icu-character-orientation.md`. ### Tested - Windows (MinGW + Ninja): built `libSceIcu.prx` and `guest_icu_right_to_left_tests.exe`; `ctest --test-dir build -R guest_icu_right_to_left -V` passed (1/1). - PrivacyOnion's build and `ctest` of `guest_icu_right_to_left` passed. - `python tools/check_conventions.py --base upstream/main` — passed. - `python tools/debt_fold.py --check` — passed. - `python tools/pr_overlap.py --branch HEAD` — no overlap. ### Checklist - [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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-19 16:45:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T16:45:28Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 67000c0db5:

  • Conventions: tools/check_conventions.py failed.
    (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template
    (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template
    (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template
    3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: guest_icu_right_to_left_tests built cleanly.
  • CTest (guest_icu_right_to_left):
    1/1 Test #3983: guest_icu_right_to_left ..........   Passed    0.14 sec
    100% tests passed, 0 tests failed out of 1
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5979360793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23784#pullrequestreview-5979360793). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T16:45:28Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `67000c0db5`: - **Conventions**: `tools/check_conventions.py` failed. ``` (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template 3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `guest_icu_right_to_left_tests` built cleanly. - **CTest** (`guest_icu_right_to_left`): ``` 1/1 Test #3983: guest_icu_right_to_left .......... Passed 0.14 sec 100% tests passed, 0 tests failed out of 1 ``` Requesting changes for the points above.
PrivacyOnion commented 2026-11-20 05:26:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T05:26:17Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_right_to_left_tests built cleanly.
  • CTest (guest_icu_right_to_left):
    1/1 Test #4016: guest_icu_right_to_left ..........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceIcu/Export.cpp, core/libs/prx/libSceIcu/RightToLeft.cpp, core/libs/prx/libSceIcu/include/InventoryExports.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified null/failure status handling in uloc_getCharacterOrientation (core/libs/prx/libSceIcu/RightToLeft.cpp:141): returns ULOC_LAYOUT_UNKNOWN without dereferencing null or modifying existing failure codes
    • Verified null/default locale handling (core/libs/prx/libSceIcu/RightToLeft.cpp:142): correctly falls back to Icu::DefaultLocaleName() when localeId is null
    • Verified subtag parser error handling (core/libs/prx/libSceIcu/RightToLeft.cpp:144): returns ULOC_LAYOUT_UNKNOWN if LanguageAndScript reports parsing failure, matching the debt fragment specification
    • Verified script-based orientation resolution via u_getPropertyValueEnum and uscript_isRightToLeft (core/libs/prx/libSceIcu/RightToLeft.cpp:145-148), with fallback to canonical RTL language table and LTR default matching CLDR root
    • Verified AGENTS.md conventions: no comments added, debt fragment added under docs/dev/debt/changes/feat-icu-character-orientation.md removing pMLs993oHk0, and unit tests cover all paths without modifying main-line uloc_isRightToLeft

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5987960353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23784#pullrequestreview-5987960353). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T05:26:17Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `cc34cfed4c`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_right_to_left_tests` built cleanly. - **CTest** (`guest_icu_right_to_left`): ``` 1/1 Test #4016: guest_icu_right_to_left .......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceIcu/Export.cpp`, `core/libs/prx/libSceIcu/RightToLeft.cpp`, `core/libs/prx/libSceIcu/include/InventoryExports.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified null/failure status handling in uloc_getCharacterOrientation (core/libs/prx/libSceIcu/RightToLeft.cpp:141): returns ULOC_LAYOUT_UNKNOWN without dereferencing null or modifying existing failure codes - Verified null/default locale handling (core/libs/prx/libSceIcu/RightToLeft.cpp:142): correctly falls back to Icu::DefaultLocaleName() when localeId is null - Verified subtag parser error handling (core/libs/prx/libSceIcu/RightToLeft.cpp:144): returns ULOC_LAYOUT_UNKNOWN if LanguageAndScript reports parsing failure, matching the debt fragment specification - Verified script-based orientation resolution via u_getPropertyValueEnum and uscript_isRightToLeft (core/libs/prx/libSceIcu/RightToLeft.cpp:145-148), with fallback to canonical RTL language table and LTR default matching CLDR root - Verified AGENTS.md conventions: no comments added, debt fragment added under docs/dev/debt/changes/feat-icu-character-orientation.md removing pMLs993oHk0, and unit tests cover all paths without modifying main-line uloc_isRightToLeft Looks Good To Me
MarcZX10 commented 2026-11-20 05:52:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T05:52:24Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the reviewed implementation and tests support merging.

What I ran

Reviewed head cc34cfed4c9d8aefecdad7ef9c06cde025e0f45d using repo_read.py. No build or tests were run in this review; test results in the PR description are author-reported.

Results

Check Result Note
Changed code review passed All five changed files read
Build and tests not run Author reports Windows and CI runs

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests or build were run during this review. Console behavior is unverified. All changed files listed in review/manifest.json were read; no files were excluded by rule.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988156908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23784#pullrequestreview-5988156908). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T05:52:24Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the reviewed implementation and tests support merging. ## What I ran Reviewed head `cc34cfed4c9d8aefecdad7ef9c06cde025e0f45d` using `repo_read.py`. No build or tests were run in this review; test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All five changed files read | | Build and tests | not run | Author reports Windows and CI runs | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No tests or build were run during this review. Console behavior is unverified. All changed files listed in `review/manifest.json` were read; no files were excluded by rule. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-25 14:08:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T14:08:43Z.

Review: APPROVED


Reviewed — looks good

The implementation and all five changed files were reviewed at head 0582a4514ae5f5da6a7d20c514af7a59b24dc90a; no blocking defects were found.

What I ran

  • Read the prepared description, commit list, manifest, and complete diff; read the full text of all five changed files through repo_read.py.
  • No commands or tests were run in this review.

Results

Check Result Note
Source review passed All five changed files read
Build and tests not run Author reports builds and tests passed
Convention and debt checks not run Author reports both passed

Findings

Blocking

None.

Non-blocking

None.

Not verified

Console behavior is explicitly unverified in the debt entry. Build, tests, convention checks, and debt checks were not independently run; their reported results come from the PR description. No files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6059129723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23784#pullrequestreview-6059129723). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T14:08:43Z. **Review:** APPROVED --- # Reviewed — looks good The implementation and all five changed files were reviewed at head `0582a4514ae5f5da6a7d20c514af7a59b24dc90a`; no blocking defects were found. ## What I ran - Read the prepared description, commit list, manifest, and complete diff; read the full text of all five changed files through `repo_read.py`. - No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | All five changed files read | | Build and tests | not run | Author reports builds and tests passed | | Convention and debt checks | not run | Author reports both passed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Console behavior is explicitly unverified in the debt entry. Build, tests, convention checks, and debt checks were not independently run; their reported results come from the PR description. No files were excluded by the manifest. ## To get this to a good state Nothing is required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/23784:upstream-pr/23784'
git switch 'upstream-pr/23784'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/23784'
git switch 'upstream-pr/23784'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/23784'
git switch 'upstream-pr/23784'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/23784'
git switch 'main'
git merge --squash 'upstream-pr/23784'
git switch 'main'
git merge --ff-only 'upstream-pr/23784'
git switch 'main'
git merge 'upstream-pr/23784'
git push origin 'main'
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!23784
No description provided.