//
// FontObject::parseConfigFile from 0x100203ac0 to 0x1002045aa (2794 bytes)
//
// 3 xrefs:
// > BitmapFontCache::fontWithConfigFile @ 0x1002038b4
// > FontObject::createWithConfigFile @ 0x100203a84
// > FontObject::initWithConfigFile @ 0x100203ab4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:26:53 +0000
//
__int64 __fastcall FontObject::parseConfigFile(_QWORD *a1, __int64 a2)
{
_QWORD *v4; // rdi
_QWORD *v5; // r15
__int64 v6; // rsi
_QWORD *v7; // rdi
_QWORD *v8; // r15
__int64 v9; // rsi
__int64 v10; // rdi
char *CString; // rbx
char *v12; // rax
char *v13; // r12
size_t *p_dst; // rbx
size_t v15; // rax
size_t v16; // r13
char *v17; // r15
size_t *v18; // r14
size_t v19; // rbx
__int64 v20; // rax
__int64 v21; // r12
__int64 v22; // r15
__int64 v23; // rbx
const char *v24; // r14
char *v25; // rdi
size_t v26; // rax
size_t v27; // r13
char *v28; // r15
unsigned int v29; // r14d
size_t v30; // r14
unsigned int v31; // eax
size_t v32; // rax
char *v33; // r13
size_t v34; // r12
char *v35; // r15
unsigned int v36; // r14d
size_t v37; // rdx
unsigned int v38; // eax
bool v39; // r15
size_t v40; // r12
char *v41; // rsi
bool v42; // zf
int v43; // r15d
size_t v44; // r14
unsigned int v45; // eax
size_t v46; // rax
char *v47; // r13
char *v48; // r15
unsigned int v49; // r14d
size_t v50; // rdx
unsigned int v51; // eax
bool v52; // r15
size_t v53; // r12
char *v54; // rsi
__int64 v55; // r14
char *v56; // rax
char *v57; // rax
char *v58; // rbx
size_t v59; // rax
size_t v60; // r13
char *v61; // r15
size_t v62; // r12
__int64 v63; // rax
__int64 v64; // rax
const char *v65; // rbx
size_t v66; // rax
size_t v67; // r13
char *v68; // r15
size_t v69; // r12
__int64 v70; // r15
char *v71; // rbx
char *v72; // r12
size_t v73; // rdx
void *v74; // rax
char *v75; // rax
int v76; // ecx
size_t v77; // r13
char *v78; // r15
char v79; // bl
int v80; // eax
size_t v81; // r12
char *v82; // r15
int v83; // r12d
__int64 v84; // rax
int v85; // r13d
__int64 v86; // rax
__int64 v87; // rax
int v88; // ebx
_QWORD *v90; // [rsp+0h] [rbp-E0h]
_QWORD *v91; // [rsp+8h] [rbp-D8h]
char v92[8]; // [rsp+10h] [rbp-D0h] BYREF
size_t v93; // [rsp+18h] [rbp-C8h]
char *v94; // [rsp+20h] [rbp-C0h]
int v95; // [rsp+2Ch] [rbp-B4h]
int *v96; // [rsp+30h] [rbp-B0h] BYREF
unsigned __int8 v97; // [rsp+38h] [rbp-A8h]
char v98[7]; // [rsp+39h] [rbp-A7h] BYREF
size_t v99; // [rsp+40h] [rbp-A0h]
void *__s2; // [rsp+48h] [rbp-98h]
__int64 __src; // [rsp+50h] [rbp-90h] BYREF
size_t v102; // [rsp+58h] [rbp-88h]
void *v103; // [rsp+60h] [rbp-80h]
int v104; // [rsp+6Ch] [rbp-74h] BYREF
size_t __dst; // [rsp+70h] [rbp-70h] BYREF
size_t v106; // [rsp+78h] [rbp-68h]
void *__p; // [rsp+80h] [rbp-60h]
__int64 v108; // [rsp+88h] [rbp-58h]
__int64 v109; // [rsp+90h] [rbp-50h]
__int64 __s; // [rsp+98h] [rbp-48h] BYREF
size_t __n; // [rsp+A0h] [rbp-40h]
void *__s1; // [rsp+A8h] [rbp-38h]
_BYTE v113[41]; // [rsp+B7h] [rbp-29h] BYREF
v90 = a1 + 7;
if ( a1[10] )
{
v4 = (_QWORD *)a1[9];
if ( v4 )
{
do
{
v5 = (_QWORD *)*v4;
operator delete(v4);
v4 = v5;
}
while ( v5 );
}
a1[9] = 0;
v6 = a1[8];
if ( v6 )
__bzero(*v90, 8 * v6);
a1[10] = 0;
}
v91 = a1 + 12;
if ( a1[15] )
{
v7 = (_QWORD *)a1[14];
if ( v7 )
{
do
{
v8 = (_QWORD *)*v7;
operator delete(v7);
v7 = v8;
}
while ( v8 );
}
a1[14] = 0;
v9 = a1[13];
if ( v9 )
__bzero(*v91, 8 * v9);
a1[15] = 0;
}
v10 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (char *)cocos2d::CCString::getCString(v10);
v109 = sub_1007FE900(v10);
if ( strtok(CString, "\n") )
{
v12 = strtok(nullptr, "\n");
if ( v12 )
{
v13 = v12;
p_dst = &__dst;
do
{
v15 = strlen(v13);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v16 = v15;
if ( v15 >= 0x17 )
{
v18 = p_dst;
v19 = (v15 | 7) + 1;
if ( (v15 | 7) == 0x17 )
v19 = 26;
v17 = (char *)operator new(v19);
__p = v17;
__dst = v19 + 1;
p_dst = v18;
v106 = v16;
}
else
{
LOBYTE(__dst) = 2 * v15;
v17 = (char *)&__dst + 1;
if ( !v15 )
goto LABEL_25;
}
memmove(v17, v13, v16);
LABEL_25:
v17[v16] = 0;
v20 = sub_10088E600(p_dst);
sub_1007FEBF0(v109, v20);
if ( (__dst & 1) != 0 )
operator delete(__p);
v13 = strtok(nullptr, "\n");
}
while ( v13 );
}
}
v21 = v109;
if ( (unsigned int)sub_1007FEF90(v109) )
{
v22 = 0;
do
{
v108 = v22;
v23 = sub_1007FEFE0(v21, (unsigned int)v22);
strcpy((char *)&__dst, "\nchars");
v97 = 8;
strcpy(v98, "char");
v24 = (const char *)cocos2d::CCString::getCString(v23);
v25 = (char *)v24;
v26 = strlen(v24);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v27 = v26;
if ( v26 >= 0x17 )
{
v34 = (v26 | 7) + 1;
if ( (v26 | 7) == 0x17 )
v34 = 26;
v28 = (char *)operator new(v34);
v103 = v28;
__src = v34 | 1;
v102 = v27;
}
else
{
LOBYTE(__src) = 2 * v26;
v28 = (char *)&__src + 1;
if ( !v26 )
{
BYTE1(__src) = 0;
v29 = (unsigned __int8)__dst;
if ( (__dst & 1) != 0 )
goto LABEL_34;
goto LABEL_40;
}
}
v25 = v28;
memmove(v28, v24, v27);
v28[v27] = 0;
v29 = (unsigned __int8)__dst;
if ( (__dst & 1) != 0 )
{
LABEL_34:
v30 = v106;
v21 = v109;
v31 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
goto LABEL_35;
goto LABEL_41;
}
LABEL_40:
v30 = v29 >> 1;
v21 = v109;
v31 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
{
LABEL_35:
v32 = v31 >> 1;
v33 = (char *)&__src + 1;
goto LABEL_42;
}
LABEL_41:
v32 = v102;
v33 = (char *)v103;
LABEL_42:
if ( v32 < v30 )
v30 = v32;
if ( v30 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v30 >= 0x17 )
{
v40 = (v30 | 7) + 1;
if ( (v30 | 7) == 0x17 )
v40 = 26;
v35 = (char *)operator new(v40);
__s1 = v35;
__s = v40 | 1;
__n = v30;
v21 = v109;
}
else
{
LOBYTE(__s) = 2 * v30;
v35 = (char *)&__s + 1;
if ( !v30 )
{
BYTE1(__s) = 0;
v36 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
goto LABEL_48;
goto LABEL_56;
}
}
v25 = v35;
memmove(v35, v33, v30);
v35[v30] = 0;
v36 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
{
LABEL_48:
v37 = __n;
v38 = (unsigned __int8)__dst;
if ( (__dst & 1) == 0 )
goto LABEL_49;
goto LABEL_57;
}
LABEL_56:
v37 = v36 >> 1;
v38 = (unsigned __int8)__dst;
if ( (__dst & 1) == 0 )
{
LABEL_49:
if ( v37 != v38 >> 1 )
goto LABEL_50;
goto LABEL_58;
}
LABEL_57:
if ( v37 != v106 )
{
LABEL_50:
v39 = 0;
if ( (v36 & 1) != 0 )
goto LABEL_63;
goto LABEL_64;
}
LABEL_58:
v25 = (char *)&__s + 1;
if ( (v36 & 1) != 0 )
v25 = (char *)__s1;
v41 = (char *)&__dst + 1;
if ( (v38 & 1) != 0 )
v41 = (char *)__p;
v39 = memcmp(v25, v41, v37) == 0;
if ( (v36 & 1) != 0 )
{
LABEL_63:
v25 = (char *)__s1;
operator delete(__s1);
}
LABEL_64:
v42 = !v39;
v43 = v108;
if ( !v42 )
goto LABEL_145;
if ( (v97 & 1) != 0 )
{
v44 = v99;
v45 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
goto LABEL_67;
}
else
{
v44 = v97 >> 1;
v45 = (unsigned __int8)__src;
if ( (__src & 1) == 0 )
{
LABEL_67:
v46 = v45 >> 1;
v47 = (char *)&__src + 1;
goto LABEL_70;
}
}
v46 = v102;
v47 = (char *)v103;
LABEL_70:
if ( v46 < v44 )
v44 = v46;
if ( v44 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v44 >= 0x17 )
{
v53 = (v44 | 7) + 1;
if ( (v44 | 7) == 0x17 )
v53 = 26;
v48 = (char *)operator new(v53);
__s1 = v48;
__s = v53 | 1;
__n = v44;
v21 = v109;
}
else
{
LOBYTE(__s) = 2 * v44;
v48 = (char *)&__s + 1;
if ( !v44 )
{
BYTE1(__s) = 0;
v49 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
goto LABEL_76;
goto LABEL_84;
}
}
v25 = v48;
memmove(v48, v47, v44);
v48[v44] = 0;
v49 = (unsigned __int8)__s;
if ( (__s & 1) != 0 )
{
LABEL_76:
v50 = __n;
v51 = v97;
if ( (v97 & 1) == 0 )
goto LABEL_77;
goto LABEL_85;
}
LABEL_84:
v50 = v49 >> 1;
v51 = v97;
if ( (v97 & 1) == 0 )
{
LABEL_77:
if ( v50 != v51 >> 1 )
goto LABEL_78;
goto LABEL_86;
}
LABEL_85:
if ( v50 != v99 )
{
LABEL_78:
v52 = 0;
if ( (v49 & 1) != 0 )
goto LABEL_91;
goto LABEL_92;
}
LABEL_86:
v25 = (char *)&__s + 1;
if ( (v49 & 1) != 0 )
v25 = (char *)__s1;
v54 = v98;
if ( (v51 & 1) != 0 )
v54 = (char *)__s2;
v52 = memcmp(v25, v54, v50) == 0;
if ( (v49 & 1) != 0 )
{
LABEL_91:
v25 = (char *)__s1;
operator delete(__s1);
}
LABEL_92:
v42 = !v52;
v43 = v108;
if ( v42 )
goto LABEL_145;
v55 = sub_1007FE900(v25);
v56 = (char *)cocos2d::CCString::getCString(v23);
if ( strtok(v56, "=") )
{
v57 = strtok(nullptr, "=");
if ( v57 )
{
v58 = v57;
do
{
v59 = strlen(v58);
if ( v59 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v60 = v59;
if ( v59 >= 0x17 )
{
v62 = (v59 | 7) + 1;
if ( (v59 | 7) == 0x17 )
v62 = 26;
v61 = (char *)operator new(v62);
__s1 = v61;
__s = v62 | 1;
__n = v60;
}
else
{
LOBYTE(__s) = 2 * v59;
v61 = (char *)&__s + 1;
if ( !v59 )
goto LABEL_105;
}
memmove(v61, v58, v60);
LABEL_105:
v61[v60] = 0;
v63 = sub_10088E600(&__s);
sub_1007FEBF0(v55, v63);
if ( (__s & 1) != 0 )
operator delete(__s1);
v58 = strtok(nullptr, "=");
}
while ( v58 );
}
}
v64 = sub_1007FEFE0(v55, 0);
v65 = (const char *)cocos2d::CCString::getCString(v64);
v66 = strlen(v65);
if ( v66 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v67 = v66;
if ( v66 >= 0x17 )
{
v69 = (v66 | 7) + 1;
if ( (v66 | 7) == 0x17 )
v69 = 26;
v68 = (char *)operator new(v69);
__s1 = v68;
__s = v69 | 1;
__n = v67;
LABEL_114:
memmove(v68, v65, v67);
goto LABEL_115;
}
LOBYTE(__s) = 2 * v66;
v68 = (char *)&__s + 1;
if ( v66 )
goto LABEL_114;
LABEL_115:
v68[v67] = 0;
v70 = (unsigned __int8)__s >> 1;
v71 = (char *)__s1;
if ( (__s & 1) != 0 )
v70 = __n;
else
v71 = (char *)&__s + 1;
v72 = &v71[v70];
if ( v70 > 0 )
{
v73 = v70;
v74 = v71;
do
{
v75 = (char *)memchr(v74, 32, v73);
if ( !v75 )
break;
if ( *v75 == 32 )
goto LABEL_124;
v74 = v75 + 1;
v73 = v72 - (_BYTE *)v74;
}
while ( v72 - (_BYTE *)v74 > 0 );
}
v75 = &v71[v70];
LABEL_124:
v76 = (_DWORD)v71 - (_DWORD)v75;
if ( v75 == v72 )
v76 = 1;
v77 = (int)v70 + v76 + 1;
if ( v70 < v77 )
v77 = v70;
if ( v77 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v77 >= 0x17 )
{
v81 = (v77 | 7) + 1;
if ( (v77 | 7) == 0x17 )
v81 = 26;
v78 = (char *)operator new(v81);
v94 = v78;
*(_QWORD *)v92 = v81 | 1;
v93 = v77;
}
else
{
v92[0] = 2 * v77;
v78 = &v92[1];
if ( !v77 )
{
v92[1] = 0;
v79 = v92[0];
if ( (v92[0] & 1) == 0 )
goto LABEL_132;
goto LABEL_140;
}
}
memmove(v78, v71, v77);
v78[v77] = 0;
v79 = v92[0];
if ( (v92[0] & 1) == 0 )
{
LABEL_132:
v80 = atoi(&v92[1]);
if ( v80 < 0 )
{
v43 = v108;
if ( (__s & 1) != 0 )
goto LABEL_134;
goto LABEL_135;
}
goto LABEL_141;
}
LABEL_140:
v82 = v94;
v80 = atoi(v94);
if ( v80 < 0 )
{
operator delete(v82);
v43 = v108;
if ( (__s & 1) == 0 )
goto LABEL_135;
LABEL_134:
operator delete(__s1);
LABEL_135:
v21 = v109;
goto LABEL_145;
}
LABEL_141:
v83 = v80;
v43 = v108;
LOBYTE(v108) = v79;
v84 = sub_1007FEFE0(v55, 3);
v85 = cocos2d::CCString::intValue(v84);
v86 = sub_1007FEFE0(v55, 7);
v95 = cocos2d::CCString::intValue(v86);
v104 = v83;
v96 = &v104;
v87 = sub_100204B80(v90, &v104, &unk_100A05FE4, &v96, v113);
v88 = v95;
*(_DWORD *)(v87 + 20) = v95 + v85;
v104 = v83;
v96 = &v104;
*(_DWORD *)(sub_100204B80(v91, &v104, &unk_100A05FE4, &v96, v113) + 20) = v88;
if ( (v108 & 1) != 0 )
operator delete(v94);
v21 = v109;
if ( (__s & 1) != 0 )
operator delete(__s1);
LABEL_145:
if ( (__src & 1) != 0 )
{
operator delete(v103);
if ( (v97 & 1) == 0 )
{
LABEL_147:
if ( (__dst & 1) != 0 )
goto LABEL_151;
goto LABEL_29;
}
}
else if ( (v97 & 1) == 0 )
{
goto LABEL_147;
}
operator delete(__s2);
if ( (__dst & 1) != 0 )
LABEL_151:
operator delete(__p);
LABEL_29:
v22 = (unsigned int)(v43 + 1);
}
while ( (unsigned int)v22 < (unsigned int)sub_1007FEF90(v21) );
}
return cocos2d::CCObject::release(v21);
}