Skip to content

feat(libSceCesCs): add 27 single-byte code page profiles - #8923

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
nikowolf123:feat/cescs-sbc-profiles
Oct 23, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
nikowolf123:feat/cescs-sbc-profiles

Conversation

@nikowolf123

@nikowolf123 nikowolf123 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

sceCesRefersUcsProfile* threw not implemented for every code page except 1250, 1251 and 1252. 27 more now return a profile, like the existing three. sceCesSbcToUtf8, sceCesUtf8ToSbc and the MBCS context conversions (sceCesMbcsUcsContextInit with sceCesUtf8StrToMbcsStr, sceCesMbcsStrToUtf8Str, sceCesUcs2StrToMbcsStr and the others) accept these profiles:

Family Profiles Source of the high half (bytes 0x80-0xFF)
ISO 8859 Iso8859_1, _2, _4, _5, _9, _10, _13, _14, _15, _16 unicode.org ISO8859/8859-n.TXT
DOS code pages Cp437, Cp737, Cp775, Cp850, Cp852, Cp855, Cp860, Cp861, Cp862, Cp863, Cp865, Cp866 Microsoft's PC tables, VENDORS/MICSFT/PC/CPnnn.TXT
KOI8 Koi8R, Koi8U VENDORS/MISC/KOI8-R.TXT and KOI8-U.TXT
Windows Cp1254, Cp1256, Cp1258 Microsoft's best-fit tables, bestfitnnnn.txt, byte table (MBTABLE)

Tested

Linux: WSL2 Ubuntu 26.04, GCC 15.2.0 (Ubuntu 15.2.0-16ubuntu1), Release. I built libSceCesCs, guest_ces_tests and guest_ces_module_tests and ran ctest -R '^guest_ces(_module)?$': guest_ces and guest_ces_module pass (2/2) at 0b3f339, on main ec7eacc. After the rebase onto main 2c4b116, at 27c3f6b, I built libs and the six guest_ces* test targets: ctest -R '^guest_ces' passes 6/6 (guest_ces, guest_ces_module, guest_ces_dbcs, guest_ces_dbcs_module, guest_ces_unicode and guest_ces_unicode_module). Export.cpp and GuestCes.cpp compile without warnings in both builds.

guest_ces (and guest_ces_module, the same test against the module build) now runs CheckSingleByteProfiles(). For each of the 27 profiles it checks:

  • that the profile is a non-null pointer, stable across calls, and different from the other 29 profiles;
  • that every byte 1-255 converts with sceCesSbcToUtf8, bytes below 0x80 to themselves, and converts back to the same byte with sceCesUtf8ToSbc;
  • that U+3042 returns UNASSIGNED_CODE;
  • four bytes per table (0x80, 0xA4, 0xC1 and 0xFF) against the code point in the source file.

It also checks a KOI8-R string through an MBCS context: "Привет" converts to F0 D2 C9 D7 C5 D4 and back. On main the first new call throws not implemented, so the test fails there.

tools/check_conventions.py --base origin/main passes. tools/progress.py --module libSceCesCs goes from 38 to 65 done functions out of 287 on main 2c4b116; the new ones are exactly these 27.

Windows: not built. No title was 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
  • 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

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Progress report (316b742 → b8bb173)

📈 System libraries: 45.04% (+0.24%, +27 implemented functions)

