Files
AnyPS5/docs/dev/debt/libSceCesCs.md
T
Claude b56801fc19 feat(libSceCesCs): add the code page 858 profile
sceCesRefersUcsProfileCp858 threw. It now returns a single-byte profile
accepted by sceCesSbcToUtf8, sceCesUtf8ToSbc and the MBCS context
conversions. Code page 858 is code page 850 with byte 0xD5 mapped to the
euro sign (U+20AC) instead of U+0131; that is the whole high half of
ICU's ibm-858_P100-1997.ucm. Bytes 0x00-0x7F stay unchanged, as in the
other single-byte profiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FzhWRMauD3ouc8kSxT2NnT
2026-10-26 10:59:59 +00:00

15 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 and, as a payload process on a PS5 (firmware 13.60) did, for a null profile. The signature int sceCesMbcsUcsContextInit(union* context, const union* mbcsUcsPrf) follows the Orbital IDA type database. sceCesRefersUcsProfileCp1251 returns a profile accepted by sceCesSbcToUtf8, sceCesUtf8ToSbc and the MBCS context conversions, with the Windows-1251 table of Microsoft's bestfit1251.txt, except byte 0x98, which is unassigned
  • EUC-JP (CP51932) conversions (libSceCesCs): sceCesUcsProfileInitEucJpCp51932 marks the caller's sheet with an 8-byte tag and returns it as the profile. Decoding follows the console (see the sceCesEucJpToUtf8 entry), with the Microsoft code page 932 table read through the JIS row/cell arithmetic (JisX0208.hpp); the console does not decode or encode JIS X 0212 either way (U+02D8 answered 0x805C0020). Encoding takes the lowest cell of a character. Signatures follow orbital
  • Shift-JIS (CP932) conversions (libSceCesCs): decoding matches a payload process on a PS5 (firmware 13.60) for every two-byte input through sceCesMbcsStrToUcs2Str, in result, lengths and output. sceCesUcsProfileInitSJis1997Cp932 tags the caller's sheet and returns it as the profile. The string conversions decode ASCII, half-width katakana (0xA1-0xDF) and two-byte sequences (0x81-0x9F and 0xE0-0xFC lead, 0x40-0x7E and 0x80-0xFC trail) through the CP932 table (JisX0208.hpp), including the IBM extensions 0xFA40-0xFC4B. The user-defined area 0xF040-0xF9FC and unassigned cells answer UNASSIGNED_CODE, an invalid lead or trail INVALID_ENCODE, a cut sequence SRC_BUFFER_END. Signatures follow orbital

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 and sceCesEucJpToUcs2 (libSceCesCs) with the CP51932 profile follow a payload process on a PS5 (firmware 13.60): every two-byte input and every 0x8F three-byte input gives the console's result, length and output (the test pins a hash of both sweeps). Bytes below 0xA0 other than 0x0E, 0x8E and 0x8F convert to themselves; JIS X 0212 is not decoded, so 0x8F forms return 0x805C0020 in rows X 0212 leaves empty and 0x805C0014 elsewhere; a null profile returns 0x805C0004, and the lengths are cleared first and then set as the console sets them. Their signatures follow the Orbital type database linked above. The console reads any other profile pointer as a sheet, where these return the invalid-parameter error.
  • Shift-JIS and EUC-JP scalar conversions (libSceCesCs) - errors, their precedence and the optional length pointers of sceCesSJisTo*, sceCesEucJpTo{Utf16,Utf32}* and sceCes{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 answers INVALID_PARAMETER, a surrogate or a value above U+10FFFF INVALID_ENCODE, a code point outside the BMP UNASSIGNED_CODE. UTF-8 input is decoded as sceCesUtf8ToSbc decodes it, so overlong forms answer 0x805C0015. sceCesSJisCodeToJisX0208 and sceCesJisX0208ToSJisCode do not check that the cell is assigned; their INVALID_ENCODE for rows or cells outside 1-94 and INVALID_DST_BUFFER for a null output are not console measurements
  • Strict JIS X 0208 profiles (libSceCesCs) - the tables were measured on a PS5 (sceCesMbcToUtf32 and sceCesUtf32ToMbc over every one- and two-byte sequence and every scalar); the errors follow the other JIS profiles, a missing SS2 or SS3 answering INVALID_ENCODE. The table is CP932's without rows 13 and 89-92 and with seven cells changed (0x213D U+2014 and the six of JIS0208.TXT). Cell 0x2140 is U+005C in sceCesUcsProfileInitSJis1997X0208, whose bytes 0x5C and 0x7E are U+00A5 and U+203E, and U+FF3C in the EUC-JP profiles, which keep ASCII and also encode U+00A5 and U+203E as 0xA1EF and 0xA1B1. Per SharpProspero, X0208Ss2 adds SS2 katakana and X0208Ss2Ss3 SS3 JIS X 0212
  • 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}* and sceCes{Utf16,Utf32}Str{To,Get}Mbcs* are unverified against the console. Signatures follow the Orbital type database linked above. They follow sceCesSbcToUtf8, sceCesUtf8ToSbc and the UTF-8 MBCS string forms with the profiles and tables listed above. A surrogate or a value above U+10FFFF answers INVALID_ENCODE, a valid code point no profile maps UNASSIGNED_CODE. The string forms stop at a zero code unit, write no terminator and count code units
  • GBK (CP936) and EUC-CN conversions (libSceCesCs) - sceCesUcsProfileInitGbkCp936 and sceCesUcsProfileInitEucCnGb2312 mark 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 its 0xA1-0xFE lead and trail bytes, so it includes the GBK cells inside that range and the CP936 forms of 0xA1A4 (U+00B7) and 0xA1AA (U+2014) instead of GB 2312's. That the console's GB 2312 and CP936 tables equal it is not measured. User-defined areas and sceCesGbUcsProfileSet* 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.ucm at icu-data d9d3a6ed (before ICU-8427), which matches Python's codec: 0xA8BC is U+E7C7 and 0x8135F437 U+1E3F. The 2005 profile follows gb-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's gb18030Ranges. The inits tag the sheet like GBK's; the sceCesGb*, sceCesMbc* and MBCS string forms accept them. The full mapping is assumed as the default of sceCesGbUcsProfileSetUdaMapping and Set4ByteCharRange, which throw. Supplementary characters to UCS-2 answer UNASSIGNED_CODE; other errors follow the GBK forms
  • sceCesRefersUcsProfileCp1250 (libSceCesCs) - returns a profile accepted by sceCesSbcToUtf8, sceCesUtf8ToSbc and the MBCS context conversions, with the Windows-1250 table of Microsoft's bestfit1250.txt, except bytes 0x81, 0x83, 0x88, 0x90 and 0x98, which are unassigned. PPSA34501 fails to start without this export (qYu6y1E0Qbg)
  • sceCesSbcToUtf8 and sceCesUtf8ToSbc (libSceCesCs) follow a payload process on a PS5 (firmware 13.60): the three tables match the console byte for byte, with Cp1252 bytes 0x81, 0x8D, 0x8F, 0x90 and 0x9D unassigned; a null profile returns 0x805C0004; and the length and output are cleared first, as the console does. sceCesUtf8ToSbc decodes leads up to 0xFD (5- and 6-byte forms), returns 0x805C0015 for overlong forms and surrogates and reports the measured lengths. The console reads any other profile pointer as a table, where these return the invalid-parameter error; which of a null profile and a scalar above U+10FFFF it reports first is not measured
  • MBCS string conversions (libSceCesCs) - sceCesUtf8StrToMbcsStr, sceCesUcs2StrToMbcsStr, sceCesMbcsStrToUtf8Str, sceCesMbcsStrToUcs2Str and their Get*Len forms follow a payload process on a PS5 (firmware 13.60) with the Cp1252 and EUC-JP profiles: the lengths are cleared and a terminator is written first, then the context, the source and the output are checked in that order; a source limit of 0 reads up to the terminating zero; the output keeps room for a terminator; and on an error the characters before it stay converted, terminated and counted. They decode UTF-8 as sceCesUtf8ToSbc does, and a UTF-16 surrogate answers 0x805C0015. The UCS-2 forms and the other profiles were not measured beyond these cases. A zero-filled context converted nothing and returned 0 on the console, where this returns the invalid-parameter error
  • EUC-JP and Shift-JIS encoding (libSceCesCs) with the CP51932 and CP932 profiles gives the result, lengths and bytes a payload process read on a PS5 (firmware 13.60) for every UCS-2 value through sceCesUcs2StrToMbcsStr (the test pins a hash of both sweeps): the JIS forms U+00A2, U+00A3, U+00A5, U+00AC, U+2014, U+2016, U+203E, U+2212 and U+301C encode to the cells of their Microsoft forms, U+FEFF is consumed and writes nothing, EUC-JP writes U+0080-U+009F other than U+008E and U+008F as single bytes and answers UNASSIGNED_CODE for U+000E, and Shift-JIS answers 0x805C0024 for U+0080-U+009F. Decoding those bytes back is unchanged
  • Generic MBCS character and Shift-JIS code helpers (libSceCesCs) - UTF-8/UTF-16 buffer errors and size pointers are unverified. Measured on a PS5: the single-character encoders (sceCesUtf32ToMbc over U+0000-U+110001 per profile, surrogates, a one-byte target) give 0x805C0015 for a surrogate, 0x805C0014 past U+10FFFF, the needed length with DST_BUFFER_END and 0 otherwise; a rejected decoded character (sceCesMbcTo* and each encoding's To{Ucs2,Utf8,Utf16,Utf32}, not sceCesEucJpToUcs2/ToUtf8) stores its length (the bytes before a NUL after the lead, the needed length when truncated, 1 for a bad lead, the sequence for a bad or unassigned trail), a zero UCS-2/UTF-32 character and no UTF-8/UTF-16 units. sceCesMbcTo* and sceCes*ToMbc take any profile the MBCS context accepts. sceCesSJisGetCode/PutCode are unchecked; sceCesSJisCodeToJisX0213 and back use JIS X 0213 annex 1. Signatures follow Orbital
  • Single-byte profiles (libSceCesCs) - the console's tables for these 27 profiles are not verified. Each returns a profile accepted by sceCesSbcToUtf8, sceCesUtf8ToSbc and 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
  • sceCesRefersUcsProfileCp858 (libSceCesCs) - the console's table is not verified. The profile is the Cp850 one with byte 0xD5 mapped to U+20AC instead of U+0131, which is the whole high half of ICU's ibm-858_P100-1997.ucm; bytes 0x00-0x7F stay unchanged as in the other single-byte profiles, not swapped as in IBM's control mapping
  • libSceCesCs firmware 3.20 pending exports - 61 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 errors are assumed; the decode tables and the Big5 duplicate choices were measured on a PS5 (sceCesMbcToUtf32 and each ToUtf8 over every one- and two-byte sequence): UHC and Big5 match, EUC-KR apart from its single bytes. The tables are Microsoft's CP949.TXT, plus 0xA2E8 U+327E from KS X 1001:2002, and CP950.TXT; EUC-KR is CP949 limited to bytes 0xA1-0xFE, below 0x80 ASCII; the KS X 1003 profile is not implemented. User-defined areas answer UNASSIGNED_CODE. Big5 encoding takes the lower of two cells except for U+5341 and U+5345, as a PS5's sceCesUtf32ToMbc does for every scalar (CP950 takes the higher cell of U+2550, U+255E, U+2561 and U+256A; the console does not). The profiles tag the caller's sheet like the EUC-JP profile