feat(libSceCesCs): select the single-byte set of an MBCS profile and a replacement character for a context #10431

Merged
rooklz merged 3 commits from upstream-pr/10431 into main 2026-11-04 23:17:25 +00:00
rooklz commented 2026-10-24 00:04:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-24T00:04:52Z.


What

Eight libSceCesCs exports that still threw now work: the single-byte-set selectors sceCesSJisUcsProfileSetSbcs, sceCesEucJpUcsProfileSetSbcs, sceCesEucKrUcsProfileSetSbcs, sceCesUhcUcsProfileSetSbcs, sceCesEucCnUcsProfileSetSbcs and sceCesGbUcsProfileSetSbcs, and the context setters sceCesMbcsUcsSetMbcsReplacementCharCode and sceCesMbcsUcsSetMbcsReplacementCharUCode. Signatures follow the Orbital type database: int (union* p, const SceCesSbcsUcsProfile* sbcs) and int (union* context, uint32_t code).

A selector records the chosen single-byte profile in the eighth byte of the sheet's tag: the tags the initialisers write are seven identifying characters and a zero byte, the selectors store a 1-based index into the single-byte profile table in the eighth, validated before use, and re-initialising a sheet clears it. Nothing is written to the sheet beyond the eight bytes the library already wrote, and a sheet copied by value keeps its selection. Family classification uses the seven-byte sheet-tag prefix only for the mutable MBCS sheets whose selector writes that eighth byte; tags whose eighth byte carries identity, the three ISO-2022 profiles and the two JIS 2004 profiles, are matched over all eight bytes, so the RFC 1468, CP50221 and CP50222 profiles stay distinguishable.

The behaviour is measured on a PS5, with a homebrew payload that loads the console's libSceCesCs.sprx and runs each of the six selectors with eight single-byte profiles, decoding 0x00-0x7F and encoding the affected code points after each, plus both replacement setters with valid and invalid values. On the console:

  • A selector accepts ASCII and its region's sets only: Shift-JIS ASCII, JIS X 0201 Roman and JIS X 0201; EUC-JP ASCII and JIS X 0201 Roman; EUC-KR and UHC ASCII and KS X 1003; EUC-CN and GBK ASCII and GB 1988. Any other set, a null sheet or set, or a sheet of another family answers 0x805C0004.
  • The set replaces the profile's single bytes: under JIS X 0201 Roman 0x5C is ¥ and 0x7E overline both ways, U+007E is unassigned, and the JIS profiles encode U+005C as cell 0x2140 (81 5F in Shift-JIS, A1 C0 in EUC-JP); KS X 1003 and GB 1988 work the same way with ₩ at 0x5C and ¥ at 0x24, leaving U+005C and U+0024 unassigned. Shift-JIS loses its katakana half under ASCII and Roman.
  • The replacement setters only validate and store: CharCode answers 0x805C0015 for a value past one lead and trail byte (0x100, 0x10000); CharUCode answers 0x805C0014 past U+10FFFF, 0x805C0015 for a surrogate and 0x805C0020 for a character the profile cannot encode (U+FFFD in every profile measured). The string conversions measured (sceCesUtf8StrToMbcsStr, sceCesMbcsStrToUtf8Str) still answer their errors with a replacement set, so the conversions here no longer use it; earlier heads wrote it in place of the unmappable character.

The console's sheet and context layouts are not known, which is why neither is extended: the selection is kept in the tag's eighth byte and the replacement in a table keyed by the context's address (ContextInit clears it and ContextInitCopy copies it). The GB 18030 profiles with sceCesGbUcsProfileSetSbcs are not measured. sceCesGbUcsProfileSet4ByteCharRange, sceCesGbUcsProfileSetUdaMapping and sceCesIso2022JpUcsProfileSetSbcs keep throwing.

