Repository navigation
feat(libSceCesCs): add 27 single-byte code page profiles - #8923
Conversation
Progress report (316b742 → b8bb173)📈 System libraries: 45.04% (+0.24%, +27 implemented functions) ✅ 27 implemented
|
MarcZX10
left a comment
There was a problem hiding this comment.
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.
|
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.
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.
|
|
Windows run of 0b3f339 merged onto Built |
|
@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 |
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>
0b3f339 to
27c3f6b
Compare
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 feat(libSceCesCs): implement Shift-JIS and EUC-JP scalar conversions #8967, feat(libSceCesCs): add UTF-16 and UTF-32 forms of the SBC and MBCS string conversions #8972, feat(libSceCesCs): convert GBK and EUC-CN through the CP936 table #8976, feat(libSceCesCs): implement generic MBCS character, Shift-JIS code and JIS X 0213 helpers #8993, feat(libSceCesCs): implement the EUC-KR, UHC and Big5 scalar conversions #9107 and feat(libSceCesCs): encode UCS-2, UTF-8, UTF-16 and UTF-32 characters into any MBCS profile #9175 also changeExport.cpp,PendingExports.cppor the pending-exports count in the debt file, so whichever merges after this PR recounts that figure. feat(libSceCesCs): implement EUC-KR, UHC and Big5 to UTF-8 conversions #8804, which overlapped on the include block ofExport.cppand the helpers beforemain()inGuestCes.cpp, was closed in favour of feat(libSceCesCs): convert EUC-KR, UHC and Big5 through the CP949 and CP950 tables #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 0b3f339, onmainec7eacc. After the rebase ontomain2c4b116, at 27c3f6b, 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 onmain2c4b116; 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