feat(libSceIcu): implement relative date-time formatting #24447

Closed
MarcZX10 wants to merge 6 commits from upstream-pr/24447 into main
MarcZX10 commented 2026-11-20 16:40:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T16:40:38Z.


What

Implement ICU relative date-time formatter creation, disposal, formatted relative dates, and numeric relative dates by forwarding to the bundled ICU 78.1 C API. Guest status and result memory are handled through the guest-memory helpers; formatting overflow reports the required length and leaves the guest output unchanged. Console ICU 68.2 behavior remains unverified.

Tested

Linux: C++20 syntax check with -Wall -Wextra -Werror against the bundled ICU 78.1 headers; debt-fragment validation and git diff --check; standalone integration harness against system ICU 72.1 covering formatter lifecycle, output, status errors, and buffer overflow. The full AnyPS5 build could not be configured because the installed FreeType 2.12.1 is below the project's required 2.15. The integration harness was not run against bundled ICU 78.1 or a PS5.

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:5416896737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24447). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T16:40:38Z. --- ### What Implement ICU relative date-time formatter creation, disposal, formatted relative dates, and numeric relative dates by forwarding to the bundled ICU 78.1 C API. Guest status and result memory are handled through the guest-memory helpers; formatting overflow reports the required length and leaves the guest output unchanged. Console ICU 68.2 behavior remains unverified. ### Tested Linux: C++20 syntax check with `-Wall -Wextra -Werror` against the bundled ICU 78.1 headers; debt-fragment validation and `git diff --check`; standalone integration harness against system ICU 72.1 covering formatter lifecycle, output, status errors, and buffer overflow. The full AnyPS5 build could not be configured because the installed FreeType 2.12.1 is below the project's required 2.15. The integration harness was not run against bundled ICU 78.1 or a PS5. ### 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-20 16:55:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T16:55:04Z.

Review: CHANGES_REQUESTED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_recovered_signatures_tests failed to build.
    /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_format_78'
    /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_open_78'
    /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_formatNumeric_78'
    /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_close_78'
    collect2: error: ld returned 1 exit status
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5996325002 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24447#pullrequestreview-5996325002). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T16:55:04Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `ac14feba31`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_recovered_signatures_tests` failed to build. ``` /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_format_78' /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_open_78' /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_formatNumeric_78' /usr/bin/ld: core/libs/libs/unpatched/libSceIcu.prx: undefined reference to `ureldatefmt_close_78' collect2: error: ld returned 1 exit status ``` Requesting changes for the points above.
PrivacyOnion commented 2026-11-20 17:34:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T17:34:21Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_recovered_signatures_tests built cleanly.
  • CTest (guest_icu_recovered_signatures):
    1/1 Test #4036: guest_icu_recovered_signatures ...   Passed    0.09 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4036: guest_icu_recovered_signatures ...Subprocess aborted***Exception:   0.42 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified Format preflight handling, error code propagation, and buffer capacity clamping against ICU 78.1 C API semantics
    • core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified guest memory copy-in and copy-out bounds and errno preservation in ReadStatus, WriteStatus, and CopyResult
    • core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified exception safety and resource cleanup in ureldatefmt_open_nid_postfix and Format on GuestCopyOut failures
    • cmake/Icu.cmake: verified common and i18n static library source lists from upstream sources.txt, symbol visibility, and link options
    • core/libs/prx/libSceIcu/tests/RelativeDateTimeFormatter.cpp: verified coverage of open/close, formatting, null pointers, negative capacities, and buffer overflow behavior
    • docs/dev/debt/changes/feat-icu-relative-date-time.md: verified debt fragment formatting and alignment with AGENTS.md rules

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5996859719 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24447#pullrequestreview-5996859719). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T17:34:21Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `f2fb5128b1`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_recovered_signatures_tests` built cleanly. - **CTest** (`guest_icu_recovered_signatures`): ``` 1/1 Test #4036: guest_icu_recovered_signatures ... Passed 0.09 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4036: guest_icu_recovered_signatures ...Subprocess aborted***Exception: 0.42 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified Format preflight handling, error code propagation, and buffer capacity clamping against ICU 78.1 C API semantics - core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified guest memory copy-in and copy-out bounds and errno preservation in ReadStatus, WriteStatus, and CopyResult - core/libs/prx/libSceIcu/RelativeDateTimeFormatter.cpp: verified exception safety and resource cleanup in ureldatefmt_open_nid_postfix and Format on GuestCopyOut failures - cmake/Icu.cmake: verified common and i18n static library source lists from upstream sources.txt, symbol visibility, and link options - core/libs/prx/libSceIcu/tests/RelativeDateTimeFormatter.cpp: verified coverage of open/close, formatting, null pointers, negative capacities, and buffer overflow behavior - docs/dev/debt/changes/feat-icu-relative-date-time.md: verified debt fragment formatting and alignment with AGENTS.md rules Looks Good To Me

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