feat(libSceCesCs): convert EUC-JP (CP51932) strings through a profile context #5515
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5515"
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 ps54all on 2026-10-13T22:00:04Z.
What
EUC-JP (CP51932) string conversion through a profile context, which Metal Gear Solid 4's game executable imports (it fails to load on
sceCesUtf8StrToMbcsStrwithout it).sceCesUcsProfileInitEucJpCp51932marks the caller's sheet and returns it as the profile.sceCesMbcsUcsContextInitnow keeps the profile pointer in the context (it wrote nothing before).sceCesUtf8StrToMbcsStr,sceCesUcs2StrToMbcsStr,sceCesMbcsStrToUtf8Str,sceCesMbcsStrToUcs2Str, the fourGet*Lenforms, andsceCesEucJpToUcs2. For the EUC-JP profile they convert ASCII and JIS X 0201 half-width katakana (0x8E+0xA1-0xDF↔ U+FF61-U+FF9F). For the existing CP1252/CP1251 profiles they convert every character through the existing tables.NotImplemented): the mapping table is not present. A follow-up can add it; this keeps the change small and every unsupported input loud.Independent of #5425, which builds
libSceCesCs-modulefrom these sources (MGS4 loads the module under that name).Tested
Windows 11, RTX 3080, WinLibs GCC 15.2.0 r7, Release.
guest_cesgains checks: UTF-8 ↔ EUC-JP with half-width katakana, both length queries, UCS-2 ↔ EUC-JP,sceCesEucJpToUcs2, and CP1251 through a context. It also checks the errors: destination too small, null context, truncated SS2, invalid SS2 trail, and a non-BMP code point givingUNASSIGNED_CODE. Passes; without the change it does not link.check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T22:00:49Z.
Progress report (
9a3e2ac→61e10ef)📈 System libraries: 88.34% (+0.01%, +9 implemented, +1 declared functions)
✅ 9 implemented
sceCesMbcsStrGetUcs2LensceCesMbcsStrGetUtf8LensceCesMbcsStrToUcs2StrsceCesMbcsStrToUtf8StrsceCesUcs2StrGetMbcsLensceCesUcs2StrToMbcsStrsceCesUcsProfileInitEucJpCp51932sceCesUtf8StrGetMbcsLensceCesUtf8StrToMbcsStr🆕 1 declared as stubs
sceCesEucJpToUcs2Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:53:37Z.
Checked the build,
guest_ces(passes with the change; without it the test does not link) and the buffer/limit handling of the new conversions; merging after the rebase.Added on your branch:
main.docs/dev/debt/libSceCesCs.md: the merge left the oldsceCesMbcsUcsContextInittext ("nothing is stored", "no conversion through an initialized context exists") appended to the new EUC-JP entry, contradicting it. Removed the stale part, kept the signature source and the CP1251 note.Unverified without hardware: the context layout, stopping at a zero code unit without counting it, and the error codes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T12:35:28Z.
Checked the build,
guest_ces(passes with the change; without it the test does not link) and the buffer/limit handling of the new conversions; merging after the rebase.Added on your branch:
main(conflict indocs/dev/debt/libSceCesCs.mdwith the CP1250 entry; both kept).docs/dev/debt/libSceCesCs.md: removed the oldsceCesMbcsUcsContextInittext ("nothing is stored", "no conversion through an initialized context exists") that contradicted the new EUC-JP entry; kept the signature source and the CP1251 note.Unverified without hardware: the context layout, stopping at a zero code unit without counting it, and the error codes.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-14T16:08:13Z.
Thanks @adriadam10 for the rebase and for cleaning up the old
sceCesMbcsUcsContextInittext. Agreed on the unverified points: the context layout, the stop at a zero code unit and the error codes come from the call sites in Metal Gear Solid 4 (PPSA18194), not from hardware. MGS4 runs through these conversions into gameplay here (discussion #5518).AI-assisted (Claude Code).