Tested

  • Relinker-only Linux x86-64 build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, GCC 13.3, Release): ctest -j6 passes 542/542, including git diff --check and check_conventions.py --base upstream/main.
  • In a Linux x86-64 container (Ubuntu 24.04, GCC 13.3, Release), each guest_ces* source linked against this Export.cpp exits 0: guest_ces, guest_ces_dbcs, guest_ces_jis2004, guest_ces_iso646, guest_ces_iso2022, guest_ces_mbc, guest_ces_chinese, guest_ces_wide, guest_ces_japanese, guest_ces_unicode, and guest_ces_setters.
  • guest_ces_iso2022 passes the existing RFC 1468, CP50221 and CP50222 cases, including the CP50221 ESC ( I 36 ESC ( B versus CP50222 SO 36 SI ESC ( B Katakana distinction, so the full-width ISO-2022 tag matching is preserved.
  • guest_ces_setters selects the single-byte set on Shift-JIS, EUC-JP, EUC-KR, UHC, EUC-CN, GBK and both GB 18030 variants after the tag byte is written, copies a selected sheet by value and converts through the copy, and re-initialises a copy without affecting the original; it also covers the replacement context and sceCesMbcsUcsContextInitCopy.
  • Hosted runners on the earlier head f49438e9b2 (verify run on my fork): the Windows full build (Server 2025, WinLibs GCC 15.2.0, Release) compiles everything and passes all eighteen guest_ces* tests; the Linux full build (Ubuntu 24.04, GCC, Release, lavapipe) passes every guest_ces* test, its one failure being agc_driver_sgpr_pattern_fill_keys, which main fails on that runner. A rerun on this head follows.
  • pr_overlap.py reports only the shared libSceCesCs files of the other open CesCs PRs.

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:4990810289 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-24T00:04:52Z. --- ### What Eight libSceCesCs exports that still threw now work: the single-byte-set selectors `sceCesSJisUcsProfileSetSbcs`, `sceCesEucJpUcsProfileSetSbcs`, `sceCesEucKrUcsProfileSetSbcs`, `sceCesUhcUcsProfileSetSbcs`, `sceCesEucCnUcsProfileSetSbcs` and `sceCesGbUcsProfileSetSbcs`, and the context setters `sceCesMbcsUcsSetMbcsReplacementCharCode` and `sceCesMbcsUcsSetMbcsReplacementCharUCode`. Signatures follow the [Orbital type database](https://github.com/AlexAltea/orbital/blob/b321fcdbd700cc02da1cb1ad25412781d5ec73c6/tools/ida/db_types.json): `int (union* p, const SceCesSbcsUcsProfile* sbcs)` and `int (union* context, uint32_t code)`. A selector records the chosen single-byte profile in the eighth byte of the sheet's tag: the tags the initialisers write are seven identifying characters and a zero byte, the selectors store a 1-based index into the single-byte profile table in the eighth, validated before use, and re-initialising a sheet clears it. Nothing is written to the sheet beyond the eight bytes the library already wrote, and a sheet copied by value keeps its selection. Family classification uses the seven-byte sheet-tag prefix only for the mutable MBCS sheets whose selector writes that eighth byte; tags whose eighth byte carries identity, the three ISO-2022 profiles and the two JIS 2004 profiles, are matched over all eight bytes, so the RFC 1468, CP50221 and CP50222 profiles stay distinguishable. The behaviour is measured on a PS5, with a homebrew payload that loads the console's `libSceCesCs.sprx` and runs each of the six selectors with eight single-byte profiles, decoding `0x00`-`0x7F` and encoding the affected code points after each, plus both replacement setters with valid and invalid values. On the console: - **A selector accepts ASCII and its region's sets only**: Shift-JIS ASCII, JIS X 0201 Roman and JIS X 0201; EUC-JP ASCII and JIS X 0201 Roman; EUC-KR and UHC ASCII and KS X 1003; EUC-CN and GBK ASCII and GB 1988. Any other set, a null sheet or set, or a sheet of another family answers `0x805C0004`. - **The set replaces the profile's single bytes**: under JIS X 0201 Roman `0x5C` is ¥ and `0x7E` overline both ways, U+007E is unassigned, and the JIS profiles encode U+005C as cell `0x2140` (`81 5F` in Shift-JIS, `A1 C0` in EUC-JP); KS X 1003 and GB 1988 work the same way with ₩ at `0x5C` and ¥ at `0x24`, leaving U+005C and U+0024 unassigned. Shift-JIS loses its katakana half under ASCII and Roman. - **The replacement setters only validate and store**: `CharCode` answers `0x805C0015` for a value past one lead and trail byte (`0x100`, `0x10000`); `CharUCode` answers `0x805C0014` past U+10FFFF, `0x805C0015` for a surrogate and `0x805C0020` for a character the profile cannot encode (U+FFFD in every profile measured). The string conversions measured (`sceCesUtf8StrToMbcsStr`, `sceCesMbcsStrToUtf8Str`) still answer their errors with a replacement set, so the conversions here no longer use it; earlier heads wrote it in place of the unmappable character. The console's sheet and context layouts are not known, which is why neither is extended: the selection is kept in the tag's eighth byte and the replacement in a table keyed by the context's address (`ContextInit` clears it and `ContextInitCopy` copies it). The GB 18030 profiles with `sceCesGbUcsProfileSetSbcs` are not measured. `sceCesGbUcsProfileSet4ByteCharRange`, `sceCesGbUcsProfileSetUdaMapping` and `sceCesIso2022JpUcsProfileSetSbcs` keep throwing. ### Tested - Relinker-only Linux x86-64 build (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`, GCC 13.3, Release): `ctest -j6` passes 542/542, including `git diff --check` and `check_conventions.py --base upstream/main`. - In a Linux x86-64 container (Ubuntu 24.04, GCC 13.3, Release), each `guest_ces*` source linked against this `Export.cpp` exits 0: `guest_ces`, `guest_ces_dbcs`, `guest_ces_jis2004`, `guest_ces_iso646`, `guest_ces_iso2022`, `guest_ces_mbc`, `guest_ces_chinese`, `guest_ces_wide`, `guest_ces_japanese`, `guest_ces_unicode`, and `guest_ces_setters`. - `guest_ces_iso2022` passes the existing RFC 1468, CP50221 and CP50222 cases, including the CP50221 `ESC ( I 36 ESC ( B` versus CP50222 `SO 36 SI ESC ( B` Katakana distinction, so the full-width ISO-2022 tag matching is preserved. - `guest_ces_setters` selects the single-byte set on Shift-JIS, EUC-JP, EUC-KR, UHC, EUC-CN, GBK and both GB 18030 variants after the tag byte is written, copies a selected sheet by value and converts through the copy, and re-initialises a copy without affecting the original; it also covers the replacement context and `sceCesMbcsUcsContextInitCopy`. - Hosted runners on the earlier head `f49438e9b2` ([verify run on my fork](https://github.com/rooklz/AnyPS5/actions/runs/40045223657)): the Windows full build (Server 2025, WinLibs GCC 15.2.0, Release) compiles everything and passes all eighteen `guest_ces*` tests; the Linux full build (Ubuntu 24.04, GCC, Release, lavapipe) passes every `guest_ces*` test, its one failure being `agc_driver_sgpr_pattern_fill_keys`, which `main` fails on that runner. A rerun on this head follows. - `pr_overlap.py` reports only the shared `libSceCesCs` files of the other open CesCs PRs. ### 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 00:14:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T00:14:33Z.

Review: CHANGES_REQUESTED


I found one blocking ABI/memory-safety gap at this head. The profile sheet was previously initialized and consumed through its 8-byte tag, but this change now clears bytes 8–15 in every , reads in , and writes in each . These APIs accept only an opaque pointer, so there is no size argument or validation that the caller supplied 16 bytes. The PR description explicitly says the console sheet layout is unknown; the tests allocate oversized arrays and therefore do not establish that contract. A caller with an 8-byte sheet can now be overwritten by initialization or read out of bounds during conversion. Also, a nonzero unvalidated index in byte 8 can index past at . Please establish the real sheet extent/layout from a primary source or console measurement before using those bytes, and validate the stored index before dereferencing it. Until the sheet ABI is established, these selectors should not mutate or consume speculative trailing storage.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635752373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5635752373). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T00:14:33Z. **Review:** CHANGES_REQUESTED --- I found one blocking ABI/memory-safety gap at this head. The profile sheet was previously initialized and consumed through its 8-byte tag, but this change now clears bytes 8–15 in every , reads in , and writes in each . These APIs accept only an opaque pointer, so there is no size argument or validation that the caller supplied 16 bytes. The PR description explicitly says the console sheet layout is unknown; the tests allocate oversized arrays and therefore do not establish that contract. A caller with an 8-byte sheet can now be overwritten by initialization or read out of bounds during conversion. Also, a nonzero unvalidated index in byte 8 can index past at . Please establish the real sheet extent/layout from a primary source or console measurement before using those bytes, and validate the stored index before dereferencing it. Until the sheet ABI is established, these selectors should not mutate or consume speculative trailing storage.
MarcZX10 commented 2026-10-24 00:14:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T00:14:40Z.

Review: CHANGES_REQUESTED


I found one blocking ABI/memory-safety gap at this head. The profile sheet was previously initialized and consumed through its 8-byte tag, but this change now clears bytes 8–15 in every profile initializer, reads profile byte 8 in sheetSbcs, and writes sheet byte 8 in each single-byte selector. These APIs accept only an opaque pointer, so there is no size argument or validation that the caller supplied 16 bytes. The PR description explicitly says the console sheet layout is unknown; the tests allocate oversized arrays and therefore do not establish that contract. A caller with an 8-byte sheet can now be overwritten by initialization or read out of bounds during conversion. Also, a nonzero unvalidated index in byte 8 can index past the profile table. Please establish the real sheet extent/layout from a primary source or console measurement before using those bytes, and validate the stored index before dereferencing it. Until the sheet ABI is established, these selectors should not mutate or consume speculative trailing storage.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635753068 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5635753068). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T00:14:40Z. **Review:** CHANGES_REQUESTED --- I found one blocking ABI/memory-safety gap at this head. The profile sheet was previously initialized and consumed through its 8-byte tag, but this change now clears bytes 8–15 in every profile initializer, reads profile byte 8 in sheetSbcs, and writes sheet byte 8 in each single-byte selector. These APIs accept only an opaque pointer, so there is no size argument or validation that the caller supplied 16 bytes. The PR description explicitly says the console sheet layout is unknown; the tests allocate oversized arrays and therefore do not establish that contract. A caller with an 8-byte sheet can now be overwritten by initialization or read out of bounds during conversion. Also, a nonzero unvalidated index in byte 8 can index past the profile table. Please establish the real sheet extent/layout from a primary source or console measurement before using those bytes, and validate the stored index before dereferencing it. Until the sheet ABI is established, these selectors should not mutate or consume speculative trailing storage.
MarcZX10 commented 2026-10-24 00:18:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T00:18:44Z.

Review: CHANGES_REQUESTED


The new head removes the out-of-bounds access, which resolves the memory-safety finding from my earlier review. I still cannot approve the selector behavior: the side table makes the selected set depend on the profile sheet's address, and the author confirms in the PR description/debt that copying a sheet by value loses the selection. These are caller-owned profile sheets with value tags; there is no evidence that the console API makes a sheet address-bound or forbids copies. The tests exercise only the original address. This leaves a known, behaviorally significant case unsupported rather than implementing the general function behavior required by CONTRIBUTING.md. Please establish the sheet lifecycle/copy contract from a primary source or console measurement and test it; otherwise keep the selectors fail-fast until that contract is known. The replacement context has an explicit ContextInitCopy path, but the sheet selection does not have an equivalent copy operation.

I reran diff-check and the conventions check at head 61dc88f; both pass. This is a behavior/contract blocker, not a build finding.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635773759 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5635773759). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T00:18:44Z. **Review:** CHANGES_REQUESTED --- The new head removes the out-of-bounds access, which resolves the memory-safety finding from my earlier review. I still cannot approve the selector behavior: the side table makes the selected set depend on the profile sheet's address, and the author confirms in the PR description/debt that copying a sheet by value loses the selection. These are caller-owned profile sheets with value tags; there is no evidence that the console API makes a sheet address-bound or forbids copies. The tests exercise only the original address. This leaves a known, behaviorally significant case unsupported rather than implementing the general function behavior required by CONTRIBUTING.md. Please establish the sheet lifecycle/copy contract from a primary source or console measurement and test it; otherwise keep the selectors fail-fast until that contract is known. The replacement context has an explicit ContextInitCopy path, but the sheet selection does not have an equivalent copy operation. I reran diff-check and the conventions check at head 61dc88f; both pass. This is a behavior/contract blocker, not a build finding.
MarcZX10 commented 2026-10-24 00:27:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T00:27:45Z.

