fix(libSceCesCs): map the GB 18030 profiles as the console does #10739

Merged
rooklz merged 1 commit from upstream-pr/10739 into main 2026-10-27 08:14:08 +00:00
rooklz commented 2026-10-24 20:09:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-24T20:09:30Z.


What

The GB 18030 tables followed ICU, and the sources disagree on 26 sequences, so the debt entry called them unmeasured. I measured both profiles on a PS5 with homebrew payloads that load the console's libSceCesCs.sprx: sceCesMbcToUtf32 over every one- and two-byte sequence, every four-byte sequence below 0x8431A530, every 0x81 0x30-led sequence and the supplementary range (sampled, plus its edges), and sceCesUtf32ToMbc over every value from U+0000 to U+110001. On the console:

  • GB18030-2000 matches ICU's gb-18030-2000.ucm in the BMP, as here, but maps no supplementary character: 0x90308130-0xE3329A35 answer 0x805C0020 with length 4, and U+10000 and up do not encode.
  • GB18030-2005 is the 2000 table with 0xA8BC and 0x8135F437 swapped (U+1E3F and U+E7C7), the one difference between the two profiles' sweeps. It keeps the 24 PUA cells that gb-18030-2005.ucm remaps to U+FE10-U+FE19, U+9FB4-U+9FBB and six supplementary ideographs, so those code points take their four-byte forms as in 2000. Above the BMP it maps plane 2 only, U+20000-U+2FFFF (0x95328236-0x9A348431), both ways.

The 2005 profile now uses the 2000 tables with the swap, and Gb18030.hpp drops the 2005 tables. Both profiles' encode and decode sweeps match the console apart from two topics covered elsewhere: the surrogate error code (#9175) and the lengths of rejected characters.

Tested

  • guest_ces_chinese: the per-profile two-byte, four-byte and encode hashes and the supplementary sample hashes are re-pinned (the 2000 BMP hashes are unchanged), the boundary table now expects no supplementary character in 2000 and plane 2 only in 2005, the difference table keeps the swap only, and the scalar, UTF-16 and string checks use U+20000 in 2005 and refusals in 2000. The other guest_ces* tests pass.
  • macOS (Apple clang 21, x86-64): all seven guest_ces* sources pass against this Export.cpp.
  • Hosted Linux runner (verify run on my fork; Ubuntu 24.04, GCC, Release, lavapipe), same tree as head cb534c3d82: every guest_ces* test passes; its one failure, pr_overlap_encoding, fails the same way on main on that runner.
  • check_conventions.py passes. pr_overlap.py reports #9175, #9912, #10056, #10183, #10185, #10186 and #10706 on nearby lines of Export.cpp, the guest_ces* tests or the debt file; none changes the GB 18030 tables (#10706 moves declarations into export headers). Merge order: #10056 carries the commits of #10185 and #10186, which list this PR as a same-line overlap, and it changes the same Chinese test; whichever of this PR and #10056 lands second rebases onto the other and reruns guest_ces_chinese.

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:4998739674 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10739). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-24T20:09:30Z. --- ### What The GB 18030 tables followed ICU, and the sources disagree on 26 sequences, so the debt entry called them unmeasured. I measured both profiles on a PS5 with homebrew payloads that load the console's `libSceCesCs.sprx`: `sceCesMbcToUtf32` over every one- and two-byte sequence, every four-byte sequence below `0x8431A530`, every `0x81 0x30`-led sequence and the supplementary range (sampled, plus its edges), and `sceCesUtf32ToMbc` over every value from U+0000 to U+110001. On the console: - **GB18030-2000** matches ICU's `gb-18030-2000.ucm` in the BMP, as here, but maps no supplementary character: `0x90308130`-`0xE3329A35` answer `0x805C0020` with length 4, and U+10000 and up do not encode. - **GB18030-2005** is the 2000 table with `0xA8BC` and `0x8135F437` swapped (U+1E3F and U+E7C7), the one difference between the two profiles' sweeps. It keeps the 24 PUA cells that `gb-18030-2005.ucm` remaps to U+FE10-U+FE19, U+9FB4-U+9FBB and six supplementary ideographs, so those code points take their four-byte forms as in 2000. Above the BMP it maps plane 2 only, U+20000-U+2FFFF (`0x95328236`-`0x9A348431`), both ways. The 2005 profile now uses the 2000 tables with the swap, and `Gb18030.hpp` drops the 2005 tables. Both profiles' encode and decode sweeps match the console apart from two topics covered elsewhere: the surrogate error code (#9175) and the lengths of rejected characters. ### Tested - `guest_ces_chinese`: the per-profile two-byte, four-byte and encode hashes and the supplementary sample hashes are re-pinned (the 2000 BMP hashes are unchanged), the boundary table now expects no supplementary character in 2000 and plane 2 only in 2005, the difference table keeps the swap only, and the scalar, UTF-16 and string checks use U+20000 in 2005 and refusals in 2000. The other `guest_ces*` tests pass. - macOS (Apple clang 21, x86-64): all seven `guest_ces*` sources pass against this `Export.cpp`. - Hosted Linux runner ([verify run on my fork](https://github.com/rooklz/AnyPS5/actions/runs/40125245444); Ubuntu 24.04, GCC, Release, lavapipe), same tree as head `cb534c3d82`: every `guest_ces*` test passes; its one failure, `pr_overlap_encoding`, fails the same way on `main` on that runner. - `check_conventions.py` passes. `pr_overlap.py` reports #9175, #9912, #10056, #10183, #10185, #10186 and #10706 on nearby lines of `Export.cpp`, the `guest_ces*` tests or the debt file; none changes the GB 18030 tables (#10706 moves declarations into export headers). Merge order: #10056 carries the commits of #10185 and #10186, which list this PR as a same-line overlap, and it changes the same Chinese test; whichever of this PR and #10056 lands second rebases onto the other and reruns `guest_ces_chinese`. ### 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 -->
MarcZX10 commented 2026-10-24 20:10:54 +00:00 (Migrated from github.com)

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

