//
// cocos2d::CCString::createWithData from 0x1007ab400 to 0x1007ab541 (321 bytes)
//
// 1 xrefs:
// > cocos2d::CCString::createWithContentsOfFile @ 0x1007ab708
//
// 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
//
cocos2d::CCString *__fastcall cocos2d::CCString::createWithData(const unsigned __int8 *a1, unsigned __int64 a2)
{
double v2; // xmm0_8
char *v3; // rax
char *v4; // rbx
size_t v5; // rax
size_t v6; // r14
char *v7; // r15
cocos2d::CCString *v8; // r14
size_t v9; // r12
stl::StringData::Long *p_m_sString; // rdi
__int128 __dst; // [rsp+8h] [rbp-38h] BYREF
void *__p; // [rsp+18h] [rbp-28h]
if ( !a1 )
return nullptr;
v3 = (char *)malloc(a2 + 1);
if ( !v3 )
return nullptr;
v4 = v3;
v3[a2] = 0;
if ( a2 )
memcpy(v3, a1, a2);
v5 = strlen(v4);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v6 = v5;
if ( v5 >= 0x17 )
{
v9 = 26;
if ( (v5 | 7) != 0x17 )
v9 = (v5 | 7) + 1;
v7 = (char *)operator new(v9);
__p = v7;
*(_QWORD *)&__dst = v9 + 1;
*((_QWORD *)&__dst + 1) = v6;
}
else
{
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( !v5 )
goto LABEL_14;
}
memcpy(v7, v4, v6);
LABEL_14:
v7[v6] = 0;
v8 = (cocos2d::CCString *)operator new(0x50u);
cocos2d::CCObject::CCObject((__int64)v8);
v8->__vftable = (cocos2d::CCString_vtbl *)off_100991BE0;
p_m_sString = (stl::StringData::Long *)&v8->m_sString;
if ( (__dst & 1) != 0 )
{
sub_100006B70(p_m_sString, __p, *((unsigned __int64 *)&__dst + 1), v2);
}
else
{
v8->m_sString.m_data.m_long.longStorage = (char *)__p;
*(_OWORD *)&p_m_sString->capacitym1 = __dst;
}
cocos2d::CCObject::autorelease(v8);
if ( (__dst & 1) != 0 )
operator delete(__p);
free(v4);
return v8;
}