//
// cocos2d::CCFileUtils::removeSearchPath from 0x10043d530 to 0x10043d88c (860 bytes)
//
// 2 xrefs:
// > ??> @ 0x100938008
// > ??> @ 0x1009805a8
//
// 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 __fastcall cocos2d::CCFileUtils::removeSearchPath(cocos2d::CCFileUtils *a1, const char *a2)
{
cocos2d::CCFileUtils *v2; // rbx
size_t v3; // rax
std::string::size_type v4; // r15
char *data; // r12
size_t v6; // r13
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v7; // cl
size_t size; // r15
unsigned int v9; // r13d
size_t v10; // r14
unsigned __int64 v11; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v12; // r12
std::string::value_type *v13; // rax
size_t v14; // rbx
bool v15; // zf
std::string::value_type *v16; // r12
std::string::pointer v17; // rsi
char *v18; // r12
std::string::pointer v19; // rsi
std::string::size_type v20; // rcx
cocos2d::CCFileUtils_vtbl *v21; // r13
unsigned __int8 *v22; // r12
size_t v23; // r14
std::string::pointer v24; // r15
void (__cdecl *v25)(cocos2d::CCFileUtils *__hidden); // rdi
unsigned int getClassTypeInfo_low; // eax
cocos2d::CCFileUtils *v27; // r15
unsigned __int8 *v28; // rbx
unsigned __int8 *v29; // rax
std::string v30; // [rsp+10h] [rbp-80h] BYREF
std::string __src; // [rsp+30h] [rbp-60h] BYREF
int v32; // [rsp+4Ch] [rbp-44h]
std::string __dst[2]; // [rsp+50h] [rbp-40h] BYREF
v2 = a1;
memset(&__src, 0, sizeof(__src));
v3 = strlen(a2);
if ( v3 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v4 = v3;
if ( v3 >= 0x17 )
{
v6 = 26;
if ( (v3 | 7) != 0x17 )
v6 = (v3 | 7) + 1;
data = (char *)operator new(v6);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v6 | 1;
__dst[0].__r_.__value_.__l.__size_ = v4;
goto LABEL_8;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v3);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v3 )
LABEL_8:
memcpy(data, a2, v4);
data[v4] = 0;
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCFileUtils *, std::string *))a1->loadFilenameLookupDictionaryFromFile)(
a1,
__dst) )
std::string::operator=(&__src, (const std::string *)&a1[8]);
v7 = __src.__r_.__value_.__s.0;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) != 0 )
{
size = __src.__r_.__value_.__l.__size_;
v9 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_13:
v10 = v9 >> 1;
goto LABEL_16;
}
}
else
{
size = *(_BYTE *)&__src.__r_.__value_.__l.0 >> 1;
v9 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_13;
}
v10 = __dst[0].__r_.__value_.__l.__size_;
LABEL_16:
v11 = v10 + size;
if ( v10 + size >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
if ( v11 > 0x16 )
{
v32 = (int)__src.__r_.__value_.__l.0;
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (std::string::value_type *)operator new(v14);
v30.__r_.__value_.__r.__words[0] = v14 | 1;
v30.__r_.__value_.__r.__words[2] = (std::string::size_type)v13;
v30.__r_.__value_.__l.__size_ = v10 + size;
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(v14 | 1);
v2 = a1;
v7 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)v32;
}
else
{
memset(&v30, 0, sizeof(v30));
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v11);
v30.__r_.__value_.__s.0 = v12;
v13 = nullptr;
}
v15 = (*(_BYTE *)&v12 & 1) == 0;
v16 = v30.__r_.__value_.__s.__data_;
if ( !v15 )
v16 = v13;
if ( size )
{
if ( (*(_BYTE *)&v7 & 1) != 0 )
v17 = __src.__r_.__value_.__l.__data_;
else
v17 = __src.__r_.__value_.__s.__data_;
memmove(v16, v17, size);
}
v18 = &v16[size];
if ( v10 )
{
if ( (v9 & 1) != 0 )
v19 = __dst[0].__r_.__value_.__l.__data_;
else
v19 = __dst[0].__r_.__value_.__s.__data_;
memmove(v18, v19, v10);
}
v18[v10] = 0;
if ( (v9 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
__dst[0] = v30;
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
{
v20 = __dst[0].__r_.__value_.__l.__size_;
if ( !__dst[0].__r_.__value_.__l.__size_ )
goto LABEL_45;
}
else
{
if ( !*(_BYTE *)&v30.__r_.__value_.__s.0 )
goto LABEL_45;
v20 = *(_BYTE *)&v30.__r_.__value_.__l.0 >> 1;
}
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
{
if ( *(_BYTE *)(__dst[0].__r_.__value_.__r.__words[2] + v20 - 1) == 47 )
goto LABEL_45;
goto LABEL_44;
}
if ( *((_BYTE *)&__dst[0].__r_.__value_.__l.0 + v20) != 47 )
LABEL_44:
std::string::append(__dst, "/");
LABEL_45:
v21 = v2[5].__vftable;
v22 = (unsigned __int8 *)v2[6].__vftable;
if ( v21 == (cocos2d::CCFileUtils_vtbl *)v22 )
goto LABEL_61;
v23 = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v23 = __dst[0].__r_.__value_.__l.__size_;
v24 = __dst[0].__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v24 = __dst[0].__r_.__value_.__l.__data_;
do
{
getClassTypeInfo_low = LOBYTE(v21->getClassTypeInfo);
if ( (getClassTypeInfo_low & 1) != 0 )
{
if ( v21->~CCFileUtils != (void (__cdecl *)(cocos2d::CCFileUtils *__hidden))v23 )
goto LABEL_53;
}
else if ( getClassTypeInfo_low >> 1 != v23 )
{
goto LABEL_53;
}
if ( (getClassTypeInfo_low & 1) != 0 )
v25 = v21->~CCFileUtils_0;
else
v25 = (void (__cdecl *)(cocos2d::CCFileUtils *__hidden))((char *)&v21->getClassTypeInfo + 1);
if ( !memcmp(v25, v24, v23) )
goto LABEL_61;
LABEL_53:
v21 = (cocos2d::CCFileUtils_vtbl *)((char *)v21 + 24);
}
while ( v21 != (cocos2d::CCFileUtils_vtbl *)v22 );
v21 = (cocos2d::CCFileUtils_vtbl *)v22;
LABEL_61:
v27 = v2;
if ( &v21->addSearchPath == (void (__cdecl **)(cocos2d::CCFileUtils *__hidden, const char *))v22 )
{
v28 = (unsigned __int8 *)v21;
}
else
{
v28 = (unsigned __int8 *)v21;
do
{
if ( (*v28 & 1) != 0 )
operator delete(*((void **)v28 + 2));
v29 = v28;
*((_QWORD *)v28 + 2) = *((_QWORD *)v28 + 5);
*(_OWORD *)v28 = *(_OWORD *)(v28 + 24);
*((_WORD *)v28 + 12) = 0;
v28 += 24;
}
while ( v29 + 48 != v22 );
v22 = (unsigned __int8 *)v27[6].__vftable;
}
while ( v22 != v28 )
{
if ( (*(v22 - 24) & 1) != 0 )
operator delete(*((void **)v22 - 1));
v22 -= 24;
}
v27[6].__vftable = (cocos2d::CCFileUtils_vtbl *)v28;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__src.__r_.__value_.__l.__data_);
}