diff --git a/Core/HLE/sceCcc.cpp b/Core/HLE/sceCcc.cpp index 0763756f97..61cbc17e18 100644 --- a/Core/HLE/sceCcc.cpp +++ b/Core/HLE/sceCcc.cpp @@ -289,7 +289,7 @@ int sceCccStrlenSJIS(u32 strAddr) return ShiftJIS(str).length(); } -int sceCccEncodeUTF8(u32 dstAddrAddr, u32 ucs) +u32 sceCccEncodeUTF8(u32 dstAddrAddr, u32 ucs) { PSPPointer dstp; dstp = dstAddrAddr; @@ -304,7 +304,7 @@ int sceCccEncodeUTF8(u32 dstAddrAddr, u32 ucs) return dstp->ptr; } -int sceCccEncodeUTF16(u32 dstAddrAddr, u32 ucs) +void sceCccEncodeUTF16(u32 dstAddrAddr, u32 ucs) { PSPPointer dstp; dstp = dstAddrAddr; @@ -312,14 +312,16 @@ int sceCccEncodeUTF16(u32 dstAddrAddr, u32 ucs) if (!dstp.IsValid() || !dstp->IsValid()) { ERROR_LOG(HLE, "sceCccEncodeUTF16(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs); - return 0; + return; } DEBUG_LOG(HLE, "sceCccEncodeUTF16(%08x, U+%04x)", dstAddrAddr, ucs); + // Anything above 0x10FFFF is unencodable, and 0xD800 - 0xDFFF are reserved for surrogate pairs. + if (ucs > 0x10FFFF || (ucs & 0xD800) == 0xD800) + ucs = errorUTF16; *dstp += UTF16LE::encode(*dstp, ucs); - return dstp->ptr; } -int sceCccEncodeSJIS(u32 dstAddrAddr, u32 jis) +u32 sceCccEncodeSJIS(u32 dstAddrAddr, u32 jis) { PSPPointer dstp; dstp = dstAddrAddr; @@ -498,9 +500,9 @@ const HLEFunction sceCcc[] = {0xb7d3c112, WrapI_U, "sceCccStrlenUTF8"}, {0x4BDEB2A8, WrapI_U, "sceCccStrlenUTF16"}, {0xd9392ccb, WrapI_U, "sceCccStrlenSJIS"}, - {0x92C05851, WrapI_UU, "sceCccEncodeUTF8"}, - {0x8406F469, WrapI_UU, "sceCccEncodeUTF16"}, - {0x068c4320, WrapI_UU, "sceCccEncodeSJIS"}, + {0x92C05851, WrapU_UU, "sceCccEncodeUTF8"}, + {0x8406F469, WrapV_UU, "sceCccEncodeUTF16"}, + {0x068c4320, WrapU_UU, "sceCccEncodeSJIS"}, {0xc6a8bee2, WrapI_U, "sceCccDecodeUTF8"}, {0xe0cf8091, WrapI_U, "sceCccDecodeUTF16"}, {0x953e6c10, WrapI_U, "sceCccDecodeSJIS"}, diff --git a/native b/native index 7421e1de67..dd99cfbbe8 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 7421e1de67fd97918c6f0da83fc84a9679ef3464 +Subproject commit dd99cfbbe808a62528cfb2f51864ad596812c1f6