//
// cocos2d::CCLabelBMFont::setString from 0x1005d97d0 to 0x1005d9972 (418 bytes)
//
// 2 xrefs:
// > ??> @ 0x10095e018
// > ??> @ 0x100974500
//
// 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
//
void __fastcall cocos2d::CCLabelBMFont::setString(cocos2d::CCLabelBMFont *a1, unsigned __int16 *a2, bool a3)
{
unsigned __int16 *m_sInitialString; // r15
int v6; // r12d
size_t v7; // rdi
unsigned __int16 *v8; // rax
unsigned __int16 *v9; // r13
int v10; // r12d
size_t v11; // rdi
unsigned __int16 *v12; // rax
unsigned __int16 *v13; // r13
cocos2d::CCArray *m_pChildren; // rdi
cocos2d::CCArray *v15; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCObject **arr; // r15
unsigned __int64 v18; // r12
if ( a3 )
{
m_sInitialString = a1->m_sInitialString;
if ( a2 )
{
v6 = cocos2d::cc_wcslen(a2);
v7 = -1;
if ( v6 >= -1 )
v7 = 2LL * (unsigned int)(v6 + 1);
v8 = (unsigned __int16 *)operator new[](v7);
v9 = v8;
if ( v6 > 0 )
memcpy(v8, a2, (unsigned int)(2 * v6));
}
else
{
v9 = (unsigned __int16 *)operator new[](2u);
v6 = 0;
}
v9[v6] = 0;
a1->m_sInitialString = v9;
if ( !m_sInitialString )
goto LABEL_18;
LABEL_17:
operator delete[](m_sInitialString);
goto LABEL_18;
}
m_sInitialString = a1->m_sString;
if ( a2 )
{
v10 = cocos2d::cc_wcslen(a2);
v11 = -1;
if ( v10 >= -1 )
v11 = 2LL * (unsigned int)(v10 + 1);
v12 = (unsigned __int16 *)operator new[](v11);
v13 = v12;
if ( v10 > 0 )
memcpy(v12, a2, (unsigned int)(2 * v10));
}
else
{
v13 = (unsigned __int16 *)operator new[](2u);
v10 = 0;
}
v13[v10] = 0;
a1->m_sString = v13;
if ( m_sInitialString )
goto LABEL_17;
LABEL_18:
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
if ( (unsigned int)sub_100720070(m_pChildren) )
{
v15 = a1->m_pChildren;
if ( v15 )
{
data = v15->data;
if ( data->num )
{
arr = data->arr;
v18 = (unsigned __int64)&arr[data->num - 1];
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))(*arr)->__vftable[4].~CCObject)(*arr, 0);
++arr;
}
while ( (unsigned __int64)arr <= v18 );
}
}
}
}
cocos2d::CCLabelBMFont::createFontChars(a1);
if ( a3 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->updateLabel)(a1);
}