//
// cocos2d::cc_utf8_strlen from 0xd8db14 to 0xd8dc1c (264 bytes)
//
// 2 xrefs:
// > cocos2d::extension::CCEditBoxImplAndroid::setText @ 0xd1c9a0
// > ??> @ 0xc9040
//
// 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 13:08:17 +0000
//
__int64 __fastcall cocos2d::cc_utf8_strlen(cocos2d *this, const char *a2)
{
size_t v3; // x0
size_t v4; // x20
unsigned __int64 v5; // x0
char *v6; // x3
__int64 CharacterCountInUTF8String; // x20
__int64 v9; // [xsp+40h] [xbp+40h] BYREF
size_t v10; // [xsp+48h] [xbp+48h]
void *v11; // [xsp+50h] [xbp+50h]
if ( !this )
return 0;
v9 = 0;
v10 = 0;
v11 = nullptr;
v3 = strlen((const char *)this);
v4 = v3;
if ( v3 <= 0x16 )
{
LOBYTE(v9) = 2 * v3;
v6 = (char *)&v9 + 1;
if ( !v3 )
{
BYTE1(v9) = 0;
CharacterCountInUTF8String = cocos2d::getCharacterCountInUTF8String((char *)&v9);
if ( (v9 & 1) == 0 )
return CharacterCountInUTF8String;
LABEL_8:
operator delete(v11);
return CharacterCountInUTF8String;
}
}
else
{
v5 = (v3 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v9 = v5 | 1;
v6 = (char *)operator new(v5);
v11 = v6;
v10 = v4;
}
*((_BYTE *)memcpy(v6, this, v4) + v4) = 0;
CharacterCountInUTF8String = cocos2d::getCharacterCountInUTF8String((char *)&v9);
if ( (v9 & 1) != 0 )
goto LABEL_8;
return CharacterCountInUTF8String;
}