//
// FontObject::parseConfigFile from 0x100220330 to 0x100220c5f (2351 bytes)
//
// 3 xrefs:
// > BitmapFontCache::fontWithConfigFile @ 0x100220159
// > FontObject::createWithConfigFile @ 0x1002202f0
// > FontObject::initWithConfigFile @ 0x100220324
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall FontObject::parseConfigFile(FontObject *a1, const char *a2, float a3)
{
cocos2d::CCString *v3; // rdi
char *CString; // rbx
cocos2d::CCObject *v5; // r13
char *v6; // rax
char *v7; // r12
size_t *p_dst; // rbx
size_t v9; // rax
size_t v10; // r13
char *v11; // r14
size_t *v12; // r15
size_t v13; // rbx
__int64 v14; // rax
unsigned int v15; // r14d
char *v16; // rsi
cocos2d::CCString *v17; // rbx
const char *v18; // r12
char *v19; // rdi
size_t v20; // rax
size_t v21; // r15
char *v22; // r14
unsigned int v23; // r12d
size_t v24; // r12
unsigned int v25; // eax
size_t v26; // rax
char *v27; // r15
size_t v28; // r13
char *v29; // r14
unsigned int v30; // r14d
size_t v31; // rdx
unsigned int v32; // eax
bool v33; // r15
size_t v34; // r13
unsigned int v35; // r14d
size_t v36; // r12
unsigned int v37; // eax
size_t v38; // rax
char *v39; // r15
char *v40; // r14
unsigned int v41; // r14d
size_t v42; // rdx
unsigned int v43; // eax
bool v44; // r15
size_t v45; // r13
__int64 v46; // r12
char *v47; // rax
char *v48; // rax
char *v49; // rbx
size_t v50; // rax
size_t v51; // r15
char *v52; // r14
size_t v53; // r13
__int64 v54; // rax
cocos2d::CCString *v55; // rax
const char *v56; // rbx
size_t v57; // rax
size_t v58; // r15
char *v59; // r14
size_t v60; // r13
__int64 v61; // r14
char *v62; // rbx
char *v63; // r15
size_t v64; // rdx
void *v65; // rax
char *v66; // rax
int v67; // ecx
size_t v68; // r15
char *v69; // r14
size_t v70; // r13
void *v71; // rbx
const char *v72; // rdi
int v73; // r15d
cocos2d::CCString *v74; // rax
int v75; // r14d
cocos2d::CCString *v76; // rax
char v78[8]; // [rsp+10h] [rbp-B0h] BYREF
size_t v79; // [rsp+18h] [rbp-A8h]
void *v80; // [rsp+20h] [rbp-A0h]
unsigned __int8 v81; // [rsp+28h] [rbp-98h]
char v82[7]; // [rsp+29h] [rbp-97h] BYREF
size_t v83; // [rsp+30h] [rbp-90h]
void *__s2; // [rsp+38h] [rbp-88h]
__int64 __src; // [rsp+40h] [rbp-80h] BYREF
size_t v86; // [rsp+48h] [rbp-78h]
void *v87; // [rsp+50h] [rbp-70h]
cocos2d::CCObject *v88; // [rsp+58h] [rbp-68h]
size_t __dst; // [rsp+60h] [rbp-60h] BYREF
size_t v90; // [rsp+68h] [rbp-58h]
void *__p; // [rsp+70h] [rbp-50h]
unsigned int v92; // [rsp+7Ch] [rbp-44h]
__int64 __s; // [rsp+80h] [rbp-40h] BYREF
size_t __n; // [rsp+88h] [rbp-38h]
void *__s1; // [rsp+90h] [rbp-30h]
v3 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (char *)cocos2d::CCString::getCString(v3);
v5 = (cocos2d::CCObject *)sub_10071F9E0(v3, a2);
v88 = v5;
if ( strtok(CString, "\n") )
{
v6 = strtok(nullptr, "\n");
if ( v6 )
{
v7 = v6;
p_dst = &__dst;
do
{
v9 = strlen(v7);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
v10 = v9;
if ( v9 >= 0x17 )
{
v12 = p_dst;
v13 = (v9 | 7) + 1;
if ( (v9 | 7) == 0x17 )
v13 = 26;
v11 = (char *)operator new(v13);
__p = v11;
__dst = v13 + 1;
p_dst = v12;
v90 = v10;
}
else
{
LOBYTE(__dst) = 2 * v9;
v11 = (char *)&__dst + 1;
if ( !v9 )
goto LABEL_13;
}
memmove(v11, v7, v10);
LABEL_13:
v11[v10] = 0;
v14 = sub_1007AB360(p_dst);
v5 = v88;
sub_10071FCD0(v88, v14);
if ( (__dst & 1) != 0 )
operator delete(__p);
v7 = strtok(nullptr, "\n");
}
while ( v7 );
}
}
if ( (unsigned int)sub_100720070(v5) )
{
v15 = 0;
do
{
v92 = v15;
v16 = (char *)v15;
v17 = (cocos2d::CCString *)sub_1007200C0(v5, v15);
strcpy((char *)&__dst, "\nchars");
v81 = 8;
strcpy(v82, "char");
v18 = cocos2d::CCString::getCString(v17);
v19 = (char *)v18;
v20 = strlen(v18);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
v21 = v20;
if ( v20 >= 0x17 )
{
v28 = (v20 | 7) + 1;
if ( (v20 | 7) == 0x17 )
v28 = 26;
v22 = (char *)operator new(v28);
v87 = v22;
__src = v28 | 1;
v86 = v21;
}
else
{
LOBYTE(__src) = 2 * v20;
v22 = (char *)&__src + 1;
if ( !v20 )
{
BYTE1(__src) = 0;
v23 = (unsigned __int8)__dst;
if ( (__dst & 1) != 0 )
goto LABEL_22;
goto LABEL_28;
}
}
v19 = v22;
v16 = (char *)v18;
memmove(v22, v18, v21);
v22[v21] = 0;
v23 = (unsigned __int8)__dst;
if ( (__dst & 1) != 0 )
{
LABEL_22:
v24 = v90;
v5 = v88;
v25 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
goto LABEL_23;
goto LABEL_29;
}
LABEL_28:
v24 = v23 >> 1;
v5 = v88;
v25 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
{
LABEL_23:
v26 = v25 >> 1;
v27 = (char *)&__src + 1;
goto LABEL_30;
}
LABEL_29:
v26 = v86;
v27 = (char *)v87;
LABEL_30:
if ( v26 < v24 )
v24 = v26;
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
if ( v24 >= 0x17 )
{
v34 = (v24 | 7) + 1;
if ( (v24 | 7) == 0x17 )
v34 = 26;
v29 = (char *)operator new(v34);
__s1 = v29;
__s = v34 | 1;
__n = v24;
v5 = v88;
}
else
{
LOBYTE(__s) = 2 * v24;
v29 = (char *)&__s + 1;
if ( !v24 )
{
BYTE1(__s) = 0;
v30 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
goto LABEL_36;
goto LABEL_44;
}
}
v19 = v29;
v16 = v27;
memmove(v29, v27, v24);
v29[v24] = 0;
v30 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
{
LABEL_36:
v31 = __n;
v32 = (unsigned __int8)__dst;
if ( (__dst & 1) == 0 )
goto LABEL_37;
goto LABEL_45;
}
LABEL_44:
v31 = v30 >> 1;
v32 = (unsigned __int8)__dst;
if ( (__dst & 1) == 0 )
{
LABEL_37:
if ( v31 != v32 >> 1 )
goto LABEL_38;
goto LABEL_46;
}
LABEL_45:
if ( v31 != v90 )
{
LABEL_38:
v33 = 0;
if ( (v30 & 1) != 0 )
goto LABEL_51;
goto LABEL_52;
}
LABEL_46:
v19 = (char *)&__s + 1;
if ( (v30 & 1) != 0 )
v19 = (char *)__s1;
v16 = (char *)&__dst + 1;
if ( (v32 & 1) != 0 )
v16 = (char *)__p;
v33 = memcmp(v19, v16, v31) == 0;
if ( (v30 & 1) != 0 )
{
LABEL_51:
v19 = (char *)__s1;
operator delete(__s1);
}
LABEL_52:
v35 = v92;
if ( v33 )
goto LABEL_132;
if ( (v81 & 1) != 0 )
{
v36 = v83;
v37 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
goto LABEL_55;
}
else
{
v36 = v81 >> 1;
v37 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
{
LABEL_55:
v38 = v37 >> 1;
v39 = (char *)&__src + 1;
goto LABEL_58;
}
}
v38 = v86;
v39 = (char *)v87;
LABEL_58:
if ( v38 < v36 )
v36 = v38;
if ( v36 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
if ( v36 >= 0x17 )
{
v45 = (v36 | 7) + 1;
if ( (v36 | 7) == 0x17 )
v45 = 26;
v40 = (char *)operator new(v45);
__s1 = v40;
__s = v45 | 1;
__n = v36;
v5 = v88;
}
else
{
LOBYTE(__s) = 2 * v36;
v40 = (char *)&__s + 1;
if ( !v36 )
{
BYTE1(__s) = 0;
v41 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
goto LABEL_64;
goto LABEL_72;
}
}
v19 = v40;
v16 = v39;
memmove(v40, v39, v36);
v40[v36] = 0;
v41 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
{
LABEL_64:
v42 = __n;
v43 = v81;
if ( (v81 & 1) == 0 )
goto LABEL_65;
goto LABEL_73;
}
LABEL_72:
v42 = v41 >> 1;
v43 = v81;
if ( (v81 & 1) == 0 )
{
LABEL_65:
if ( v42 != v43 >> 1 )
goto LABEL_66;
goto LABEL_74;
}
LABEL_73:
if ( v42 != v83 )
{
LABEL_66:
v44 = 0;
if ( (v41 & 1) != 0 )
goto LABEL_79;
goto LABEL_80;
}
LABEL_74:
v19 = (char *)&__s + 1;
if ( (v41 & 1) != 0 )
v19 = (char *)__s1;
v16 = v82;
if ( (v43 & 1) != 0 )
v16 = (char *)__s2;
v44 = memcmp(v19, v16, v42) == 0;
if ( (v41 & 1) != 0 )
{
LABEL_79:
v19 = (char *)__s1;
operator delete(__s1);
}
LABEL_80:
v35 = v92;
if ( !v44 )
goto LABEL_132;
v46 = sub_10071F9E0(v19, v16);
v47 = (char *)cocos2d::CCString::getCString(v17);
if ( strtok(v47, "=") )
{
v48 = strtok(nullptr, "=");
if ( v48 )
{
v49 = v48;
do
{
v50 = strlen(v49);
if ( v50 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
v51 = v50;
if ( v50 >= 0x17 )
{
v53 = (v50 | 7) + 1;
if ( (v50 | 7) == 0x17 )
v53 = 26;
v52 = (char *)operator new(v53);
__s1 = v52;
__s = v53 | 1;
__n = v51;
}
else
{
LOBYTE(__s) = 2 * v50;
v52 = (char *)&__s + 1;
if ( !v50 )
goto LABEL_93;
}
memmove(v52, v49, v51);
LABEL_93:
v52[v51] = 0;
v54 = sub_1007AB360(&__s);
sub_10071FCD0(v46, v54);
if ( (__s & 1) != 0 )
operator delete(__s1);
v49 = strtok(nullptr, "=");
}
while ( v49 );
}
}
v55 = (cocos2d::CCString *)sub_1007200C0(v46, 0);
v56 = cocos2d::CCString::getCString(v55);
v57 = strlen(v56);
if ( v57 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
v58 = v57;
if ( v57 >= 0x17 )
{
v60 = (v57 | 7) + 1;
if ( (v57 | 7) == 0x17 )
v60 = 26;
v59 = (char *)operator new(v60);
__s1 = v59;
__s = v60 | 1;
__n = v58;
LABEL_102:
memmove(v59, v56, v58);
goto LABEL_103;
}
LOBYTE(__s) = 2 * v57;
v59 = (char *)&__s + 1;
if ( v57 )
goto LABEL_102;
LABEL_103:
v59[v58] = 0;
v61 = (unsigned __int8)__s >> 1;
v62 = (char *)__s1;
if ( (__s & 1) != 0 )
v61 = __n;
else
v62 = (char *)&__s + 1;
v63 = &v62[v61];
if ( v61 > 0 )
{
v64 = v61;
v65 = v62;
do
{
v66 = (char *)memchr(v65, 32, v64);
if ( !v66 )
break;
if ( *v66 == 32 )
goto LABEL_112;
v65 = v66 + 1;
v64 = v63 - (_BYTE *)v65;
}
while ( v63 - (_BYTE *)v65 > 0 );
}
v66 = &v62[v61];
LABEL_112:
v67 = (_DWORD)v62 - (_DWORD)v66;
if ( v66 == v63 )
v67 = 1;
v68 = (int)v61 + v67 + 1;
if ( v61 < v68 )
v68 = v61;
if ( v68 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
if ( v68 >= 0x17 )
{
v70 = (v68 | 7) + 1;
if ( (v68 | 7) == 0x17 )
v70 = 26;
v69 = (char *)operator new(v70);
v80 = v69;
*(_QWORD *)v78 = v70 | 1;
v79 = v68;
}
else
{
v78[0] = 2 * v68;
v69 = &v78[1];
if ( !v68 )
goto LABEL_124;
}
memmove(v69, v62, v68);
LABEL_124:
v69[v68] = 0;
v71 = v80;
v72 = (const char *)v80;
if ( (v78[0] & 1) == 0 )
v72 = &v78[1];
v73 = atoi(v72);
if ( v73 >= 300 )
v73 = 0;
v74 = (cocos2d::CCString *)sub_1007200C0(v46, 3);
v75 = cocos2d::CCString::intValue(v74);
v76 = (cocos2d::CCString *)sub_1007200C0(v46, 7);
a1->m_fontWidths.__elems_[v73] = v75 + cocos2d::CCString::intValue(v76);
if ( (v78[0] & 1) != 0 )
operator delete(v71);
v5 = v88;
v35 = v92;
if ( (__s & 1) != 0 )
operator delete(__s1);
LABEL_132:
if ( (__src & 1) != 0 )
{
operator delete(v87);
if ( (v81 & 1) == 0 )
{
LABEL_134:
if ( (__dst & 1) != 0 )
goto LABEL_138;
goto LABEL_17;
}
}
else if ( (v81 & 1) == 0 )
{
goto LABEL_134;
}
operator delete(__s2);
if ( (__dst & 1) != 0 )
LABEL_138:
operator delete(__p);
LABEL_17:
v15 = v35 + 1;
}
while ( v15 < (unsigned int)sub_100720070(v5) );
}
cocos2d::CCObject::release(v5);
}