feat(libSceCesCs): add 27 single-byte code page profiles #8923
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8923"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T06:15:35Z.
What
sceCesRefersUcsProfile*threwnot implementedfor every code page except 1250, 1251 and 1252. 27 more now return a profile, like the existing three.sceCesSbcToUtf8,sceCesUtf8ToSbcand the MBCS context conversions (sceCesMbcsUcsContextInitwithsceCesUtf8StrToMbcsStr,sceCesMbcsStrToUtf8Str,sceCesUcs2StrToMbcsStrand the others) accept these profiles:Iso8859_1,_2,_4,_5,_9,_10,_13,_14,_15,_16Cp437,Cp737,Cp775,Cp850,Cp852,Cp855,Cp860,Cp861,Cp862,Cp863,Cp865,Cp866Koi8R,Koi8UCp1254,Cp1256,Cp1258MBTABLE)const struct* sceCesRefersUcsProfileXxx(void)for all of them, as in the Orbital type database that the library already cites for 1250-1252.main'sCP1250_HIGHis byte for byte theMBTABLEofbestfit1250.txt, and 1254, 1256 and 1258 are taken the same way. Their unassigned bytes map to the C1 control characters, as in the 1250 table.sceCesUtf8ToSbc, MBCS output) is unambiguous, and a character outside the table returnsUNASSIGNED_CODE(0x805C0020) through the existing code.core/libs/prx/libSceCesCs/SingleByte.hpp, generated from those files.Export.cppgets one lookup (sbcHighTable) thatsbcToUnicode,unicodeToSbcandisSbcnow use for 1250, 1251 and the new profiles. 1252 keeps its own path, and the three existing profiles keep their pointers and tables.Ascii,AsciiWithKatakana,Bs4730, the fiveJisX0201*, the twoKsX1003*and the twoGbT1988*). For those, AnyPS5 would have to guess what the console does with the undefined bytes.docs/dev/debt/libSceCesCs.md, and the pending-exports count there drops from 249 to 222.isMbcs,decodeMbcsandencodeMbcsreach the new profiles throughisSbc. Open #8967, #8972, #8976, #8993, #9107 and #9175 also changeExport.cpp,PendingExports.cppor the pending-exports count in the debt file, so whichever merges after this PR recounts that figure. #8804, which overlapped on the include block ofExport.cppand the helpers beforemain()inGuestCes.cpp, was closed in favour of #7884. No open PR implements any of the 27.Tested
Linux: WSL2 Ubuntu 26.04, GCC 15.2.0 (Ubuntu 15.2.0-16ubuntu1), Release. I built
libSceCesCs,guest_ces_testsandguest_ces_module_testsand ranctest -R '^guest_ces(_module)?$':guest_cesandguest_ces_modulepass (2/2) at 0b3f33955, onmainec7eacc62. After the rebase ontomain2c4b116da, at27c3f6ba2, I builtlibsand the sixguest_ces*test targets:ctest -R '^guest_ces'passes 6/6 (guest_ces,guest_ces_module,guest_ces_dbcs,guest_ces_dbcs_module,guest_ces_unicodeandguest_ces_unicode_module).Export.cppandGuestCes.cppcompile without warnings in both builds.guest_ces(andguest_ces_module, the same test against the module build) now runsCheckSingleByteProfiles(). For each of the 27 profiles it checks:sceCesSbcToUtf8, bytes below 0x80 to themselves, and converts back to the same byte withsceCesUtf8ToSbc;UNASSIGNED_CODE;It also checks a KOI8-R string through an MBCS context: "Привет" converts to
F0 D2 C9 D7 C5 D4and back. Onmainthe first new call throwsnot implemented, so the test fails there.tools/check_conventions.py --base origin/mainpasses.tools/progress.py --module libSceCesCsgoes from 38 to 65 done functions out of 287 onmain2c4b116da; the new ones are exactly these 27.Windows: not built. No title was run.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T06:19:27Z.
Review: APPROVED
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.
Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T07:35:19Z.
Windows run of 0b3f339556 merged onto
mainb77bd58806(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-moduleand the fourguest_ces*test executables with no errors or warnings;ctest --repeat until-fail:2onguest_ces,guest_ces_module,guest_ces_unicodeandguest_ces_unicode_module: all pass on both repeats. Not run: the negative control againstmain's library, a title.Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-21T14:20:15Z.
@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,GbT1988and its tilde variant,JisX0201,JisX0201Romanand their tilde variants, from unicode.orgJIS0201.TXTand 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 leaveKsX1003*,AsciiWithKatakanaandJisX0201Katakanathrowing, since their contents are not settled.