//
// cocos2d::CCBMFontConfiguration::parseImageFileName from 0x1005d6960 to 0x1005d6bb3 (595 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x1005d568e
//
// 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 cocos2d::CCBMFontConfiguration::parseImageFileName(
__int64 a1,
const std::string *a2,
__int64 a3,
double a4)
{
std::string::size_type v6; // r13
int v7; // eax
unsigned int v8; // r12d
std::string::size_type size; // r12
std::string::pointer data; // rsi
size_t v11; // rax
size_t v12; // r12
char *v13; // rbx
size_t v14; // r14
std::string::size_type v15; // r13
int v16; // eax
unsigned int v17; // r12d
std::string::size_type v18; // r12
std::string::pointer v19; // r15
size_t v20; // rax
size_t v21; // r12
char *v22; // r14
cocos2d::CCFileUtils *v23; // rax
char *v24; // rsi
size_t v25; // rbx
const std::string::value_type *v26; // rax
__int64 v27; // [rsp+10h] [rbp-60h]
__int128 v28; // [rsp+18h] [rbp-58h] BYREF
void *v29; // [rsp+28h] [rbp-48h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
v6 = (int)(std::string::find(a2, 61, 0) + 1);
v7 = std::string::find(a2, 32, v6);
v8 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v8 & 1) == 0 )
{
size = v8 >> 1;
if ( size >= v6 )
{
data = a2->__r_.__value_.__s.__data_;
goto LABEL_6;
}
LABEL_39:
sub_1000547C0();
}
size = a2->__r_.__value_.__l.__size_;
if ( size < v6 )
goto LABEL_39;
data = a2->__r_.__value_.__l.__data_;
LABEL_6:
v11 = v7 - (int)v6;
v12 = size - v6;
if ( v12 >= v11 )
v12 = v11;
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v27 = a3;
if ( v12 >= 0x17 )
{
v14 = 26;
if ( (v12 | 7) != 0x17 )
v14 = (v12 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
*(_QWORD *)&__dst = v14 + 1;
*((_QWORD *)&__dst + 1) = v12;
goto LABEL_15;
}
LOBYTE(__dst) = 2 * v12;
v13 = (char *)&__dst + 1;
if ( v12 )
LABEL_15:
memmove(v13, &data[v6], v12);
v13[v12] = 0;
v15 = (int)(std::string::find(a2, 34, 0) + 1);
v16 = std::string::find(a2, 34, v15);
v17 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v17 & 1) == 0 )
{
v18 = v17 >> 1;
if ( v18 >= v15 )
{
v19 = a2->__r_.__value_.__s.__data_;
goto LABEL_21;
}
LABEL_41:
sub_1000547C0();
}
v18 = a2->__r_.__value_.__l.__size_;
if ( v18 < v15 )
goto LABEL_41;
v19 = a2->__r_.__value_.__l.__data_;
LABEL_21:
v20 = v16 - (int)v15;
v21 = v18 - v15;
if ( v21 >= v20 )
v21 = v20;
if ( v21 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
if ( v21 >= 0x17 )
{
v25 = 26;
if ( (v21 | 7) != 0x17 )
v25 = (v21 | 7) + 1;
v22 = (char *)operator new(v25);
v29 = v22;
*(_QWORD *)&v28 = v25 | 1;
*((_QWORD *)&v28 + 1) = v21;
}
else
{
LOBYTE(v28) = 2 * v21;
v22 = (char *)&v28 + 1;
if ( !v21 )
{
BYTE1(v28) = 0;
if ( (__dst & 1) == 0 )
goto LABEL_28;
goto LABEL_27;
}
}
memmove(v22, &v19[v15], v21);
v22[v21] = 0;
if ( (__dst & 1) != 0 )
LABEL_27:
operator delete(__p);
LABEL_28:
__p = v29;
__dst = v28;
v23 = cocos2d::CCFileUtils::sharedFileUtils();
if ( (__dst & 1) != 0 )
v24 = (char *)__p;
else
v24 = (char *)&__dst + 1;
v26 = (const std::string::value_type *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, char *, __int64))v23->getFileData)(
v23,
v24,
v27);
std::string::assign((std::string *)(a1 + 88), v26);
if ( (__dst & 1) != 0 )
operator delete(__p);
}