Review: CHANGES_REQUESTED


Thanks for replacing the address-keyed sheet selection with the existing eighth tag byte; that resolves the copy-by-value limitation I raised. I found a regression in the new tag matching that needs correction.

sceCes*UcsProfileSetSbcs writes the profile index to sheet[7], but several consumers still compare all eight tag bytes against a zero-terminated tag. In this head, isEucCn, isGbk, gb18030Tables, isEucKr, isUhc and isBig5 use memcmp(..., sizeof(TAG)). After a selector succeeds, the nonzero byte 7 makes those predicates false. isSheet then stops recognizing the sheet, so sheetSbcs ignores the selected set; for GB18030, gb18030Tables similarly stops recognizing the codec. The EUC-JP and Shift-JIS predicates use the shortened seven-byte hasTag, which is why those do not have this specific issue.

Please make all affected family predicates consistently compare the seven-byte family prefix (while retaining distinct prefixes), and add/adjust assertions showing selected SBCS behavior for EUC-KR, UHC, EUC-CN, GBK and both GB18030 variants after setting the selector. The current GuestCesProfileSetters tests contain those cases, so please also reconcile them with the reported container pass: as written against this head, the full-width comparisons appear to reject the just-mutated tag.

The exact diff-check and current-main conventions check pass. I did not run the product test locally; CMake configuration is blocked here by the unavailable SDL2 package configuration.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635813823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5635813823). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T00:27:45Z. **Review:** CHANGES_REQUESTED --- Thanks for replacing the address-keyed sheet selection with the existing eighth tag byte; that resolves the copy-by-value limitation I raised. I found a regression in the new tag matching that needs correction. `sceCes*UcsProfileSetSbcs` writes the profile index to `sheet[7]`, but several consumers still compare all eight tag bytes against a zero-terminated tag. In this head, `isEucCn`, `isGbk`, `gb18030Tables`, `isEucKr`, `isUhc` and `isBig5` use `memcmp(..., sizeof(TAG))`. After a selector succeeds, the nonzero byte 7 makes those predicates false. `isSheet` then stops recognizing the sheet, so `sheetSbcs` ignores the selected set; for GB18030, `gb18030Tables` similarly stops recognizing the codec. The EUC-JP and Shift-JIS predicates use the shortened seven-byte `hasTag`, which is why those do not have this specific issue. Please make all affected family predicates consistently compare the seven-byte family prefix (while retaining distinct prefixes), and add/adjust assertions showing selected SBCS behavior for EUC-KR, UHC, EUC-CN, GBK and both GB18030 variants after setting the selector. The current `GuestCesProfileSetters` tests contain those cases, so please also reconcile them with the reported container pass: as written against this head, the full-width comparisons appear to reject the just-mutated tag. The exact diff-check and current-main conventions check pass. I did not run the product test locally; CMake configuration is blocked here by the unavailable SDL2 package configuration.
MarcZX10 commented 2026-10-24 00:33:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T00:33:28Z.

