//
// cocos2d::CCFileUtils::removeSearchPath from 0xb09824 to 0xb09af4 (720 bytes)
//
// 3 xrefs:
// > ??> @ 0x575e8
// > ??> @ 0x1217b10
// > ??> @ 0x1217fd0
//
// 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::removeSearchPath(cocos2d::CCFileUtils *a1, const char *a2)
{
void *v3; // x0
_QWORD *v4; // x1
__int64 v5; // x0
__int64 v6; // x19
__int64 v7; // x0
__int64 v8; // x19
cocos2d::CCFileUtils_vtbl *v9; // x1
bool (__fastcall **p_writeToFile)(cocos2d::CCFileUtils *__hidden, cocos2d::CCDictionary *, const std::string *); // x20
cocos2d::CCFileUtils_vtbl *v11; // x0
bool (__fastcall *writeToFile)(cocos2d::CCFileUtils *__hidden, cocos2d::CCDictionary *, const std::string *); // x1
char *v13; // x0
char *v14; // x0
char *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x20
int v23; // w1
char *v24; // [xsp+50h] [xbp+50h] BYREF
_QWORD *v25; // [xsp+58h] [xbp+58h] BYREF
__int64 v26; // [xsp+60h] [xbp+60h] BYREF
v24 = &byte_124B6C8;
sub_D153B8((int)&v25, (char *)a2);
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCFileUtils *, _QWORD **))a1->loadFilenameLookupDictionaryFromFile)(
a1,
&v25) )
sub_D18EA8(&v24, &a1[8]);
sub_D18D28(&v26);
sub_D15E14(&v26, &v25);
sub_D163D4(&v25, &v26);
v3 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v26 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v3);
}
v4 = v25;
v5 = *(v25 - 3);
if ( v5 )
{
v6 = v5 - 1;
if ( (*(_DWORD *)(v25 - 1) & 0x80000000) == 0 )
{
sub_D176A8(&v25);
v4 = v25;
}
if ( *((_BYTE *)v4 + v6) != 47 )
sub_D15FD4(&v25, &word_F2A0A8, 1);
}
v7 = std::__find_if<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_equals_val>(
(__int64)a1[5].__vftable,
(__int64)a1[6].__vftable,
(const void **)&v25);
v8 = v7 + 8;
v9 = a1[6].__vftable;
if ( (cocos2d::CCFileUtils_vtbl *)(v7 + 8) != v9 && (__int64)v9 - v8 > 7 )
{
p_writeToFile = &v9[-1].writeToFile;
while ( 1 )
{
sub_D163D4(v7, v8);
v7 = v8;
if ( p_writeToFile == (bool (__fastcall **)(cocos2d::CCFileUtils *__hidden, cocos2d::CCDictionary *, const std::string *))v8 )
break;
v8 += 8;
}
v9 = a1[6].__vftable;
}
v11 = (cocos2d::CCFileUtils_vtbl *)((char *)v9 - 8);
writeToFile = v9[-1].writeToFile;
a1[6].__vftable = v11;
v13 = (char *)writeToFile - 24;
if ( (__int64 *)((char *)writeToFile - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)((char *)writeToFile - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)writeToFile - 2);
*((_DWORD *)writeToFile - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
v14 = (char *)(v25 - 3);
if ( v25 - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v25 - 1);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v25 - 2);
*((_DWORD *)v25 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v14);
}
v15 = v24 - 24;
if ( v24 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v24 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v15);
}
}