Exemple #1
0
int sceCccSJIStoUTF16(u32 dstAddr, int dstSize, u32 srcAddr)
{
	PSPCharPointer src;
	PSPWCharPointer dst;
	dst = dstAddr;
	src = srcAddr;

	if (!dst.IsValid() || !src.IsValid())
	{
		ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
		return 0;
	}
	if (!jis2ucsTable.IsValid())
	{
		ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
		return 0;
	}

	DEBUG_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
	ShiftJIS sjis(src);
	int n = 0;
	while (u32 c = sjis.next())
	{
		dst += UTF16LE::encode(dst, __CccJIStoUCS(c, errorUTF16));
		n++;
	}
	return n;
}
Exemple #2
0
int sceCccSJIStoUTF16(u32 dstAddr, u32 dstSize, u32 srcAddr)
{
	const auto src = PSPConstCharPointer::Create(srcAddr);
	auto dst = PSPWCharPointer::Create(dstAddr);
	if (!dst.IsValid() || !src.IsValid())
	{
		ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
		return 0;
	}
	if (!jis2ucsTable.IsValid())
	{
		ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
		return 0;
	}

	const auto dstEnd = PSPWCharPointer::Create(dstAddr + (dstSize & ~1));

	DEBUG_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
	ShiftJIS sjis(src);
	int n = 0;
	while (u32 c = sjis.next())
	{
		if (dst + UTF16LE::encodeUnits(c) >= dstEnd)
			break;
		dst += UTF16LE::encode(dst, __CccJIStoUCS(c, errorUTF16));
		n++;
	}

	if (dst < dstEnd)
		*dst++ = 0;

	CBreakPoints::ExecMemCheck(srcAddr, false, sjis.byteIndex(), currentMIPS->pc);
	CBreakPoints::ExecMemCheck(dstAddr, true, dst.ptr - dstAddr, currentMIPS->pc);
	return n;
}
Exemple #3
0
u32 sceCccJIStoUCS(u32 c, u32 alt)
{
	if (jis2ucsTable.IsValid())
	{
		DEBUG_LOG(HLE, "sceCccUCStoJIS(%08x, %08x)", c, alt);
		return __CccJIStoUCS(c, alt);
	}
	else
	{
		ERROR_LOG(HLE, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt);
		return alt;
	}
}