Review: APPROVED


Reviewed the current head f49438e9b2b023ec3c771d710760c88d39fa19d0. The earlier copy-by-value and seven-byte family-tag findings are addressed: profile selection is carried in the existing tag byte, all affected codec predicates use the common family matcher, and tests exercise SBCS selection after mutation across EUC-KR, UHC, EUC-CN, GBK and both GB18030 variants. The replacement-context copy path is also covered. I ran git diff --check and the current-main conventions check successfully. Hosted eligibility, conventions, labels, and report pass; product build jobs are skipped by workflow policy. The PR declares its dependency on #10430.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635841379 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5635841379). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T00:33:28Z. **Review:** APPROVED --- Reviewed the current head `f49438e9b2b023ec3c771d710760c88d39fa19d0`. The earlier copy-by-value and seven-byte family-tag findings are addressed: profile selection is carried in the existing tag byte, all affected codec predicates use the common family matcher, and tests exercise SBCS selection after mutation across EUC-KR, UHC, EUC-CN, GBK and both GB18030 variants. The replacement-context copy path is also covered. I ran `git diff --check` and the current-main conventions check successfully. Hosted eligibility, conventions, labels, and report pass; product build jobs are skipped by workflow policy. The PR declares its dependency on #10430.
MarcZX10 commented 2026-10-29 06:14:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:14:00Z.

