//
// llvm::ConvertUTF8toWide from 0x5ea2a0 to 0x5ea35c (188 bytes)
//
// 1 xrefs:
// > cocos2d::cc_utf8_to_utf16 @ 0x5ea54a
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall llvm::ConvertUTF8toWide(int a1, const void **a2, void **a3, _DWORD *a4)
{
_WORD *v7; // r3
int v8; // r1
int v9; // r0
unsigned __int8 *v10; // r1
_WORD *v11; // r3
int v12; // r5
unsigned __int8 *v13; // r1
_WORD *v14; // r3
int v15; // r5
unsigned __int8 *v17; // [sp+Ch] [bp-10h] BYREF
_WORD *v18; // [sp+10h] [bp-Ch] BYREF
switch ( a1 )
{
case 1:
v7 = *a2;
v8 = *((_DWORD *)*a2 - 3);
v18 = v7;
if ( !isLegalUTF8String((unsigned __int8 **)&v18, (unsigned __int8 *)v7 + v8) )
{
v9 = 3;
*a4 = v18;
return v9 == 0;
}
memcpy(*a3, *a2, *((_DWORD *)*a2 - 3));
*a3 = (char *)*a3 + *((_DWORD *)*a2 - 3);
LABEL_12:
v9 = 0;
return v9 == 0;
case 2:
v10 = (unsigned __int8 *)*a2;
v11 = *a3;
v12 = *((_DWORD *)v10 - 3);
v17 = v10;
v18 = v11;
v9 = ConvertUTF8toUTF16(&v17, (unsigned int)&v10[v12], &v18, (unsigned int)&v11[2 * v12], 0);
break;
case 4:
v13 = (unsigned __int8 *)*a2;
v14 = *a3;
v15 = *((_DWORD *)v13 - 3);
v17 = v13;
v18 = v14;
v9 = ConvertUTF8toUTF32(&v17, (unsigned int)&v13[v15], (unsigned int **)&v18, (unsigned int)&v14[8 * v15], 0);
break;
default:
goto LABEL_12;
}
if ( v9 )
*a4 = v17;
else
*a3 = v18;
return v9 == 0;
}