//
// FontObject::parseConfigFile from 0x56a994 to 0x56b17c (2024 bytes)
//
// 2 xrefs:
// > FontObject::initWithConfigFile @ 0x56b184
// > ??> @ 0x2f850
//
// 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 FontObject::parseConfigFile(FontObject *a1, const char *a2, float a3)
{
cocos2d::CCString *v3; // x0
cocos2d::CCArray *CString; // x19
cocos2d::CCArray *v5; // x28
char *v6; // x1
const std::string *v7; // x1
cocos2d::CCObject *v8; // x0
char *v9; // x0
unsigned int *v10; // x1
int v11; // w2
unsigned int v12; // w22
bool v13; // cf
cocos2d::CCArray *v14; // x0
cocos2d::CCString *v15; // x24
char *v16; // x0
_DWORD *v17; // x25
__int64 *v18; // x3
size_t v19; // x2
_DWORD *v20; // x25
__int64 *v21; // x3
size_t v22; // x2
__int64 v23; // x1
void *v24; // x0
_QWORD *v25; // x1
char *v26; // x0
char *v27; // x0
unsigned int *v28; // x1
int v29; // w2
int v30; // w0
int v31; // w2
unsigned int *v32; // x25
int v33; // w0
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
int v38; // w0
unsigned __int64 v39; // x0
cocos2d::CCArray *v40; // x25
char *v41; // x0
char *v42; // x1
const std::string *v43; // x1
cocos2d::CCObject *v44; // x0
char *v45; // x0
unsigned int *v46; // x1
int v47; // w2
cocos2d::CCString *v48; // x0
char *v49; // x0
int v50; // w0
int v51; // w24
cocos2d::CCString *v52; // x0
cocos2d::CCString *v53; // x0
char *v54; // x0
char *v55; // x0
unsigned int *v56; // x1
int v57; // w2
int v58; // w2
unsigned int *v59; // x25
unsigned int *v60; // x1
int v61; // w2
__int64 *v63; // [xsp+68h] [xbp+68h]
int v64; // [xsp+68h] [xbp+68h]
int v65; // [xsp+68h] [xbp+68h]
__int64 *p; // [xsp+70h] [xbp+70h]
int pa; // [xsp+70h] [xbp+70h]
_QWORD *v68; // [xsp+88h] [xbp+88h] BYREF
_QWORD *v69; // [xsp+90h] [xbp+90h] BYREF
__int64 v70; // [xsp+98h] [xbp+98h] BYREF
void *v71; // [xsp+A0h] [xbp+A0h] BYREF
void *v72; // [xsp+A8h] [xbp+A8h] BYREF
const char *v73; // [xsp+B0h] [xbp+B0h] BYREF
v3 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (cocos2d::CCArray *)cocos2d::CCString::getCString(v3);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(CString);
if ( strtok((char *)CString, &byte_F1AB78) )
{
while ( 1 )
{
v6 = strtok(nullptr, &byte_F1AB78);
if ( !v6 )
break;
while ( 1 )
{
sub_D153B8((int)&v73, v6);
v8 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v73, v7);
cocos2d::CCArray::addObject(v5, v8);
v9 = (char *)(v73 - 24);
if ( v73 - 24 == (const char *)&qword_124B6B0 )
break;
if ( &pthread_create )
{
v10 = (unsigned int *)(v73 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v73 - 2);
*((_DWORD *)v73 - 2) = v11 - 1;
}
if ( v11 > 0 )
break;
operator delete(v9);
v6 = strtok(nullptr, &byte_F1AB78);
if ( !v6 )
goto LABEL_9;
}
}
}
LABEL_9:
v12 = 0;
v13 = (unsigned int)cocos2d::CCArray::count(v5) == 0;
v14 = v5;
while ( !v13 )
{
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v14, v12);
sub_D153B8((int)&v68, "chars");
sub_D153B8((int)&v69, "char");
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_D153B8((int)&v70, v16);
sub_D14F84(&v71, &v70, 0, *(v68 - 3));
v17 = v71;
v18 = (__int64 *)((char *)v71 - 24);
v19 = *((_QWORD *)v71 - 3);
if ( v19 != *(v68 - 3) || (p = (__int64 *)((char *)v71 - 24), v30 = memcmp(v71, v68, v19), v18 = p, v30) )
{
if ( v18 == &qword_124B6B0 )
goto LABEL_12;
v31 = 0;
if ( !&pthread_create )
goto LABEL_47;
}
else
{
if ( p == &qword_124B6B0 )
goto LABEL_14;
v31 = 1;
if ( !&pthread_create )
{
LABEL_47:
v33 = *(v17 - 2);
*(v17 - 2) = v33 - 1;
goto LABEL_31;
}
}
v32 = v17 - 2;
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
LABEL_31:
if ( v33 <= 0 )
{
pa = v31;
operator delete(v18);
if ( !pa )
{
LABEL_12:
sub_D14F84(&v72, &v70, 0, *(v69 - 3));
v20 = v72;
v21 = (__int64 *)((char *)v72 - 24);
v22 = *((_QWORD *)v72 - 3);
if ( v22 != *(v69 - 3) || (v63 = (__int64 *)((char *)v72 - 24), v38 = memcmp(v72, v69, v22), v21 = v63, v38) )
{
if ( v21 != &qword_124B6B0 )
{
v58 = 0;
if ( !&pthread_create )
goto LABEL_81;
goto LABEL_72;
}
}
else
{
v39 = (unsigned __int64)&qword_124B6B0;
if ( v63 == &qword_124B6B0 )
goto LABEL_50;
v58 = 1;
if ( !&pthread_create )
{
LABEL_81:
v39 = (unsigned int)*(v20 - 2);
*(v20 - 2) = v39 - 1;
goto LABEL_74;
}
LABEL_72:
v59 = v20 - 2;
do
v39 = __ldaxr(v59);
while ( __stlxr(v39 - 1, v59) );
LABEL_74:
if ( (int)v39 <= 0 )
{
v65 = v58;
operator delete(v21);
if ( v65 )
{
LABEL_50:
v40 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v39);
v41 = (char *)cocos2d::CCString::getCString(v15);
if ( strtok(v41, "=") )
{
while ( 1 )
{
v42 = strtok(nullptr, "=");
if ( !v42 )
break;
while ( 1 )
{
sub_D153B8((int)&v73, v42);
v44 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v73, v43);
cocos2d::CCArray::addObject(v40, v44);
v45 = (char *)(v73 - 24);
if ( v73 - 24 == (const char *)&qword_124B6B0 )
break;
if ( &pthread_create )
{
v46 = (unsigned int *)(v73 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v73 - 2);
*((_DWORD *)v73 - 2) = v47 - 1;
}
if ( v47 > 0 )
break;
operator delete(v45);
v42 = strtok(nullptr, "=");
if ( !v42 )
goto LABEL_58;
}
}
}
LABEL_58:
v48 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v40, 0);
v49 = (char *)cocos2d::CCString::getCString(v48);
sub_D153B8((int)&v72, v49);
v50 = sub_D1641C((int)&v72, " ");
sub_D14F84(&v73, &v72, 0, (int)(*((_QWORD *)v72 - 3) + 1 - v50));
v51 = atoi(v73);
if ( v51 >= 300 )
v51 = 0;
v52 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v40, 3u);
v64 = cocos2d::CCString::intValue(v52);
v53 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v40, 7u);
a1->m_fontWidths.__elems_[v51] = v64 + cocos2d::CCString::intValue(v53);
v54 = (char *)(v73 - 24);
if ( v73 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(v73 - 8);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *((_DWORD *)v73 - 2);
*((_DWORD *)v73 - 2) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v54);
}
v55 = (char *)v72 - 24;
if ( (char *)v72 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)((char *)v72 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v72 - 2);
*((_DWORD *)v72 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v55);
}
}
}
else if ( v58 )
{
goto LABEL_50;
}
}
LABEL_14:
v23 = v70;
v24 = (void *)(v70 - 24);
if ( (__int64 *)(v70 - 24) == &qword_124B6B0 )
goto LABEL_15;
goto LABEL_34;
}
}
else if ( !v31 )
{
goto LABEL_12;
}
v23 = v70;
v24 = (void *)(v70 - 24);
if ( (__int64 *)(v70 - 24) == &qword_124B6B0 )
goto LABEL_15;
LABEL_34:
if ( &pthread_create )
{
v34 = (unsigned int *)(v23 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v35 - 1;
}
if ( v35 > 0 )
{
LABEL_15:
v25 = v69;
v26 = (char *)(v69 - 3);
if ( v69 - 3 != &qword_124B6B0 )
goto LABEL_39;
goto LABEL_16;
}
operator delete(v24);
v25 = v69;
v26 = (char *)(v69 - 3);
if ( v69 - 3 != &qword_124B6B0 )
{
LABEL_39:
if ( &pthread_create )
{
v36 = (unsigned int *)(v25 - 1);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v25 - 2);
*((_DWORD *)v25 - 2) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v26);
}
LABEL_16:
v27 = (char *)(v68 - 3);
if ( v68 - 3 == &qword_124B6B0 )
goto LABEL_17;
if ( &pthread_create )
{
v28 = (unsigned int *)(v68 - 1);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v68 - 2);
*((_DWORD *)v68 - 2) = v29 - 1;
}
if ( v29 > 0 )
{
LABEL_17:
++v12;
}
else
{
++v12;
operator delete(v27);
}
v13 = v12 >= (unsigned int)cocos2d::CCArray::count(v5);
v14 = v5;
}
cocos2d::CCObject::release(v14);
}