Review: APPROVED


Re-checked — approved

I rechecked the current head 40b182df7b37ed9abdfa92a51671c46ac69cc021 against my earlier review. The profile-sheet tag logic is unchanged from the previously approved f49438e9b2 implementation; the later changes restack the feature, add the canonical Api.hpp include in the test, update the debt text, and restore the SPIRV gitlink to the current-main value. This preserves the bounds-safe eight-byte tag and copy-by-value selection behavior that resolved my earlier findings.

The author reports the focused selector tests on the feature head, including the GB 18030-2000 case; hosted Windows and conventions/eligibility/label checks pass. Linux product CI is skipped. I did not rerun the console differential or local tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693599812 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5693599812). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T06:14:00Z. **Review:** APPROVED --- ## Re-checked — approved I rechecked the current head `40b182df7b37ed9abdfa92a51671c46ac69cc021` against my earlier review. The profile-sheet tag logic is unchanged from the previously approved `f49438e9b2` implementation; the later changes restack the feature, add the canonical `Api.hpp` include in the test, update the debt text, and restore the SPIRV gitlink to the current-main value. This preserves the bounds-safe eight-byte tag and copy-by-value selection behavior that resolved my earlier findings. The author reports the focused selector tests on the feature head, including the GB 18030-2000 case; hosted Windows and conventions/eligibility/label checks pass. Linux product CI is skipped. I did not rerun the console differential or local tests.
MarcZX10 commented 2026-10-31 22:29:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T22:29:45Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The rebase made the shared profile-tag matcher ignore the byte that distinguishes the three ISO-2022 profiles, so current ISO-2022 behavior is no longer preserved.

What I ran

Reviewed head 2e31923fc981b65eb3920a2391318104de6549b3 against base 1bc97b9527eaf6b56681cd3465bca67b75329161. The local merge preview against current main was clean. Environment: Debian Linux x86_64, Python 3.11.2; I did not compile or build.

python3 /marc/AnyPS5/tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10431
gh pr diff 10431 -R boykopovar/AnyPS5
gh api repos/boykopovar/AnyPS5/contents/core/libs/tests/GuestCesIso2022.cpp?ref=1bc97b9527eaf6b56681cd3465bca67b75329161

I inspected the exact-head diff, the exact-head ISO-2022 tag checks, and the current-base ISO-2022 regression cases. The author's reported guest_ces_setters 2/2 result is separate evidence and does not exercise the ISO-2022 cases below.

Results

Check Result
Diff check Passed.
Repository conventions Passed locally.
Dependency and merge preview Passed; #10430 is satisfied by current base and the preview is clean.
Source review Blocking regression found in profile classification.
ABI audit and test-quality helper Not executable from the extracted PR checkout because these workspace-only helper scripts are absent there; this is a tooling limitation, not a reported PR failure.
Hosted CI library-portability, report, and eligibility passed; Linux and specialized build jobs were skipped; Windows, conventions, and labels were still queued at the last check.
Unedited output — conventions
All conventions checks passed.
Unedited output — merge preview
# PR stack check — fresh

Target: https://github.com/boykopovar/AnyPS5/pull/10431
Target branch tip: `1bc97b9527eaf6b56681cd3465bca67b75329161`
All heads unchanged: **True**
Dependency order: #10431

## Individual merge previews

- PR #10431: **clean** against current base; head `2e31923fc981b65eb3920a2391318104de6549b3`; changed paths: none reported

