//
// cocos2d::CCFileUtils::setSearchPaths from 0x10043cd80 to 0x10043d1c1 (1089 bytes)
//
// 2 xrefs:
// > ??> @ 0x100937ff8
// > ??> @ 0x100980598
//
// 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::setSearchPaths(cocos2d::CCFileUtils *a1, std::vector *const a2)
{
std::string::size_type v2; // xmm0_8
cocos2d::CCFileUtils_vtbl *v3; // rbx
cocos2d::CCFileUtils_vtbl *i; // r14
cocos2d::CCFileUtils *v5; // rbx
std::__vector_base::pointer begin; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v7; // cl
size_t size; // r15
unsigned int sizex2; // eax
size_t v10; // r13
unsigned __int64 v11; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v12; // r12
char *data; // r14
size_t v14; // rbx
std::string::pointer v15; // rsi
char *v16; // r14
std::array *longStorage; // rsi
std::string::size_type v18; // rcx
std::string::pointer v19; // rdx
size_t v20; // rdx
unsigned int v21; // ecx
cocos2d::CCFileUtils_vtbl *v22; // r15
std::string::pointer v23; // rdi
cocos2d::CCFileUtils_vtbl *v24; // rsi
bool v25; // zf
__int64 v26; // rax
cocos2d::CCFileUtils_vtbl *p_addSearchPath; // r15
cocos2d::CCFileUtils *v28; // rsi
cocos2d::CCFileUtils_vtbl *v29; // r15
char *v30; // r15
std::string *v31; // [rsp+0h] [rbp-C0h]
cocos2d::CCFileUtils *v34; // [rsp+28h] [rbp-98h]
std::string __dst; // [rsp+30h] [rbp-90h] BYREF
std::string v36; // [rsp+50h] [rbp-70h] BYREF
unsigned int v37; // [rsp+70h] [rbp-50h]
int v38; // [rsp+74h] [rbp-4Ch]
__int64 v39; // [rsp+78h] [rbp-48h]
std::string v40; // [rsp+80h] [rbp-40h] BYREF
sub_1002EFF50((__int64)&a1[11], &a1[12].getClassTypeInfo);
a1[11].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[12];
v2 = 0;
*(_OWORD *)&a1[12].__vftable = 0;
v3 = a1[5].__vftable;
for ( i = a1[6].__vftable; i != v3; i = (cocos2d::CCFileUtils_vtbl *)((char *)i - 24) )
{
if ( ((__int64)i[-1].setSearchResolutionsOrder & 1) != 0 )
operator delete(i[-1].writeToFile);
}
v34 = a1 + 5;
a1[6].__vftable = v3;
v5 = a1;
begin = a2->__begin_;
if ( a2->__begin_ == a2->__end_ )
goto LABEL_67;
v39 = 0;
do
{
memset(&v36, 0, sizeof(v36));
memset(&v40, 0, sizeof(v40));
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCFileUtils *, std::__vector_base::pointer))v5->loadFilenameLookupDictionaryFromFile)(
v5,
begin) )
std::string::operator=(&v36, (const std::string *)&a1[8]);
v7 = v36.__r_.__value_.__s.0;
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
{
size = v36.__r_.__value_.__l.__size_;
sizex2 = begin->m_data.m_short.sizex2;
v31 = begin;
if ( (sizex2 & 1) == 0 )
goto LABEL_13;
}
else
{
size = *(_BYTE *)&v36.__r_.__value_.__l.0 >> 1;
sizex2 = begin->m_data.m_short.sizex2;
v31 = begin;
if ( (sizex2 & 1) == 0 )
{
LABEL_13:
v10 = sizex2 >> 1;
goto LABEL_16;
}
}
v10 = begin->m_data.m_long.size;
LABEL_16:
v11 = size + v10;
if ( size + v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v37 = sizex2;
if ( v11 > 0x16 )
{
v38 = (int)v36.__r_.__value_.__l.0;
v14 = (v11 | 7) + 1;
if ( (v11 | 7) == 0x17 )
v14 = 26;
data = (char *)operator new(v14);
__dst.__r_.__value_.__r.__words[0] = v14 | 1;
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__l.__size_ = size + v10;
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(v14 | 1);
v5 = a1;
v7 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)v38;
}
else
{
memset(&__dst, 0, sizeof(__dst));
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v11);
__dst.__r_.__value_.__s.0 = v12;
data = nullptr;
}
if ( (*(_BYTE *)&v12 & 1) == 0 )
data = __dst.__r_.__value_.__s.__data_;
if ( size )
{
v15 = v36.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v7 & 1) != 0 )
v15 = v36.__r_.__value_.__l.__data_;
memmove(data, v15, size);
}
v16 = &data[size];
if ( v10 )
{
if ( (v37 & 1) != 0 )
longStorage = (std::array *)v31->m_data.m_long.longStorage;
else
longStorage = &v31->m_data.m_short.shortStorage;
memmove(v16, longStorage, v10);
}
v16[v10] = 0;
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v40.__r_.__value_.__l.__data_);
v40 = __dst;
v2 = __dst.__r_.__value_.__r.__words[0];
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
v18 = v40.__r_.__value_.__l.__size_;
if ( !v40.__r_.__value_.__l.__size_ )
goto LABEL_43;
}
else
{
if ( !*(_BYTE *)&__dst.__r_.__value_.__s.0 )
goto LABEL_43;
v18 = *(_BYTE *)&__dst.__r_.__value_.__l.0 >> 1;
}
v19 = v40.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
v19 = v40.__r_.__value_.__l.__data_;
if ( v19[v18 - 1] != 47 )
std::string::append(&v40, "/");
LABEL_43:
if ( (v39 & 1) != 0 )
goto LABEL_47;
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
{
v20 = v40.__r_.__value_.__l.__size_;
v21 = LOBYTE(v5[8].__vftable);
if ( (v21 & 1) == 0 )
goto LABEL_46;
}
else
{
v20 = *(_BYTE *)&v40.__r_.__value_.__l.0 >> 1;
v21 = LOBYTE(v5[8].__vftable);
if ( (v21 & 1) == 0 )
{
LABEL_46:
if ( v20 != v21 >> 1 )
goto LABEL_47;
goto LABEL_52;
}
}
if ( (cocos2d::CCFileUtils_vtbl *)v20 != v5[9].__vftable )
{
LABEL_47:
v22 = v5[6].__vftable;
if ( v22 >= v5[7].__vftable )
goto LABEL_59;
goto LABEL_48;
}
LABEL_52:
v23 = v40.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
v23 = v40.__r_.__value_.__l.__data_;
v24 = (cocos2d::CCFileUtils_vtbl *)((char *)&a1[8].__vftable + 1);
if ( (v21 & 1) != 0 )
v24 = v5[10].__vftable;
v25 = memcmp(v23, v24, v20) == 0;
v26 = (unsigned __int8)v39;
if ( v25 )
v26 = 1;
v39 = v26;
v22 = v5[6].__vftable;
if ( v22 >= v5[7].__vftable )
{
LABEL_59:
v5[6].__vftable = (cocos2d::CCFileUtils_vtbl *)sub_100054890((__int64)v34, (__int64)&v40, *(double *)&v2);
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_63;
goto LABEL_64;
}
LABEL_48:
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(v22, v40.__r_.__value_.__l.__data_, v40.__r_.__value_.__l.__size_, *(double *)&v2);
}
else
{
v22->~CCFileUtils_0 = (void (__cdecl *)(cocos2d::CCFileUtils *__hidden))v40.__r_.__value_.__l.__data_;
v2 = v40.__r_.__value_.__r.__words[0];
*(_OWORD *)&v22->getClassTypeInfo = *(_OWORD *)&v40.__r_.__value_.__l.0;
}
p_addSearchPath = (cocos2d::CCFileUtils_vtbl *)&v22->addSearchPath;
v5[6].__vftable = p_addSearchPath;
v5[6].__vftable = p_addSearchPath;
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
LABEL_63:
operator delete(v40.__r_.__value_.__l.__data_);
LABEL_64:
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v36.__r_.__value_.__l.__data_);
begin = v31 + 1;
}
while ( &v31[1] != a2->__end_ );
if ( (v39 & 1) == 0 )
{
LABEL_67:
v28 = v5 + 8;
v29 = v5[6].__vftable;
if ( v29 >= v5[7].__vftable )
{
v30 = sub_100054890((__int64)v34, (__int64)v28, *(double *)&v2);
}
else
{
if ( ((__int64)v28->__vftable & 1) != 0 )
{
sub_100006B70(&v5[6].getClassTypeInfo, v5[10].__vftable, (unsigned __int64)v5[9].__vftable, *(double *)&v2);
}
else
{
v29->~CCFileUtils_0 = (void (__cdecl *)(cocos2d::CCFileUtils *__hidden))v5[10].__vftable;
*(_OWORD *)&v29->getClassTypeInfo = *(_OWORD *)&v28->__vftable;
}
v30 = (char *)&v29->addSearchPath;
v5[6].__vftable = (cocos2d::CCFileUtils_vtbl *)v30;
}
v5[6].__vftable = (cocos2d::CCFileUtils_vtbl *)v30;
}
}