//
// BitmapFontCache::fontWithConfigFile from 0x56b248 to 0x56b49c (596 bytes)
//
// 2 xrefs:
// > MultilineBitmapFont::initWithFont @ 0x58ab4c
// > ??> @ 0x49b00
//
// 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
//
FontObject *BitmapFontCache::fontWithConfigFile(BitmapFontCache *a1, const char *a2, float a3)
{
cocos2d::CCString *v6; // x0
char *CString; // x23
cocos2d::CCDictionary *m_cache; // x19
__int64 v9; // x26
char *v10; // x0
cocos2d::CCDictionary *v11; // x24
FontObject *v12; // x0
stl::StringData::Internal *m_data; // x1
FontObject *v14; // x25
char *v15; // x0
unsigned int *v17; // x1
int v18; // w2
cocos2d::CCDictionary *v19; // x24
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
std::string v23; // [xsp+70h] [xbp+70h] BYREF
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s%f", a2, a3);
CString = (char *)cocos2d::CCString::getCString(v6);
m_cache = a1->m_cache;
sub_D153B8((int)&v23, CString);
v9 = cocos2d::CCDictionary::objectForKey(m_cache, &v23);
v10 = (char *)v23.m_data.m_data - 24;
if ( (__int64 *)v23.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v17 = (unsigned int *)((char *)v23.m_data.m_data - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v23.m_data.m_data - 2);
*((_DWORD *)v23.m_data.m_data - 2) = v18 - 1;
}
if ( v18 > 0 )
{
LABEL_2:
if ( !v9 )
goto LABEL_10;
LABEL_3:
v11 = a1->m_cache;
sub_D153B8((int)&v23, CString);
v12 = (FontObject *)cocos2d::CCDictionary::objectForKey(v11, &v23);
m_data = v23.m_data.m_data;
v14 = v12;
v15 = (char *)v23.m_data.m_data - 24;
if ( (__int64 *)v23.m_data.m_data - 3 == &qword_124B6B0 )
return v14;
if ( &pthread_create )
{
v22 = (unsigned int *)((char *)v23.m_data.m_data - 8);
do
v21 = __ldaxr(v22);
while ( __stlxr(v21 - 1, v22) );
goto LABEL_18;
}
LABEL_21:
v21 = *((_DWORD *)m_data - 2);
*((_DWORD *)m_data - 2) = v21 - 1;
goto LABEL_18;
}
operator delete(v10);
if ( v9 )
goto LABEL_3;
LABEL_10:
v14 = FontObject::createWithConfigFile(a2, a3);
v19 = a1->m_cache;
sub_D153B8((int)&v23, CString);
cocos2d::CCDictionary::setObject((int)v19, v14);
m_data = v23.m_data.m_data;
v15 = (char *)v23.m_data.m_data - 24;
if ( (__int64 *)v23.m_data.m_data - 3 == &qword_124B6B0 )
return v14;
if ( !&pthread_create )
goto LABEL_21;
v20 = (unsigned int *)((char *)v23.m_data.m_data - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
LABEL_18:
if ( v21 <= 0 )
operator delete(v15);
return v14;
}