//
// cocos2d::CCFileUtils::loadFilenameLookupDictionaryFromFile from 0xb05800 to 0xb05aec (748 bytes)
//
// 3 xrefs:
// > ??> @ 0x494a0
// > ??> @ 0x1217ad0
// > ??> @ 0x1217f90
//
// 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 cocos2d::CCFileUtils::loadFilenameLookupDictionaryFromFile(cocos2d::CCFileUtils *a1, const char *a2)
{
cocos2d::CCDictionary *v3; // x0
int *p_m_uOrderOfArrival; // x1
cocos2d::CCDictionary *v5; // x23
__int64 v6; // x25
char *v7; // x0
cocos2d::CCString *v8; // x0
int v9; // w25
char *v10; // x0
int *v11; // x0
unsigned int *v12; // x1
cocos2d::CCDictionary::CCDictType v13; // w2
unsigned int *p_m_eDictType; // x0
int m_eDictType; // w2
const unsigned __int8 *(__fastcall *fullPathFromRelativeFile)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *, const unsigned __int8 *); // x24
__int64 v17; // x0
char *v18; // x0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
cocos2d::CCDictionary *v25[2]; // [xsp+0h] [xbp+0h] BYREF
cocos2d::CCDictionary *v26; // [xsp+68h] [xbp+68h] BYREF
const char *v27; // [xsp+70h] [xbp+70h] BYREF
((void (__fastcall *)(cocos2d::CCDictionary **__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))a1->createCCArrayWithContentsOfFile)(
&v26,
a1,
a2,
0);
v3 = v26;
if ( !*(_QWORD *)&v26[-1].m_uOrderOfArrival )
{
LABEL_2:
p_m_uOrderOfArrival = &v3[-1].m_uOrderOfArrival;
if ( &v3[-1].m_uOrderOfArrival != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_eDictType = (unsigned int *)&v3[-1].m_eDictType;
do
m_eDictType = __ldaxr(p_m_eDictType);
while ( __stlxr(m_eDictType - 1, p_m_eDictType) );
}
else
{
m_eDictType = v3[-1].m_eDictType;
v3[-1].m_eDictType = m_eDictType - 1;
}
if ( m_eDictType <= 0 )
operator delete(p_m_uOrderOfArrival);
}
return;
}
v5 = cocos2d::CCDictionary::createWithContentsOfFile((const char *)v26);
if ( !v5 )
{
v3 = v26;
goto LABEL_2;
}
sub_D153B8((int)&v27, "metadata");
v6 = cocos2d::CCDictionary::objectForKey((__int64)v5, &v27);
v7 = (char *)(v27 - 24);
if ( v27 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v27 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v7);
}
sub_D153B8((unsigned int)v25 + 112, "version");
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v6, &v27);
v9 = cocos2d::CCString::intValue(v8);
v10 = (char *)(v27 - 24);
if ( v27 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v27 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v10);
}
if ( v9 == 1 )
{
fullPathFromRelativeFile = a1->fullPathFromRelativeFile;
sub_D153B8((unsigned int)v25 + 112, "filenames");
v17 = cocos2d::CCDictionary::objectForKey((__int64)v5, &v27);
((void (__fastcall *)(cocos2d::CCFileUtils *, __int64))fullPathFromRelativeFile)(a1, v17);
v18 = (char *)(v27 - 24);
if ( v27 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_21;
if ( &pthread_create )
{
v23 = (unsigned int *)(v27 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v24 - 1;
}
if ( v24 > 0 )
{
LABEL_21:
v3 = v26;
}
else
{
operator delete(v18);
v3 = v26;
}
goto LABEL_2;
}
v11 = &v26[-1].m_uOrderOfArrival;
if ( &v26[-1].m_uOrderOfArrival != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)&v26[-1].m_eDictType;
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = v26[-1].m_eDictType;
v26[-1].m_eDictType = v13 - 1;
}
if ( (int)v13 <= (int)kCCDictUnknown )
operator delete(v11);
}
}