//
// cocos2d::CCFileUtils::setSearchPaths from 0xb062e8 to 0xb067cc (1252 bytes)
//
// 3 xrefs:
// > ??> @ 0xc7f20
// > ??> @ 0x1217b00
// > ??> @ 0x1217fc0
//
// 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::setSearchPaths(cocos2d::CCFileUtils *a1, std::vector *const a2)
{
cocos2d::CCFileUtils *v2; // x21
cocos2d::CCFileUtils_vtbl *v4; // x20
void (__fastcall *addSearchResolutionsOrder)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *); // x1
char *v7; // x0
cocos2d::CCFileUtils_vtbl *v8; // x0
void (__fastcall *v9)(cocos2d::CCFileUtils *__hidden); // x24
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; // x24
cocos2d::CCFileUtils_vtbl *v18; // x22
cocos2d::CCFileUtils_vtbl *v19; // x20
__int64 (__fastcall *getClassTypeInfo)(cocos2d::TypeInfo *__hidden); // x1
__int64 *v21; // x0
unsigned int *v22; // x1
int v23; // w2
std::string *m_start; // x21
cocos2d::CCFileUtils *v25; // x23
_BOOL4 v26; // w26
cocos2d::CCFileUtils *v27; // x28
void (__fastcall *loadFilenameLookupDictionaryFromFile)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *); // x3
void *v29; // x0
char *v30; // x2
__int64 v31; // x0
__int64 v32; // x1
size_t v33; // x2
cocos2d::CCFileUtils_vtbl *v34; // x0
char *v35; // x1
char *v36; // x0
char *v37; // x1
char *v38; // x0
cocos2d::CCFileUtils_vtbl *v39; // x0
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
__int64 v46; // [xsp+78h] [xbp+78h]
char *v47; // [xsp+90h] [xbp+90h] BYREF
char *v48; // [xsp+98h] [xbp+98h] BYREF
__int64 v49; // [xsp+A0h] [xbp+A0h] BYREF
v2 = a1 + 9;
v4 = a1[11].__vftable;
if ( v4 )
{
do
{
while ( 1 )
{
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_erase(
(__int64)v2,
(_QWORD *)v4->addSearchPath);
v9 = v4->~CCFileUtils_0;
addSuffix = v4->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 = v4->addSearchResolutionsOrder;
v7 = (char *)addSearchResolutionsOrder - 24;
if ( (__int64 *)((char *)addSearchResolutionsOrder - 24) != &qword_124B6B0 )
goto LABEL_11;
LABEL_4:
v8 = v4;
v4 = (cocos2d::CCFileUtils_vtbl *)v9;
operator delete(v8);
if ( !v9 )
goto LABEL_16;
}
operator delete(v11);
addSearchResolutionsOrder = v4->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 = v4;
v4 = (cocos2d::CCFileUtils_vtbl *)v9;
operator delete(v16);
}
while ( v9 );
}
LABEL_16:
v17 = a1[5].__vftable;
v18 = a1[6].__vftable;
a1[12].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[10];
v19 = v17;
a1[11].__vftable = nullptr;
a1[13].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[10];
v2[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[6].__vftable = v17;
m_start = a2->m_start;
if ( a2->m_start == a2->m_finish )
{
v25 = a1 + 5;
v39 = v17;
goto LABEL_45;
}
v25 = a1 + 5;
v26 = 0;
v27 = a1 + 8;
do
{
loadFilenameLookupDictionaryFromFile = a1->loadFilenameLookupDictionaryFromFile;
v47 = &byte_124B6C8;
v48 = &byte_124B6C8;
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCFileUtils *, std::string *))loadFilenameLookupDictionaryFromFile)(
a1,
m_start) )
sub_D18EA8(&v47, &a1[8]);
sub_D18D28(&v49);
sub_D15E14(&v49, m_start);
sub_D163D4(&v48, &v49);
v29 = (void *)(v49 - 24);
if ( (__int64 *)(v49 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v49 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(v49 - 8);
*(_DWORD *)(v49 - 8) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v29);
}
v30 = v48;
v31 = *((_QWORD *)v48 - 3);
if ( v31 )
{
v32 = v31 - 1;
if ( (*((_DWORD *)v48 - 2) & 0x80000000) == 0 )
{
v46 = v31 - 1;
sub_D176A8(&v48);
v30 = v48;
v32 = v46;
}
if ( v30[v32] != 47 )
sub_D15FD4(&v48, &word_F2A0A8, 1);
}
if ( !v26
&& (v33 = *((_QWORD *)v48 - 3),
(void (__fastcall *)(cocos2d::CCFileUtils *__hidden, const std::vector *))v33 == v27->__vftable[-1].setSearchResolutionsOrder) )
{
v26 = memcmp(v48, v27->__vftable, v33) == 0;
v34 = a1[6].__vftable;
if ( v34 != a1[7].__vftable )
{
LABEL_38:
if ( v34 )
{
sub_D18D28(v34);
v34 = a1[6].__vftable;
}
a1[6].__vftable = (cocos2d::CCFileUtils_vtbl *)&v34->~CCFileUtils;
v35 = v48;
v36 = v48 - 24;
if ( v48 - 24 == (char *)&qword_124B6B0 )
goto LABEL_41;
goto LABEL_52;
}
}
else
{
v34 = a1[6].__vftable;
if ( v34 != a1[7].__vftable )
goto LABEL_38;
}
std::vector::_M_emplace_back_aux((__int64)&a1[5], (__int64)&v48);
v35 = v48;
v36 = v48 - 24;
if ( v48 - 24 == (char *)&qword_124B6B0 )
goto LABEL_41;
LABEL_52:
if ( &pthread_create )
{
v40 = (unsigned int *)(v35 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v41 - 1;
}
if ( v41 <= 0 )
{
operator delete(v36);
v37 = v47;
v38 = v47 - 24;
if ( v47 - 24 == (char *)&qword_124B6B0 )
goto LABEL_42;
goto LABEL_57;
}
LABEL_41:
v37 = v47;
v38 = v47 - 24;
if ( v47 - 24 == (char *)&qword_124B6B0 )
goto LABEL_42;
LABEL_57:
if ( &pthread_create )
{
v42 = (unsigned int *)(v37 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v37 - 2);
*((_DWORD *)v37 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v38);
LABEL_42:
++m_start;
}
while ( a2->m_finish != m_start );
if ( !v26 )
{
v39 = a1[6].__vftable;
LABEL_45:
if ( v25[2].__vftable == v39 )
{
std::vector::_M_emplace_back_aux((__int64)v25, (__int64)&a1[8]);
}
else
{
if ( v39 )
{
sub_D18D28(v39);
v39 = v25[1].__vftable;
}
v25[1].__vftable = (cocos2d::CCFileUtils_vtbl *)&v39->~CCFileUtils;
}
}
}