//
// FontObject::parseConfigFile from 0x1002f3bcc to 0x1002f401c (1104 bytes)
//
// 1 xrefs:
// > FontObject::createWithConfigFile @ 0x1002f3b9c
//
// 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 __fastcall FontObject::parseConfigFile(FontObject *a1, const char *a2, float a3)
{
cocos2d::CCString *v4; // x0
char *CString; // x20
cocos2d::CCObject *v6; // x19
char *v7; // x0
char *v8; // x1
unsigned int i; // w20
cocos2d::CCString *v10; // x25
char *v11; // x0
std::string::size_type v12; // x3
int v13; // w24
size_t size; // x2
unsigned __int64 v15; // x9
std::string *v16; // x0
void **v17; // x1
bool v18; // w26
std::string::size_type v19; // x3
int v20; // w24
size_t v21; // x2
std::string::size_type v22; // x9
std::string *v23; // x0
const void *v24; // x1
_BOOL4 v25; // w26
cocos2d::CCObject *v26; // x24
char *v27; // x0
char *v28; // x0
char *v29; // x1
cocos2d::CCString *v30; // x0
char *v31; // x0
std::string *v32; // x27
signed __int64 v33; // x25
_BYTE *v34; // x26
size_t v35; // x2
std::string *v36; // x0
_BYTE *v37; // x0
int v38; // w8
std::string *p_a; // x0
int v40; // w0
int v41; // w26
cocos2d::CCString *v42; // x0
int v43; // w25
cocos2d::CCString *v44; // x0
std::string __a; // [xsp+10h] [xbp-D0h] BYREF
std::string v46; // [xsp+28h] [xbp-B8h] BYREF
std::string __str; // [xsp+40h] [xbp-A0h] BYREF
void *v48; // [xsp+58h] [xbp-88h] BYREF
std::string::size_type v49; // [xsp+60h] [xbp-80h]
unsigned __int8 v50; // [xsp+6Fh] [xbp-71h]
void *__p[2]; // [xsp+70h] [xbp-70h] BYREF
unsigned __int8 v52; // [xsp+87h] [xbp-59h]
std::allocator v53; // [xsp+8Fh] [xbp-51h] BYREF
v4 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (char *)cocos2d::CCString::getCString(v4);
v6 = sub_10024A15C();
if ( strtok(CString, "\n") )
{
v7 = strtok(nullptr, "\n");
if ( v7 )
{
v8 = v7;
do
{
sub_100009900(__p, v8);
sub_100268E48((__int128 *)__p);
sub_10024A2D0((__int64)v6);
if ( (char)v52 < 0 )
operator delete(__p[0]);
v8 = strtok(nullptr, "\n");
}
while ( v8 );
}
}
if ( (unsigned int)sub_10024A36C((__int64)v6) )
{
for ( i = 0; i < (unsigned int)sub_10024A36C((__int64)v6); ++i )
{
v10 = (cocos2d::CCString *)sub_10024A388((__int64)v6, i);
sub_100009900(__p, "chars");
sub_100009900(&v48, "char");
v11 = (char *)cocos2d::CCString::getCString(v10);
sub_100009900(&__str, v11);
if ( (v52 & 0x80u) == 0 )
v12 = v52;
else
v12 = (std::string::size_type)__p[1];
std::string::basic_string(&v46, &__str, 0, v12, (std::allocator *)&__a);
v13 = SHIBYTE(v46.__r_.__value_.__r.__words[2]);
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(v46.__r_.__value_.__r.__words[2]);
else
size = v46.__r_.__value_.__l.__size_;
v15 = v52;
if ( (v52 & 0x80u) != 0 )
v15 = (unsigned __int64)__p[1];
if ( size == v15 )
{
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v16 = &v46;
else
v16 = (std::string *)v46.__r_.__value_.__r.__words[0];
if ( (v52 & 0x80u) == 0 )
v17 = __p;
else
v17 = (void **)__p[0];
v18 = memcmp(v16, v17, size) == 0;
if ( v13 < 0 )
{
LABEL_28:
operator delete(v46.__r_.__value_.__l.__data_);
if ( v18 )
goto LABEL_79;
goto LABEL_29;
}
}
else
{
v18 = 0;
if ( SHIBYTE(v46.__r_.__value_.__r.__words[2]) < 0 )
goto LABEL_28;
}
if ( v18 )
goto LABEL_79;
LABEL_29:
if ( (v50 & 0x80u) == 0 )
v19 = v50;
else
v19 = v49;
std::string::basic_string(&v46, &__str, 0, v19, (std::allocator *)&__a);
v20 = SHIBYTE(v46.__r_.__value_.__r.__words[2]);
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v21 = HIBYTE(v46.__r_.__value_.__r.__words[2]);
else
v21 = v46.__r_.__value_.__l.__size_;
v22 = v50;
if ( (v50 & 0x80u) != 0 )
v22 = v49;
if ( v21 == v22 )
{
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &v46;
else
v23 = (std::string *)v46.__r_.__value_.__r.__words[0];
if ( (v50 & 0x80u) == 0 )
v24 = &v48;
else
v24 = v48;
v25 = memcmp(v23, v24, v21) == 0;
if ( (v20 & 0x80000000) == 0 )
{
LABEL_45:
if ( v25 )
goto LABEL_49;
goto LABEL_79;
}
}
else
{
v25 = 0;
if ( (SHIBYTE(v46.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_45;
}
operator delete(v46.__r_.__value_.__l.__data_);
if ( v25 )
{
LABEL_49:
v26 = sub_10024A15C();
v27 = (char *)cocos2d::CCString::getCString(v10);
if ( strtok(v27, "=") )
{
v28 = strtok(nullptr, "=");
if ( v28 )
{
v29 = v28;
do
{
sub_100009900(&v46, v29);
sub_100268E48((__int128 *)&v46);
sub_10024A2D0((__int64)v26);
if ( SHIBYTE(v46.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v46.__r_.__value_.__l.__data_);
v29 = strtok(nullptr, "=");
}
while ( v29 );
}
}
v30 = (cocos2d::CCString *)sub_10024A388((__int64)v26, 0);
v31 = (char *)cocos2d::CCString::getCString(v30);
sub_100009900(&v46, v31);
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v32 = &v46;
else
v32 = (std::string *)v46.__r_.__value_.__r.__words[0];
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v33 = SHIBYTE(v46.__r_.__value_.__r.__words[2]);
else
v33 = v46.__r_.__value_.__l.__size_;
v34 = (char *)v32 + v33;
if ( v33 >= 1 )
{
v35 = v33;
v36 = v32;
do
{
v37 = memchr(v36, 32, v35);
if ( !v37 )
break;
if ( *v37 == 32 )
goto LABEL_67;
v36 = (std::string *)(v37 + 1);
v35 = v34 - (_BYTE *)v36;
}
while ( v34 - (_BYTE *)v36 > 0 );
}
v37 = (char *)v32 + v33;
LABEL_67:
v38 = (_DWORD)v32 - (_DWORD)v37;
if ( v37 == v34 )
v38 = 1;
std::string::basic_string(&__a, &v46, 0, v38 + (int)v33 + 1, &v53);
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_a = &__a;
else
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
v40 = atoi((const char *)p_a);
if ( v40 <= 299 )
v41 = v40;
else
v41 = 0;
v42 = (cocos2d::CCString *)sub_10024A388((__int64)v26, 3u);
v43 = cocos2d::CCString::intValue(v42);
v44 = (cocos2d::CCString *)sub_10024A388((__int64)v26, 7u);
a1->m_fontWidths.__elems_[v41] = cocos2d::CCString::intValue(v44) + v43;
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
if ( SHIBYTE(v46.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v46.__r_.__value_.__l.__data_);
}
LABEL_79:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (char)v50 < 0 )
operator delete(v48);
if ( (char)v52 < 0 )
operator delete(__p[0]);
}
}
cocos2d::CCObject::release(v6);
}