## Dependency relationships

- #10430 → #10431: **satisfied_by_base**; overlapping changed paths: none

## Limits

Merge previews apply each exact PR head independently to the current base. A dependency head that is absent from its dependent is reported separately from merge conflicts; file overlap is only a signal and does not prove a conflict. This tool does not build, resolve conflicts, publish comments, or update branches.

Negative control

Assertion Change made to code under test Did the test fail?
Existing ISO-2022 CP50221 vs CP50222 profile distinction Not run: exercising the C++ regression cases requires a build; I did not build in this review. The source-level tag collision is shown below. Not exercised locally.

Findings

Blocking

  • The shared tag matcher collapses all ISO-2022 profile tags. At this head, hasTag compares only the first seven bytes. The RFC 1468, CP50221, and CP50222 tags all share those seven bytes (ISO2022) and differ in byte eight. Consequently isIso2022Rfc1468 and iso2022ShiftsKatakana match all three profiles. For example, the existing CP50221 case expects ESC ( I 36 ESC ( B (7 bytes), while CP50222 expects SO 36 SI ESC ( B (6 bytes); the current matcher makes the profiles indistinguishable and breaks the existing profile-specific contract. Keep full-width matching for tags whose last byte carries identity, and use a separate shortened comparison only for mutable MBCS sheet tags.

Non-blocking

None.

Sources

Not verified

  • I did not configure, build, or run the C++ ISO-2022 or setter tests locally.
  • Hosted Linux and specialized build jobs were skipped; Windows was still queued. The author reports the setter tests passed on this head, but that does not verify the ISO-2022 regression cases.

To get this to a good state

Keep ISO-2022 profile identity checks over all eight tag bytes, and limit seven-byte matching to the MBCS profiles whose selector stores data in byte eight. Run guest_ces_iso2022 and guest_ces_setters on the corrected head; I will rerun the same source and CI checks against that head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5725274421 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5725274421). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T22:29:45Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The rebase made the shared profile-tag matcher ignore the byte that distinguishes the three ISO-2022 profiles, so current ISO-2022 behavior is no longer preserved. ## What I ran Reviewed head `2e31923fc981b65eb3920a2391318104de6549b3` against base `1bc97b9527eaf6b56681cd3465bca67b75329161`. The local merge preview against current `main` was clean. Environment: Debian Linux x86_64, Python 3.11.2; I did not compile or build. ```sh python3 /marc/AnyPS5/tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10431 gh pr diff 10431 -R boykopovar/AnyPS5 gh api repos/boykopovar/AnyPS5/contents/core/libs/tests/GuestCesIso2022.cpp?ref=1bc97b9527eaf6b56681cd3465bca67b75329161 ``` I inspected the exact-head diff, the exact-head ISO-2022 tag checks, and the current-base ISO-2022 regression cases. The author's reported `guest_ces_setters` 2/2 result is separate evidence and does not exercise the ISO-2022 cases below. ## Results | Check | Result | |---|---| | Diff check | Passed. | | Repository conventions | Passed locally. | | Dependency and merge preview | Passed; #10430 is satisfied by current base and the preview is clean. | | Source review | Blocking regression found in profile classification. | | ABI audit and test-quality helper | Not executable from the extracted PR checkout because these workspace-only helper scripts are absent there; this is a tooling limitation, not a reported PR failure. | | Hosted CI | `library-portability`, `report`, and `eligibility` passed; Linux and specialized build jobs were skipped; Windows, conventions, and labels were still queued at the last check. | <details><summary>Unedited output — conventions</summary> ```text All conventions checks passed. ``` </details> <details><summary>Unedited output — merge preview</summary> ```text # PR stack check — fresh Target: https://github.com/boykopovar/AnyPS5/pull/10431 Target branch tip: `1bc97b9527eaf6b56681cd3465bca67b75329161` All heads unchanged: **True** Dependency order: #10431 ## Individual merge previews - PR #10431: **clean** against current base; head `2e31923fc981b65eb3920a2391318104de6549b3`; changed paths: none reported ## Dependency relationships - #10430 → #10431: **satisfied_by_base**; overlapping changed paths: none ## Limits Merge previews apply each exact PR head independently to the current base. A dependency head that is absent from its dependent is reported separately from merge conflicts; file overlap is only a signal and does not prove a conflict. This tool does not build, resolve conflicts, publish comments, or update branches. ``` </details> ## Negative control | Assertion | Change made to code under test | Did the test fail? | |---|---|---| | Existing ISO-2022 CP50221 vs CP50222 profile distinction | Not run: exercising the C++ regression cases requires a build; I did not build in this review. The source-level tag collision is shown below. | Not exercised locally. | ## Findings ### Blocking - **The shared tag matcher collapses all ISO-2022 profile tags.** At this head, `hasTag` compares only the first seven bytes. The RFC 1468, CP50221, and CP50222 tags all share those seven bytes (`ISO2022`) and differ in byte eight. Consequently `isIso2022Rfc1468` and `iso2022ShiftsKatakana` match all three profiles. For example, the existing CP50221 case expects `ESC ( I 36 ESC ( B` (7 bytes), while CP50222 expects `SO 36 SI ESC ( B` (6 bytes); the current matcher makes the profiles indistinguishable and breaks the existing profile-specific contract. Keep full-width matching for tags whose last byte carries identity, and use a separate shortened comparison only for mutable MBCS sheet tags. ### Non-blocking None. ## Sources - [Changed `hasTag` comparison at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2e31923fc981b65eb3920a2391318104de6549b3/core/libs/prx/libSceCesCs/Export.cpp#L271-L273) - [Three ISO-2022 tags and their profile checks at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2e31923fc981b65eb3920a2391318104de6549b3/core/libs/prx/libSceCesCs/Export.cpp#L1277-L1303) - [Existing CP50221 Katakana expected output](https://github.com/boykopovar/AnyPS5/blob/1bc97b9527eaf6b56681cd3465bca67b75329161/core/libs/tests/GuestCesIso2022.cpp#L88-L90) - [Existing CP50222 Katakana expected output](https://github.com/boykopovar/AnyPS5/blob/1bc97b9527eaf6b56681cd3465bca67b75329161/core/libs/tests/GuestCesIso2022.cpp#L134-L136) ## Not verified - I did not configure, build, or run the C++ ISO-2022 or setter tests locally. - Hosted Linux and specialized build jobs were skipped; Windows was still queued. The author reports the setter tests passed on this head, but that does not verify the ISO-2022 regression cases. ## To get this to a good state Keep ISO-2022 profile identity checks over all eight tag bytes, and limit seven-byte matching to the MBCS profiles whose selector stores data in byte eight. Run `guest_ces_iso2022` and `guest_ces_setters` on the corrected head; I will rerun the same source and CI checks against that head.
MarcZX10 commented 2026-10-31 22:58:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T22:58:12Z.

Review: APPROVED


Re-checked — new head, looks good

The new head restores the full eight-byte identity check for ISO-2022 tags and confines shortened matching to mutable MBCS sheet tags, resolving the regression from my previous review.

What I ran

Reviewed head dc9605e0c1199b4a60bab42229791972d6e7db6a against current main 7a5d9bf02af636382aec927593b1a5867899ed0f; the merge preview is clean. Environment: Debian Linux x86_64, glibc 2.36, Python 3.11.2, GCC/G++ 12.2.0. I did not build locally.

git diff --check 7a5d9bf02af636382aec927593b1a5867899ed0f..dc9605e0c1199b4a60bab42229791972d6e7db6a
git merge-tree --write-tree 7a5d9bf02af636382aec927593b1a5867899ed0f dc9605e0c1199b4a60bab42229791972d6e7db6a
python3 tools/check_conventions.py --base 7a5d9bf02af636382aec927593b1a5867899ed0f --head dc9605e0c1199b4a60bab42229791972d6e7db6a
python3 tools/pr_abi_audit.py --base 7a5d9bf02af636382aec927593b1a5867899ed0f --head dc9605e0c1199b4a60bab42229791972d6e7db6a
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10431

Results

Check Result
Diff whitespace Passed.
Conventions and PR template Passed locally and in hosted CI.
Current-main merge preview Clean.
ABI lexical audit Passed with no findings; this does not verify binary ABI or runtime version tables.
CMake test registration The setter source is registered through the setters and setters_module variants in the CMake loop. The test-quality helper's literal-path warning is a heuristic false positive because the source path is formed with ${LIBS_INCLUDE_DIR}.
Hosted Windows build and CTest Passed: 2,541 tests, zero failures.
Other hosted product jobs Linux, relinker, ASAN, register-context, and write-watch were skipped.
Precheck bundle Could not run two helper stages from the isolated PR snapshot: those workspace helper scripts are absent there. I ran the ABI audit from the workspace and inspected the CMake registration directly.
Unedited check output

Conventions:

All conventions checks passed.

ABI audit:

ABI audit: passed

Windows CTest:

100% tests passed, 0 tests failed out of 2541
Total Test time (real) = 121.20 sec

Precheck helper availability:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10431-dc9605e0c119/head-dc9605e0c119-b107c0d9/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10431-dc9605e0c119/head-dc9605e0c119-b107c0d9/tools/pr_test_quality.py': [Errno 2] No such file or directory

Negative control

Assertion Change made to code under test Did the new test fail?
Distinguish ISO-2022 RFC 1468, CP50221, and CP50222 profiles No mutation/reversion run locally; the build-dependent tests were not run locally. The hosted Windows test suite passed on the corrected head. Not exercised as a negative control.

Findings

Blocking

None found in the reviewed head.

Non-blocking

Linux and specialized product jobs were skipped by hosted CI; see Not verified.

Sources

Not verified

  • I did not configure, build, or run tests locally.
  • Hosted Linux, relinker, ASAN, register-context, and write-watch jobs were skipped. The author reports Linux relinker-only CTest passing 542/542 on this head; that result was not independently reproduced here.

To get this to a good state

No further change is needed for the reviewed regression. If the head changes, I will rerun these checks against the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5725354853 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10431#pullrequestreview-5725354853). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T22:58:12Z. **Review:** APPROVED --- # Re-checked — new head, looks good The new head restores the full eight-byte identity check for ISO-2022 tags and confines shortened matching to mutable MBCS sheet tags, resolving the regression from my previous review. ## What I ran Reviewed head `dc9605e0c1199b4a60bab42229791972d6e7db6a` against current `main` `7a5d9bf02af636382aec927593b1a5867899ed0f`; the merge preview is clean. Environment: Debian Linux x86_64, glibc 2.36, Python 3.11.2, GCC/G++ 12.2.0. I did not build locally. ```sh git diff --check 7a5d9bf02af636382aec927593b1a5867899ed0f..dc9605e0c1199b4a60bab42229791972d6e7db6a git merge-tree --write-tree 7a5d9bf02af636382aec927593b1a5867899ed0f dc9605e0c1199b4a60bab42229791972d6e7db6a python3 tools/check_conventions.py --base 7a5d9bf02af636382aec927593b1a5867899ed0f --head dc9605e0c1199b4a60bab42229791972d6e7db6a python3 tools/pr_abi_audit.py --base 7a5d9bf02af636382aec927593b1a5867899ed0f --head dc9605e0c1199b4a60bab42229791972d6e7db6a python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10431 ``` ## Results | Check | Result | |---|---| | Diff whitespace | Passed. | | Conventions and PR template | Passed locally and in hosted CI. | | Current-main merge preview | Clean. | | ABI lexical audit | Passed with no findings; this does not verify binary ABI or runtime version tables. | | CMake test registration | The setter source is registered through the `setters` and `setters_module` variants in the CMake loop. The test-quality helper's literal-path warning is a heuristic false positive because the source path is formed with `${LIBS_INCLUDE_DIR}`. | | Hosted Windows build and CTest | Passed: 2,541 tests, zero failures. | | Other hosted product jobs | Linux, relinker, ASAN, register-context, and write-watch were skipped. | | Precheck bundle | Could not run two helper stages from the isolated PR snapshot: those workspace helper scripts are absent there. I ran the ABI audit from the workspace and inspected the CMake registration directly. | <details><summary>Unedited check output</summary> Conventions: ```text All conventions checks passed. ``` ABI audit: ```text ABI audit: passed ``` Windows CTest: ```text 100% tests passed, 0 tests failed out of 2541 Total Test time (real) = 121.20 sec ``` Precheck helper availability: ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10431-dc9605e0c119/head-dc9605e0c119-b107c0d9/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10431-dc9605e0c119/head-dc9605e0c119-b107c0d9/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Negative control | Assertion | Change made to code under test | Did the new test fail? | |---|---|---| | Distinguish ISO-2022 RFC 1468, CP50221, and CP50222 profiles | No mutation/reversion run locally; the build-dependent tests were not run locally. The hosted Windows test suite passed on the corrected head. | Not exercised as a negative control. | ## Findings ### Blocking None found in the reviewed head. ### Non-blocking Linux and specialized product jobs were skipped by hosted CI; see **Not verified**. ## Sources - [Full-width `hasTag` and separate sheet-tag matcher at this head](https://github.com/boykopovar/AnyPS5/blob/dc9605e0c1199b4a60bab42229791972d6e7db6a/core/libs/prx/libSceCesCs/Export.cpp#L271-L278) - [Distinct ISO-2022 profile tags and checks at this head](https://github.com/boykopovar/AnyPS5/blob/dc9605e0c1199b4a60bab42229791972d6e7db6a/core/libs/prx/libSceCesCs/Export.cpp#L1281-L1306) - [Setter test registration through the CMake variant loop](https://github.com/boykopovar/AnyPS5/blob/dc9605e0c1199b4a60bab42229791972d6e7db6a/core/libs/prx/libSceCesCs/CMakeLists.txt#L28-L55) - [ISO-2022 profile-specific test cases](https://github.com/boykopovar/AnyPS5/blob/dc9605e0c1199b4a60bab42229791972d6e7db6a/core/libs/tests/GuestCesIso2022.cpp#L165-L215) - [Hosted Windows build and CTest job](https://github.com/boykopovar/AnyPS5/actions/runs/41248753409/job/124679379425) ## Not verified - I did not configure, build, or run tests locally. - Hosted Linux, relinker, ASAN, register-context, and write-watch jobs were skipped. The author reports Linux relinker-only CTest passing 542/542 on this head; that result was not independently reproduced here. ## To get this to a good state No further change is needed for the reviewed regression. If the head changes, I will rerun these checks against the new head.
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!10431
No description provided.