//
// cocos2d::cc_utf8_to_utf16 from 0x100242170 to 0x100242258 (232 bytes)
//
// 2 xrefs:
// > TextGameObject::updateTextObject @ 0x1003021ec
// > cocos2d::CCLabelBMFont::setString_1 @ 0x100398758
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:01:24 +0000
//
_WORD *__fastcall cocos2d::cc_utf8_to_utf16(char *__s, _DWORD *a2)
{
signed __int64 v3; // x23
size_t v4; // x0
_WORD *v5; // x20
__int64 v6; // x8
__int64 v9; // [xsp+8h] [xbp-58h] BYREF
void *v10; // [xsp+10h] [xbp-50h] BYREF
void *__p[2]; // [xsp+18h] [xbp-48h] BYREF
unsigned __int8 v12; // [xsp+2Fh] [xbp-31h]
if ( !__s )
return nullptr;
sub_100009900(__p, __s);
if ( (v12 & 0x80u) == 0 )
v3 = v12;
else
v3 = (signed __int64)__p[1];
if ( v3 + 1 < 0 )
v4 = -1;
else
v4 = 2 * (v3 + 1);
v5 = operator new[](v4);
bzero(v5, 2 * (v3 + 1));
v10 = v5;
if ( v3 && !sub_100241CD0(2, (unsigned __int8 *)__p, &v10, &v9) )
{
operator delete[](v5);
v5 = nullptr;
}
else if ( a2 )
{
LODWORD(v6) = (unsigned __int16)*v5;
if ( *v5 )
{
v6 = 0;
while ( v5[++v6] )
;
}
*a2 = v6;
}
if ( (char)v12 < 0 )
operator delete(__p[0]);
return v5;
}