//
// FontObject::parseConfigFile from 0x14003e1c0 to 0x14003e947 (1927 bytes)
//
// 3 xrefs:
// > BitmapFontCache::fontWithConfigFile @ 0x14003e066
// > ??> @ 0x14090f194
// > ??> @ 0x14090f1a0
//
// 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 11:25:28 +0000
//
// Hidden C++ exception states: #wind=7
void __fastcall FontObject::parseConfigFile(__int64 a1, const char *a2)
{
__int64 v4; // r13
cocos2d::CCString *v5; // rax
char *CString; // rbx
__int64 v7; // rcx
cocos2d::CCArray *v8; // r12
char *v9; // rax
size_t v10; // r8
struct cocos2d::CCObject *v11; // rax
char *v12; // rcx
unsigned int v13; // r15d
__m128i si128; // xmm6
cocos2d::CCString *v15; // rdi
const char *v16; // rax
size_t v17; // r8
size_t v18; // r8
__int128 *v19; // rdx
void **v20; // rdx
void *v21; // r8
bool v22; // bl
__int64 v23; // rcx
unsigned __int8 v24; // al
int v25; // eax
size_t v26; // r8
__int128 *v27; // rdx
__int128 *v28; // rdx
__int64 v29; // rcx
unsigned __int8 v30; // al
int v31; // eax
__int64 v32; // rcx
cocos2d::CCArray *v33; // r14
char *v34; // rax
char *v35; // rax
size_t v36; // r8
struct cocos2d::CCObject *v37; // rax
cocos2d::CCString *v38; // rax
const char *v39; // rax
size_t v40; // r8
__int128 *v41; // rdi
size_t v42; // rdx
char *v43; // rbx
__int64 v44; // rax
int v45; // ecx
size_t v46; // r8
__int128 *v47; // rdx
const char *v48; // rcx
int v49; // esi
char *v50; // rcx
void *v51; // rcx
void *v52; // rcx
cocos2d::CCString *v53; // rax
int v54; // ebx
cocos2d::CCString *v55; // rax
int v56; // edi
char *v57; // rcx
void *v58; // rcx
int v59; // [rsp+30h] [rbp-D0h] BYREF
__int64 v60; // [rsp+38h] [rbp-C8h]
__int128 v61; // [rsp+40h] [rbp-C0h] BYREF
__int64 v62; // [rsp+50h] [rbp-B0h]
__int64 v63; // [rsp+58h] [rbp-A8h]
__int128 v64; // [rsp+60h] [rbp-A0h] BYREF
__int64 v65; // [rsp+70h] [rbp-90h]
__int64 v66; // [rsp+78h] [rbp-88h]
char v67[16]; // [rsp+80h] [rbp-80h] BYREF
char v68[16]; // [rsp+90h] [rbp-70h] BYREF
__int128 v69; // [rsp+A0h] [rbp-60h] BYREF
size_t v70; // [rsp+B0h] [rbp-50h]
unsigned __int64 v71; // [rsp+B8h] [rbp-48h]
char *String[2]; // [rsp+C0h] [rbp-40h] BYREF
__m128i v73; // [rsp+D0h] [rbp-30h]
__int128 v74; // [rsp+E0h] [rbp-20h] BYREF
unsigned __int64 v75; // [rsp+F0h] [rbp-10h]
unsigned __int64 v76; // [rsp+F8h] [rbp-8h]
__int128 v77; // [rsp+100h] [rbp+0h] BYREF
__int128 v78; // [rsp+110h] [rbp+10h]
void *Block[2]; // [rsp+120h] [rbp+20h] BYREF
__int128 v80; // [rsp+130h] [rbp+30h]
_OWORD v81[2]; // [rsp+140h] [rbp+40h] BYREF
v4 = a1 + 56;
sub_14003EB60(a1 + 56);
v60 = a1 + 120;
sub_14003EB60(a1 + 120);
v5 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (char *)cocos2d::CCString::getCString(v5);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
if ( strtok(CString, Delimiter) )
{
while ( 1 )
{
v9 = strtok(nullptr, Delimiter);
if ( !v9 )
break;
*(_OWORD *)String = 0;
v73 = 0;
v10 = -1;
do
++v10;
while ( v9[v10] );
sub_14003D230(String, v9, v10);
v11 = (struct cocos2d::CCObject *)cocos2d::CCString::create(String);
cocos2d::CCArray::addObject(v8, v11);
if ( v73.m128i_i64[1] > 0xFuLL )
{
v12 = String[0];
if ( (unsigned __int64)(v73.m128i_i64[1] + 1) >= 0x1000 )
{
v12 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
}
}
v13 = 0;
if ( cocos2d::CCArray::count(v8) )
{
si128 = _mm_load_si128((const __m128i *)&Size);
do
{
v15 = cocos2d::CCArray::objectAtIndex(v8, v13);
v61 = 0;
v62 = 5;
v63 = 15;
strcpy((char *)&v61, "chars");
v64 = 0;
v65 = 4;
v66 = 15;
strcpy((char *)&v64, "char");
v16 = cocos2d::CCString::getCString(v15);
v74 = 0;
v75 = 0;
v76 = 0;
v17 = -1;
do
++v17;
while ( v16[v17] );
sub_14003D230(&v74, v16, v17);
*(_OWORD *)Block = 0;
v80 = 0;
v18 = 5;
if ( v75 < 5 )
v18 = v75;
v19 = &v74;
if ( v76 > 0xF )
v19 = (__int128 *)v74;
sub_14003D230(Block, v19, v18);
v20 = Block;
v21 = Block[0];
if ( *((_QWORD *)&v80 + 1) > 0xFu )
v20 = (void **)Block[0];
if ( (_QWORD)v80 == 5 )
{
v23 = 0;
while ( 1 )
{
v24 = *((_BYTE *)v20 + v23++);
if ( v24 != *((_BYTE *)&v61 + v23 - 1) )
break;
if ( v23 == 5 )
{
v25 = 0;
goto LABEL_27;
}
}
v25 = v24 < *((_BYTE *)&v61 + v23 - 1) ? -1 : 1;
LABEL_27:
v22 = v25 == 0;
}
else
{
v22 = 0;
}
if ( *((_QWORD *)&v80 + 1) > 0xFu )
{
if ( (unsigned __int64)(*((_QWORD *)&v80 + 1) + 1LL) >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
if ( !v22 )
{
v77 = 0;
v78 = 0;
v26 = 4;
if ( v75 < 4 )
v26 = v75;
v27 = &v74;
if ( v76 > 0xF )
v27 = (__int128 *)v74;
sub_14003D230(&v77, v27, v26);
v28 = &v77;
if ( *((_QWORD *)&v78 + 1) > 0xFu )
v28 = (__int128 *)v77;
if ( (_QWORD)v78 == 4 )
{
v29 = 0;
while ( 1 )
{
v30 = *((_BYTE *)v28 + v29++);
if ( v30 != *((_BYTE *)&v64 + v29 - 1) )
break;
if ( v29 == 4 )
{
v31 = 0;
goto LABEL_45;
}
}
v31 = v30 < *((_BYTE *)&v64 + v29 - 1) ? -1 : 1;
LABEL_45:
v22 = v31 == 0;
}
sub_14003D310((__int64)&v77);
if ( v22 )
{
v33 = (cocos2d::CCArray *)cocos2d::CCArray::create(v32);
v34 = (char *)cocos2d::CCString::getCString(v15);
if ( strtok(v34, "=") )
{
while ( 1 )
{
v35 = strtok(nullptr, "=");
if ( !v35 )
break;
memset(v81, 0, sizeof(v81));
v36 = -1;
do
++v36;
while ( v35[v36] );
sub_14003D230(v81, v35, v36);
v37 = (struct cocos2d::CCObject *)cocos2d::CCString::create(v81);
cocos2d::CCArray::addObject(v33, v37);
sub_14003D310((__int64)v81);
}
}
v38 = cocos2d::CCArray::objectAtIndex(v33, 0);
v39 = cocos2d::CCString::getCString(v38);
v69 = 0;
v70 = 0;
v71 = 0;
v40 = -1;
do
++v40;
while ( v39[v40] );
sub_14003D230(&v69, v39, v40);
v41 = &v69;
if ( v71 > 0xF )
v41 = (__int128 *)v69;
v42 = v70;
if ( !v70
|| (v43 = (char *)v41 + v70,
v44 = sub_1406774C0(v41, (char *)v41 + v70, " ", 1),
v42 = v70,
(char *)v44 == v43) )
{
v45 = -1;
}
else
{
v45 = v44 - (_DWORD)v41;
}
*(_OWORD *)String = 0;
v73 = 0;
v46 = (int)v42 - v45 + 1;
if ( v42 < v46 )
v46 = v42;
v47 = &v69;
if ( v71 > 0xF )
v47 = (__int128 *)v69;
sub_14003D230(String, v47, v46);
v48 = (const char *)String;
if ( v73.m128i_i64[1] > 0xFuLL )
v48 = String[0];
v49 = atoi(v48);
if ( v49 < 0 )
{
if ( v73.m128i_i64[1] > 0xFuLL )
{
v50 = String[0];
if ( (unsigned __int64)(v73.m128i_i64[1] + 1) >= 0x1000 )
{
v50 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v50 - 8) > 0x1F )
goto LABEL_94;
}
j_j_free(v50);
}
v73 = si128;
LOBYTE(String[0]) = 0;
if ( v71 > 0xF )
{
v51 = (void *)v69;
if ( v71 + 1 >= 0x1000 )
{
v51 = *(void **)(v69 - 8);
if ( (unsigned __int64)(v69 - (_QWORD)v51 - 8) > 0x1F )
goto LABEL_95;
}
j_j_free(v51);
}
v70 = 0;
v71 = 15;
LOBYTE(v69) = 0;
if ( v76 > 0xF )
{
v52 = (void *)v74;
if ( v76 + 1 >= 0x1000 )
{
v52 = *(void **)(v74 - 8);
if ( (unsigned __int64)(v74 - (_QWORD)v52 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
LABEL_90:
j_j_free(v52);
goto LABEL_91;
}
goto LABEL_91;
}
v53 = cocos2d::CCArray::objectAtIndex(v33, 3u);
v54 = cocos2d::CCString::intValue(v53);
v55 = cocos2d::CCArray::objectAtIndex(v33, 7u);
v56 = cocos2d::CCString::intValue(v55);
v59 = v49;
*(_DWORD *)(*(_QWORD *)sub_14003ED20(v4, v67, &v59) + 20LL) = v56 + v54;
v59 = v49;
*(_DWORD *)(*(_QWORD *)sub_14003ED20(v60, v68, &v59) + 20LL) = v56;
if ( v73.m128i_i64[1] > 0xFuLL )
{
v57 = String[0];
if ( (unsigned __int64)(v73.m128i_i64[1] + 1) >= 0x1000 )
{
v57 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v57 - 8) > 0x1F )
LABEL_94:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v57);
}
v73 = si128;
LOBYTE(String[0]) = 0;
if ( v71 > 0xF )
{
v58 = (void *)v69;
if ( v71 + 1 >= 0x1000 )
{
v58 = *(void **)(v69 - 8);
if ( (unsigned __int64)(v69 - (_QWORD)v58 - 8) > 0x1F )
LABEL_95:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v58);
}
}
}
if ( v76 > 0xF )
{
v52 = (void *)v74;
if ( v76 + 1 >= 0x1000 )
{
v52 = *(void **)(v74 - 8);
if ( (unsigned __int64)(v74 - (_QWORD)v52 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
goto LABEL_90;
}
LABEL_91:
++v13;
}
while ( v13 < cocos2d::CCArray::count(v8) );
}
cocos2d::CCObject::release(v8);
}