//
// cocos2d::CCLabelAtlas::initWithString from 0xae1d04 to 0xae2298 (1428 bytes)
//
// 2 xrefs:
// > cocos2d::CCLabelAtlas::create @ 0xae2318
// > ??> @ 0x5b140
//
// 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 cocos2d::CCLabelAtlas::initWithString(cocos2d::CCLabelAtlas *a1, const char *a2, const char *a3)
{
cocos2d::CCFileUtils *v6; // x0
__int64 v7; // x0
__int64 *v8; // x0
char *v9; // x0
CCContentManager *v10; // x0
cocos2d::CCDictionary *v11; // x22
cocos2d::CCString *v12; // x0
char *v13; // x0
cocos2d::CCString *v14; // x0
const char *CString; // x28
size_t v16; // x0
char *v17; // x0
cocos2d::CCString *v18; // x28
cocos2d::CCString *v19; // x0
int v20; // w21
cocos2d::CCDirector *v21; // x0
float ContentScaleFactor; // s0
char *v23; // x0
unsigned int v24; // w21
cocos2d::CCString *v25; // x0
cocos2d::CCDirector *v26; // x0
float v27; // s0
char *v28; // x0
__int64 v29; // x4
cocos2d::CCString *v30; // x0
__int64 v31; // x5
char *v32; // x0
__int64 v33; // x4
const char *v34; // x0
void *v35; // x0
void *v36; // x0
void *v37; // x0
unsigned int *v39; // x2
int v40; // w1
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
_QWORD v57[2]; // [xsp+0h] [xbp+0h] BYREF
unsigned int v58[2]; // [xsp+60h] [xbp+60h]
unsigned int v59[4]; // [xsp+68h] [xbp+68h]
__int64 v60; // [xsp+88h] [xbp+88h] BYREF
__int64 v61; // [xsp+90h] [xbp+90h]
__int64 v62; // [xsp+98h] [xbp+98h] BYREF
const char *v63; // [xsp+A0h] [xbp+A0h] BYREF
v6 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v6->createCCArrayWithContentsOfFile)(
&v60,
v6,
a3,
0);
v7 = sub_D16A88((int)&v60, &word_F2A0A8, -1, 1u);
sub_D14F84(&v63, &v60, 0, v7);
v8 = (__int64 *)sub_D15FD4(&v63, &word_F2A0A8, 1);
v61 = *v8;
*v8 = (__int64)&byte_124B6C8;
v9 = (char *)(v63 - 24);
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v63 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v9);
}
v10 = CCContentManager::sharedManager();
v11 = CCContentManager::addDict(v10, a3, 0);
sub_D153B8((unsigned int)v57 + 160, "version");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey((__int64)v11, &v63);
cocos2d::CCString::intValue(v12);
v13 = (char *)(v63 - 24);
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v63 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v13);
}
sub_D153B8((int)&v63, "textureFilename");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey((__int64)v11, &v63);
CString = cocos2d::CCString::getCString(v14);
sub_D18D28(&v62);
v16 = strlen(CString);
sub_D15FD4(&v62, CString, v16);
v17 = (char *)(v63 - 24);
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v63 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v17);
}
v18 = (cocos2d::CCString *)cocos2d::CCString::create();
sub_D153B8((unsigned int)v57 + 160, "itemWidth");
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey((__int64)v11, &v63);
v20 = cocos2d::CCString::intValue(v19);
v21 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v21);
v23 = (char *)(v63 - 24);
v24 = (unsigned int)(float)((float)v20 / ContentScaleFactor);
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(v63 - 8);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v23);
}
sub_D153B8((unsigned int)v57 + 160, "itemHeight");
v25 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey((__int64)v11, &v63);
*(_QWORD *)v59 = (unsigned int)cocos2d::CCString::intValue(v25);
v26 = cocos2d::CCDirector::sharedDirector();
v27 = cocos2d::CCDirector::getContentScaleFactor(v26);
v28 = (char *)(v63 - 24);
v29 = (unsigned int)(float)((float)(int)v59[0] / v27);
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v63 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v48 - 1;
}
if ( v48 <= 0 )
{
*(_QWORD *)v59 = v29;
operator delete(v28);
v29 = *(_QWORD *)v59;
}
}
*(_QWORD *)v59 = v29;
sub_D153B8((int)&v63, "firstChar");
v30 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey((__int64)v11, &v63);
v31 = (unsigned int)cocos2d::CCString::intValue(v30);
v32 = (char *)(v63 - 24);
v33 = *(_QWORD *)v59;
if ( v63 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v63 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v50 - 1;
}
if ( v50 <= 0 )
{
*(_QWORD *)v58 = v31;
*(_QWORD *)v59 = v33;
operator delete(v32);
v31 = *(_QWORD *)v58;
v33 = *(_QWORD *)v59;
}
}
*(_QWORD *)v58 = v31;
*(_QWORD *)v59 = v33;
v34 = cocos2d::CCString::getCString(v18);
cocos2d::CCLabelAtlas::initWithString(a1, a2, v34, v24, v59[0], v58[0]);
v35 = (void *)(v62 - 24);
if ( (__int64 *)(v62 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(v62 - 8);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(v62 - 8);
*(_DWORD *)(v62 - 8) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v35);
}
v36 = (void *)(v61 - 24);
if ( (__int64 *)(v61 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(v61 - 8);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *(_DWORD *)(v61 - 8);
*(_DWORD *)(v61 - 8) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v36);
}
v37 = (void *)(v60 - 24);
if ( (__int64 *)(v60 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(v60 - 8);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(v60 - 8);
*(_DWORD *)(v60 - 8) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v37);
}
return 1;
}