mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-30 12:25:49 +00:00
Implement sceCesUcsProfileInitGb18030_2000 and sceCesUcsProfileInitGb18030_2005. Two-byte cells are the CP936 table plus the cells that differ, and four-byte sequences are runs over the BMP and the supplementary planes, generated from ICU's gb-18030-2000.ucm (before ICU-8427) and gb-18030-2005.ucm with ICU's GB 18030 ranges. The GB, MBC and MBCS string conversions accept both profiles and produce four-byte UTF-8 and surrogate pairs for supplementary characters.
14 KiB
14 KiB
libSceCesCs technical debt
Silent stubs
- sceCesMbcsUcsContextInit (libSceCesCs) stores the profile pointer in the first 8 bytes of the caller's context; the console's context layout is not known. It returns the invalid-parameter error for a null context. The signature
int sceCesMbcsUcsContextInit(union* context, const union* mbcsUcsPrf)follows the Orbital IDA type database.sceCesRefersUcsProfileCp1251returns a profile accepted bysceCesSbcToUtf8andsceCesUtf8ToSbconly, with the Windows-1251 table of Microsoft's bestfit1251.txt, where byte 0x98 (unassigned) maps to U+0098 like the unassigned Cp1252 bytes; the console behavior for that byte is not verified - EUC-JP (CP51932) conversions (libSceCesCs):
sceCesUcsProfileInitEucJpCp51932marks the caller's sheet with an 8-byte tag and returns it as the profile.sceCesUtf8StrToMbcsStr,sceCesUcs2StrToMbcsStr,sceCesMbcsStrToUtf8Str,sceCesMbcsStrToUcs2Str, theirGet*Lenforms andsceCesEucJpToUcs2convert ASCII, the JIS X 0201 half-width katakana (0x8E+0xA1-0xDF, U+FF61-U+FF9F) and the two-byte rows0xA1-0xFEfor that profile, and every character for the CP1252 and CP1251 profiles. The two-byte table (JisX0208.hpp, 7336 of 8836 cells) is Microsoft code page 932 read through the standard JIS row/cell to Shift-JIS arithmetic, so it includes NEC row 13 and the NEC-selected IBM rows 89-92 and maps the Microsoft variants (U+FF5E at0xA1C1, U+2225, U+FF0D, U+FFE0-U+FFE2) instead of JIS X 0208's; that the console's CP51932 table equals it is assumed from the Microsoft code page, not measured. A character with several cells encodes to the lowest cell. A well-formed but unassigned cell answersUNASSIGNED_CODE, a trail byte outside0xA1-0xFEINVALID_ENCODE, a cut pairSRC_BUFFER_END; the console's errors for these are not known. Three-byte JIS X 0212 (0x8F) characters convert through a second table (JisX0212.hpp, 6067 of 8836 cells) read from the Unicode consortium's JIS0212.TXT; that the console's CP51932 table equals it is assumed from that mapping, not measured. A well-formed but unassigned three-byte cell answersUNASSIGNED_CODEand a cut tripleSRC_BUFFER_END. A character with cells in both JIS X 0208 and JIS X 0212 encodes to the two-byte form, and one only in JIS X 0212 to the three-byte form. Signatures follow orbital. The string forms stop at the source limit or at a zero code unit, which is neither converted nor counted, and write no terminator;*Lenoutputs count code units consumed and produced. A code point outside the BMP answersUNASSIGNED_CODE. Unverified on hardware. - Shift-JIS (CP932) conversions (libSceCesCs):
sceCesUcsProfileInitSJis1997Cp932marks the caller's sheet with an 8-byte tag and returns it as the profile.sceCesUtf8StrToMbcsStr,sceCesUcs2StrToMbcsStr,sceCesMbcsStrToUtf8Str,sceCesMbcsStrToUcs2Str, and theirGet*Lenforms convert ASCII, JIS X 0201 half-width katakana (0xA1-0xDF, U+FF61-U+FF9F), two-byte Shift-JIS sequences (0x81-0x9Fand0xE0-0xFClead,0x40-0x7Eand0x80-0xFCtrail) mapped to JIS X 0208 row/cell indices against the CP932 table (JisX0208.hpp), and the IBM extensions (0xFA40-0xFC4B, 388 characters) decoded to their corresponding JIS X 0208 code points. The user-defined area (0xF040-0xF9FC, which CP932 maps to Private Use Area U+E000-U+E757) and unassigned lead/trail combinations answerUNASSIGNED_CODE, an invalid lead or trail byteINVALID_ENCODE, a cut sequenceSRC_BUFFER_END. Characters with multiple cells encode to the lowest cell. Signatures follow orbital. Unverified on hardware.
Unknown function info
- Unicode scalar conversions (libSceCesCs) - console error precedence, optional length pointers and length units are unverified. Signatures follow the Orbital type database; names are in the aerolib table pinned by
tools/nid_names.py. Encoding follows Unicode section 3.9. Each call converts one scalar, including zero and U+FEFF, without a terminator or byte-order detection; lengths count bytes for UTF-8 and 16-bit units for UTF-16. Native forms use host byte order (supported hosts are little-endian). Errors follow the existing CES converters, not console measurements, and failure leaves outputs unchanged. No console or title comparison has been run - sceCesEucJpToUtf8 (libSceCesCs) - the scalar conversion's errors and optional length pointers are unverified against the console. Its signature follows the Orbital type database linked above; it uses the existing CP51932 profile and JIS tables, with their mapping and profile-layout assumptions listed above, converts one character (including zero), and writes no terminator. Failure leaves the output and length pointers unchanged
- Shift-JIS and EUC-JP scalar conversions (libSceCesCs) - errors, their precedence and the optional length pointers of
sceCesSJisTo*,sceCesEucJpTo{Utf16,Utf32}*andsceCes{Ucs2,Utf8,Utf16,Utf32}*To{SJis,EucJp}are unverified against the console. Signatures follow the Orbital type database linked above; the CP932 and CP51932 table and profile assumptions above apply. A profile of another encoding answersINVALID_PARAMETER, a surrogate or a value above U+10FFFFINVALID_ENCODE, a code point outside the BMPUNASSIGNED_CODE.sceCesSJisCodeToJisX0208andsceCesJisX0208ToSJisCodedo not check that the cell is assigned; theirINVALID_ENCODEfor rows or cells outside 1-94 andINVALID_DST_BUFFERfor a null output are not console measurements - Strict JIS X 0208 profiles (libSceCesCs) - cell
0x2140and U+FF3C throw: JIS0208.TXT gives U+005C, glibc 2.39 and Python'seuc_jpU+FF3C. InsceCesUcsProfileInitSJis1997X0208, bytes0x5Cand0x7Eand U+005C, U+007E, U+00A5 and U+203E throw: SHIFTJIS.TXT gives JIS X 0201 Roman, CP932 and Python'sshift_jisASCII; the console's is unknown. The table, JIS0208.TXT, is CP932's without rows 13 and 89-92 and with six cells changed, not measured. Per SharpProspero, theX0208Ss2profile adds SS2 katakana andX0208Ss2Ss3SS3 JIS X 0212. Signatures follow Orbital; the conversions above take these profiles with the same errors, a missing SS2 or SS3 answeringINVALID_ENCODEand Shift-JIS leads0xF0-0xFCUNASSIGNED_CODE - UTF-16 and UTF-32 forms of the single-byte and MBCS string conversions (libSceCesCs) - errors, their precedence and the optional length pointers of
sceCesSbcTo{Ucs2,Utf16,Utf32}*,sceCes{Ucs2,Utf16,Utf32}*ToSbc,sceCesMbcsStr{To,Get}{Utf16,Utf32}*andsceCes{Utf16,Utf32}Str{To,Get}Mbcs*are unverified against the console. Signatures follow the Orbital type database linked above. They followsceCesSbcToUtf8,sceCesUtf8ToSbcand the UTF-8 MBCS string forms with the profiles and tables listed above. A surrogate or a value above U+10FFFF answersINVALID_ENCODE, a valid code point no profile mapsUNASSIGNED_CODE. The string forms stop at a zero code unit, write no terminator and count code units - GBK (CP936) and EUC-CN conversions (libSceCesCs) -
sceCesUcsProfileInitGbkCp936andsceCesUcsProfileInitEucCnGb2312mark the caller's sheet with an 8-byte tag; the console's profile layout is not known. Both use one table (Cp936.hpp) read from Microsoft's CP936.TXT; the EUC-CN profile accepts only its0xA1-0xFElead and trail bytes, so it includes the GBK cells inside that range and the CP936 forms of0xA1A4(U+00B7) and0xA1AA(U+2014) instead of GB 2312's. That the console's GB 2312 and CP936 tables equal it is not measured. User-defined areas andsceCesGbUcsProfileSet*are not handled. Errors, their precedence and the length pointers follow the Shift-JIS forms above and are unverified - GB 18030 profiles (libSceCesCs) - the console's tables are not measured, and the sources disagree on 26 sequences. The 2000 profile follows ICU's
gb-18030-2000.ucmat icu-data d9d3a6ed (before ICU-8427), which matches Python's codec:0xA8BCis U+E7C7 and0x8135F437U+1E3F. The 2005 profile followsgb-18030-2005.ucm(91850aec), which swaps those two and maps 24 PUA cells to U+FE10-U+FE19, U+9FB4-U+9FBB and six supplementary ideographs, keeping the PUA code points as encode fallbacks. Two-byte cells are CP936 plus Gb18030.hpp; four-byte runs include ICU'sgb18030Ranges. The inits tag the sheet like GBK's; thesceCesGb*,sceCesMbc*and MBCS string forms accept them. The full mapping is assumed as the default ofsceCesGbUcsProfileSetUdaMappingandSet4ByteCharRange, which throw. Supplementary characters to UCS-2 answerUNASSIGNED_CODE; other errors follow the GBK forms - sceCesRefersUcsProfileCp1250 (libSceCesCs) - returns a profile accepted by
sceCesSbcToUtf8,sceCesUtf8ToSbcand the MBCS context conversions, with the Windows-1250 table of Microsoft's bestfit1250.txt, where the unassigned bytes map to their Latin-1 control characters as the Cp1252 and Cp1251 tables do; the console behavior for those bytes and the whole profile is not verified. PPSA34501 fails to start without this export (qYu6y1E0Qbg) - Generic MBCS character and Shift-JIS code helpers (libSceCesCs) -
sceCesMbcTo*convert one character with any profile the MBCS context accepts, as the per-encoding forms above do.sceCesSJisGetCodeandsceCesSJisPutCoderead and write one raw Shift-JIS code (one byte for ASCII and0xA1-0xDF) without checking that it is assigned.sceCesSJisCodeToJisX0213andsceCesJisX0213ToSJisCodeuse the Shift_JIS-2004 arithmetic of JIS X 0213 annex 1 (plane 2 rows 1, 3-5, 8, 12-15 and 78-94 on leads0xF0-0xFC).sceCesMbcsUcsContextInitCopycopies the stored profile pointer. Signatures follow the Orbital type database linked above; errors, their precedence and the optional size pointers follow the other converters and are unverified against the console - Single-byte profiles (libSceCesCs) - the console's tables for these 27 profiles are not verified. Each returns a profile accepted by
sceCesSbcToUtf8,sceCesUtf8ToSbcand the MBCS context conversions, with bytes 0x00-0x7F unchanged and the high half of a public table: ISO 8859-1, -2, -4, -5, -9, -10, -13, -14, -15 and -16 from unicode.org, code pages 437, 737, 775, 850, 852, 855, 860-863, 865 and 866 from Microsoft's PC tables, KOI8-R and KOI8-U from unicode.org, and 1254, 1256 and 1258 from Microsoft's best-fit tables, whose unassigned bytes map to C1 controls as in Cp1250. Profiles whose public table leaves bytes undefined or maps them to private use still throw - libSceCesCs firmware 3.20 pending exports - 70 symbol names are present in the PS5 3.20 libSceCesCs export list. Their signatures and console behaviour are unverified. The declarations use the existing no-parameter unknown-signature convention solely to resolve imports, and every call throws through
NotImplemented_nid_no_patch. - EUC-KR, UHC and Big5 conversions (libSceCesCs) - the tables, errors and Big5 duplicate choices are assumed, not measured.
sceCesUcsProfileInitEucKr,sceCesUcsProfileInitUhcandsceCesUcsProfileInitBig5Cp950tag the caller's sheet like the EUC-JP profile. The tables are Microsoft's CP949.TXT and CP950.TXT; EUC-KR is CP949 limited to bytes0xA1-0xFE. Bytes below0x80are ASCII; the KS X 1003 profile (sceCes*UcsProfileSetSbcs) is not implemented. User-defined areas (Private Use Area on Windows) answerUNASSIGNED_CODE. Big5 encoding takes the lower of two cells except for U+2550, U+255E, U+2561, U+256A, U+5341 and U+5345, as code page 950 does. The scalar calls to and from UCS-2 and UTF-8/16/32 convert one character as the Shift-JIS and EUC-JP scalar conversions do