Review: COMMENTED


The console-measured table consolidation and per-profile tests are substantial. The required conventions check is failing because the PR title is the placeholder fix(libSceCesCs). Please update it to identify the behavior (for example, fix(libSceCesCs): map the GB 18030 profiles as the console does) and let the check rerun. I have not approved while that required check is red.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5639775222 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10739#pullrequestreview-5639775222). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T20:10:54Z. **Review:** COMMENTED --- The console-measured table consolidation and per-profile tests are substantial. The required conventions check is failing because the PR title is the placeholder `fix(libSceCesCs)`. Please update it to identify the behavior (for example, `fix(libSceCesCs): map the GB 18030 profiles as the console does`) and let the check rerun. I have not approved while that required check is red.
MarcZX10 commented 2026-10-24 22:17:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T22:17:00Z.

Review: CHANGES_REQUESTED


The hosted conventions check fails on this exact head because the title fix(libSceCesCs) is not Conventional Commits syntax, as reported in my earlier comment. Please rename the PR with a typed scope and description (for example, fix(libSceCesCs): map GB 18030 profiles as measured on PS5) and rerun the conventions check. The merge-order dependency with #10056 also remains to be recorded: it overlaps this PR in the GB18030 tables and Chinese test, and it carries the #10186/#10185 stack. Eligibility, intake, labels and report pass; product test jobs are skipped. I have not run the guest CES test locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640267808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10739#pullrequestreview-5640267808). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T22:17:00Z. **Review:** CHANGES_REQUESTED --- The hosted `conventions` check fails on this exact head because the title `fix(libSceCesCs)` is not Conventional Commits syntax, as reported in my earlier comment. Please rename the PR with a typed scope and description (for example, `fix(libSceCesCs): map GB 18030 profiles as measured on PS5`) and rerun the conventions check. The merge-order dependency with #10056 also remains to be recorded: it overlaps this PR in the GB18030 tables and Chinese test, and it carries the #10186/#10185 stack. Eligibility, intake, labels and report pass; product test jobs are skipped. I have not run the guest CES test locally.
MarcZX10 commented 2026-10-25 02:52:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T02:52:28Z.

Review: COMMENTED


Reviewed updated head 0641e0355a67aac313c30563ffa9fdc569c6caaa. The title now passes conventions, the description records the real overlap/merge order with #10056, and the code and tests reflect the revised 2000/2005 supplementary mappings. The author reports all 14 guest_ces* tests passed on this head after applying it to main; the current hosted run confirms conventions, eligibility, labels, and report, while all product build jobs are skipped. I have not independently run the CES suite or verified the PS5 sweep. I found no new code blocker in the diff, but am leaving this as a comment review rather than treating the author-reported console/test evidence as independently verified.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641241923 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10739#pullrequestreview-5641241923). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T02:52:28Z. **Review:** COMMENTED --- Reviewed updated head `0641e0355a67aac313c30563ffa9fdc569c6caaa`. The title now passes conventions, the description records the real overlap/merge order with #10056, and the code and tests reflect the revised 2000/2005 supplementary mappings. The author reports all 14 `guest_ces*` tests passed on this head after applying it to main; the current hosted run confirms conventions, eligibility, labels, and report, while all product build jobs are skipped. I have not independently run the CES suite or verified the PS5 sweep. I found no new code blocker in the diff, but am leaving this as a comment review rather than treating the author-reported console/test evidence as independently verified.
MarcZX10 commented 2026-10-25 04:23:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T04:23:11Z.

Review: APPROVED


Reviewed exact head 0641e0355a67aac313c30563ffa9fdc569c6caaa. The title now meets the repository convention, and the description records the overlap/order with #10056 and its dependent stack; since either PR can land first and the second rebases, Depends on: none is consistent. The GB18030 table change and revised boundary expectations match the reported console behavior. The author reports all 14 guest_ces* tests passing on this head and provides the PS5 sweep details; I did not independently rerun the CES suite or console measurement. Hosted conventions, eligibility, labels, and report checks pass; product jobs are skipped by workflow policy. No remaining blocker found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641477661 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10739#pullrequestreview-5641477661). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T04:23:11Z. **Review:** APPROVED --- Reviewed exact head `0641e0355a67aac313c30563ffa9fdc569c6caaa`. The title now meets the repository convention, and the description records the overlap/order with #10056 and its dependent stack; since either PR can land first and the second rebases, `Depends on: none` is consistent. The GB18030 table change and revised boundary expectations match the reported console behavior. The author reports all 14 `guest_ces*` tests passing on this head and provides the PS5 sweep details; I did not independently rerun the CES suite or console measurement. Hosted conventions, eligibility, labels, and report checks pass; product jobs are skipped by workflow policy. No remaining blocker found.
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!10739
No description provided.