✅ 27 implemented
Library Name
libSceCesCs sceCesRefersUcsProfileCp1254
libSceCesCs sceCesRefersUcsProfileCp1256
libSceCesCs sceCesRefersUcsProfileCp1258
libSceCesCs sceCesRefersUcsProfileCp437
libSceCesCs sceCesRefersUcsProfileCp737
libSceCesCs sceCesRefersUcsProfileCp775
libSceCesCs sceCesRefersUcsProfileCp850
libSceCesCs sceCesRefersUcsProfileCp852
libSceCesCs sceCesRefersUcsProfileCp855
libSceCesCs sceCesRefersUcsProfileCp860
libSceCesCs sceCesRefersUcsProfileCp861
libSceCesCs sceCesRefersUcsProfileCp862
libSceCesCs sceCesRefersUcsProfileCp863
libSceCesCs sceCesRefersUcsProfileCp865
libSceCesCs sceCesRefersUcsProfileCp866
libSceCesCs sceCesRefersUcsProfileIso8859_1
libSceCesCs sceCesRefersUcsProfileIso8859_10
libSceCesCs sceCesRefersUcsProfileIso8859_13
libSceCesCs sceCesRefersUcsProfileIso8859_14
libSceCesCs sceCesRefersUcsProfileIso8859_15
libSceCesCs sceCesRefersUcsProfileIso8859_16
libSceCesCs sceCesRefersUcsProfileIso8859_2
libSceCesCs sceCesRefersUcsProfileIso8859_4
libSceCesCs sceCesRefersUcsProfileIso8859_5
libSceCesCs sceCesRefersUcsProfileIso8859_9
libSceCesCs sceCesRefersUcsProfileKoi8R
libSceCesCs sceCesRefersUcsProfileKoi8U

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the profile dispatch and generated tables. I independently compared every high-half entry in all 27 tables against the corresponding Python ISO-8859, CP, and KOI8 codecs (treating undefined CP125x bytes as C1 controls, as documented); all entries matched. The tables remain one-to-one with the ASCII low half. The PR’s focused Linux tests and convention check are author-reported; I did not rerun the guest tests. The current conventions/report checks pass, and I found no duplicate profile implementation.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8967 docs/dev/debt/libSceCesCs.md L14
PR 8972 docs/dev/debt/libSceCesCs.md L14
PR 8976 docs/dev/debt/libSceCesCs.md L14
PR 8993 docs/dev/debt/libSceCesCs.md L14
PR 9107 docs/dev/debt/libSceCesCs.md L14-15
PR 9175 docs/dev/debt/libSceCesCs.md L14
PR 9204 docs/dev/debt/libSceCesCs.md L14
PR 9210 docs/dev/debt/libSceCesCs.md L14
PR 9970 core/libs/prx/libSceCesCs/Export.cpp L62-65, L70-71, L148, L536
docs/dev/debt/libSceCesCs.md L14

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestCes.cpp

@ycbuzi

ycbuzi commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Windows run of 0b3f339 merged onto main b77bd58 (1e27b5f5bd), the build the description lists as not done. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, BUILD_TESTING=ON.

Built libSceCesCs, libSceCesCs-module and the four guest_ces* test executables with no errors or warnings; ctest --repeat until-fail:2 on guest_ces, guest_ces_module, guest_ces_unicode and guest_ces_unicode_module: all pass on both repeats. Not run: the negative control against main's library, a title.

@rooklz

rooklz commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@nikowolf123 nice work on the single-byte profiles. I agree with leaving the pages with undefined bytes alone. Two groups you left out look fully defined to me, though: CP858 (no undefined bytes; ICU ibm-858_P100-1997.ucm), and the 7-bit ISO 646 / JIS X 0201 sets with published tables (Ascii, Bs4730, GbT1988 and its tilde variant, JisX0201, JisX0201Roman and their tilde variants, from unicode.org JIS0201.TXT and the glibc charmaps in icu-data). Are you planning those? If not, I would do them on top of this PR once it lands and leave KsX1003*, AsciiWithKatakana and JisX0201Katakana throwing, since their contents are not settled.

sceCesRefersUcsProfile threw for every code page except 1250, 1251 and
1252. Twenty-seven more now return a profile that sceCesSbcToUtf8,
sceCesUtf8ToSbc and the MBCS context conversions accept: ISO 8859-1,
-2, -4, -5, -9, -10, -13, -14, -15 and -16, code pages 437, 737, 775,
850, 852, 855, 860, 861, 862, 863, 865 and 866, KOI8-R, KOI8-U and
Windows 1254, 1256 and 1258.

SingleByte.hpp holds the high half of each table, taken from the
public mapping files at unicode.org: ISO8859, Microsoft's PC tables,
VENDORS/MISC for KOI8 and Microsoft's best-fit tables for 1254, 1256
and 1258, the same source and derivation as the existing Cp1250 table,
whose high half equals bestfit1250's byte table. Bytes 0x00-0x7F are
unchanged in all of them, and every table maps its 256 bytes to 256
distinct BMP characters. The three existing profiles keep their
tables; one lookup now serves them all.

Profiles whose public table leaves bytes undefined (ISO 8859-3, -6, -7,
-8, -11, code pages 857, 864, 869), maps bytes to private use (874,
1253, 1255, 1257) or has no public table here still throw.

guest_ces checks that each new profile is a distinct, stable pointer,
four bytes per table against the source, a round trip of every byte
through sceCesSbcToUtf8 and sceCesUtf8ToSbc, UNASSIGNED_CODE for a
character outside the table, and a KOI8-R string through an MBCS
context in both directions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants