//
// cocos2d::CCFileUtils::setSearchResolutionsOrder from 0xb09110 to 0xb0950c (1020 bytes)
//
// 3 xrefs:
// > ??> @ 0x74238
// > ??> @ 0x1217ae8
// > ??> @ 0x1217fa8
//
// 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::setSearchResolutionsOrder(cocos2d::CCFileUtils *a1, std::vector *const a2)
{
cocos2d::CCFileUtils *v3; // x23
cocos2d::CCFileUtils_vtbl *v5; // x19
void (__fastcall *addSearchResolutionsOrder)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *); // x1
char *v7; // x0
cocos2d::CCFileUtils_vtbl *v8; // x0
void (__fastcall *v9)(cocos2d::CCFileUtils *__hidden); // x26
std::string (__fastcall *addSuffix)(cocos2d::CCFileUtils *__hidden, std::string, std::string); // x1
char *v11; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
cocos2d::CCFileUtils_vtbl *v16; // x0
cocos2d::CCFileUtils_vtbl *v17; // x26
cocos2d::CCFileUtils_vtbl *v18; // x25
cocos2d::CCFileUtils_vtbl *v19; // x19
__int64 (__fastcall *getClassTypeInfo)(cocos2d::TypeInfo *__hidden); // x1
__int64 *v21; // x0
unsigned int *v22; // x1
int v23; // w2
_BOOL4 v24; // w23
cocos2d::CCFileUtils *v25; // x21
std::string *m_start; // x19
char *v27; // x2
__int64 v28; // x0
__int64 v29; // x28
cocos2d::CCFileUtils_vtbl *v30; // x0
char *v31; // x0
unsigned int *v32; // x1
int v33; // w2
cocos2d::CCFileUtils_vtbl *v34; // x0
char *v35; // x1
char *v36; // x0
unsigned int *v37; // x1
int v38; // w2
char *v39; // [xsp+80h] [xbp+80h] BYREF
v3 = a1 + 9;
v5 = a1[11].__vftable;
if ( v5 )
{
do
{
while ( 1 )
{
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_erase(
(__int64)v3,
(_QWORD *)v5->addSearchPath);
v9 = v5->~CCFileUtils_0;
addSuffix = v5->addSuffix;
v11 = (char *)addSuffix - 24;
if ( (__int64 *)((char *)addSuffix - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)((char *)addSuffix - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)addSuffix - 2);
*((_DWORD *)addSuffix - 2) = v13 - 1;
}
if ( v13 <= 0 )
break;
}
addSearchResolutionsOrder = v5->addSearchResolutionsOrder;
v7 = (char *)addSearchResolutionsOrder - 24;
if ( (__int64 *)((char *)addSearchResolutionsOrder - 24) != &qword_124B6B0 )
goto LABEL_11;
LABEL_4:
v8 = v5;
v5 = (cocos2d::CCFileUtils_vtbl *)v9;
operator delete(v8);
if ( !v9 )
goto LABEL_16;
}
operator delete(v11);
addSearchResolutionsOrder = v5->addSearchResolutionsOrder;
v7 = (char *)addSearchResolutionsOrder - 24;
if ( (__int64 *)((char *)addSearchResolutionsOrder - 24) == &qword_124B6B0 )
goto LABEL_4;
LABEL_11:
if ( &pthread_create )
{
v14 = (unsigned int *)((char *)addSearchResolutionsOrder - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)addSearchResolutionsOrder - 2);
*((_DWORD *)addSearchResolutionsOrder - 2) = v15 - 1;
}
if ( v15 > 0 )
goto LABEL_4;
operator delete(v7);
v16 = v5;
v5 = (cocos2d::CCFileUtils_vtbl *)v9;
operator delete(v16);
}
while ( v9 );
}
LABEL_16:
v17 = a1[2].__vftable;
v18 = a1[3].__vftable;
a1[12].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[10];
v19 = v17;
a1[11].__vftable = nullptr;
a1[13].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[10];
v3[5].__vftable = nullptr;
while ( v18 != v19 )
{
while ( 1 )
{
getClassTypeInfo = v19->getClassTypeInfo;
v21 = (__int64 *)((char *)v19->getClassTypeInfo - 24);
if ( v21 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)((char *)getClassTypeInfo - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)getClassTypeInfo - 2);
*((_DWORD *)getClassTypeInfo - 2) = v23 - 1;
}
if ( v23 <= 0 )
break;
}
v19 = (cocos2d::CCFileUtils_vtbl *)((char *)v19 + 8);
if ( v18 == v19 )
goto LABEL_25;
}
v19 = (cocos2d::CCFileUtils_vtbl *)((char *)v19 + 8);
operator delete(v21);
}
LABEL_25:
a1[3].__vftable = v17;
v24 = 0;
v25 = a1 + 2;
m_start = a2->m_start;
if ( a2->m_start == a2->m_finish )
goto LABEL_48;
do
{
while ( 1 )
{
sub_D18D28(&v39);
if ( !v24 )
v24 = sub_D171E0((int)&v39, &byte_F288A0) == 0;
v27 = v39;
v28 = *((_QWORD *)v39 - 3);
if ( v28 )
{
v29 = v28 - 1;
if ( (*((_DWORD *)v39 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v39);
v27 = v39;
}
if ( v27[v29] != 47 )
sub_D15FD4(&v39, &word_F2A0A8, 1);
}
v30 = v25[1].__vftable;
if ( v30 == v25[2].__vftable )
{
std::vector::_M_emplace_back_aux((__int64)v25, (__int64)&v39);
}
else
{
if ( v30 )
{
sub_D18D28(v30);
v30 = v25[1].__vftable;
}
v25[1].__vftable = (cocos2d::CCFileUtils_vtbl *)&v30->~CCFileUtils;
}
v31 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v39 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v39 - 2);
*((_DWORD *)v39 - 2) = v33 - 1;
}
if ( v33 <= 0 )
break;
}
if ( a2->m_finish == ++m_start )
goto LABEL_45;
}
++m_start;
operator delete(v31);
}
while ( a2->m_finish != m_start );
LABEL_45:
if ( !v24 )
{
LABEL_48:
sub_D153B8((int)&v39, &byte_F288A0);
v34 = v25[1].__vftable;
if ( v34 == v25[2].__vftable )
{
std::vector::_M_emplace_back_aux((__int64)v25, &v39);
v35 = v39;
}
else
{
v35 = v39;
if ( v34 )
{
v34->getClassTypeInfo = (__int64 (__fastcall *)(cocos2d::TypeInfo *__hidden))v39;
v35 = &byte_124B6C8;
v39 = &byte_124B6C8;
}
v25[1].__vftable = (cocos2d::CCFileUtils_vtbl *)&v34->~CCFileUtils;
}
v36 = v35 - 24;
if ( v35 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v35 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v36);
}
}
}