//
// cocos2d::CCFileUtils::setSearchResolutionsOrder from 0x10043ca40 to 0x10043cc52 (530 bytes)
//
// 2 xrefs:
// > ??> @ 0x100937fe0
// > ??> @ 0x100980580
//
// 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::setSearchResolutionsOrder(
cocos2d::CCFileUtils *a1,
std::vector *const a2)
{
__int128 v2; // xmm0
cocos2d::CCFileUtils_vtbl *v3; // r15
cocos2d::CCFileUtils_vtbl *i; // r12
std::__vector_base::pointer begin; // r15
char v6; // r12
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 v7; // rax
std::string::size_type size; // rax
std::string::pointer data; // rdx
cocos2d::CCFileUtils_vtbl *v10; // r13
cocos2d::CCFileUtils_vtbl *p_addSearchPath; // r13
cocos2d::CCFileUtils *v12; // [rsp+8h] [rbp-48h]
std::string v13; // [rsp+10h] [rbp-40h] BYREF
sub_1002EFF50((__int64)&a1[11], &a1[12].getClassTypeInfo);
a1[11].__vftable = (cocos2d::CCFileUtils_vtbl *)&a1[12];
*(_QWORD *)&v2 = 0;
*(_OWORD *)&a1[12].__vftable = 0;
v3 = a1[2].__vftable;
for ( i = a1[3].__vftable; i != v3; i = (cocos2d::CCFileUtils_vtbl *)((char *)i - 24) )
{
if ( ((__int64)i[-1].setSearchResolutionsOrder & 1) != 0 )
operator delete(i[-1].writeToFile);
}
v12 = a1 + 2;
a1[3].__vftable = v3;
begin = a2->__begin_;
if ( a2->__begin_ == a2->__end_ )
goto LABEL_34;
v6 = 0;
do
{
if ( (begin->m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v13, begin->m_data.m_long.longStorage, begin->m_data.m_long.size, *(double *)&v2);
v7 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&v13.__r_.__value_.__l.0;
if ( (v6 & 1) == 0 )
{
LABEL_12:
if ( (*(_BYTE *)&v7 & 1) == 0 )
{
if ( !*(_QWORD *)&v7 )
goto LABEL_20;
goto LABEL_18;
}
size = v13.__r_.__value_.__l.__size_;
if ( !v13.__r_.__value_.__l.__size_ )
{
LABEL_20:
v6 = 1;
goto LABEL_25;
}
goto LABEL_22;
}
}
else
{
v13.__r_.__value_.__r.__words[2] = (std::string::size_type)begin->m_data.m_long.longStorage;
v2 = *(_OWORD *)&begin->m_data.m_short.sizex2;
*(_OWORD *)&v13.__r_.__value_.__l.0 = *(_OWORD *)&begin->m_data.m_short.sizex2;
v7 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&v13.__r_.__value_.__l.0;
if ( (v6 & 1) == 0 )
goto LABEL_12;
}
if ( (*(_BYTE *)&v7 & 1) == 0 )
{
if ( !*(_QWORD *)&v7 )
goto LABEL_25;
LABEL_18:
size = *(_DWORD *)&v7 >> 1;
data = v13.__r_.__value_.__s.__data_;
goto LABEL_23;
}
size = v13.__r_.__value_.__l.__size_;
if ( !v13.__r_.__value_.__l.__size_ )
goto LABEL_25;
LABEL_22:
data = v13.__r_.__value_.__l.__data_;
LABEL_23:
if ( data[size - 1] != 47 )
std::string::append(&v13, "/");
LABEL_25:
v10 = a1[3].__vftable;
if ( v10 >= a1[4].__vftable )
{
a1[3].__vftable = (cocos2d::CCFileUtils_vtbl *)sub_100054890((__int64)v12, (__int64)&v13, *(double *)&v2);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_8;
}
else
{
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(
&a1[3].getClassTypeInfo,
v13.__r_.__value_.__l.__data_,
v13.__r_.__value_.__l.__size_,
*(double *)&v2);
}
else
{
v10->~CCFileUtils_0 = (void (__cdecl *)(cocos2d::CCFileUtils *__hidden))v13.__r_.__value_.__l.__data_;
*(_QWORD *)&v2 = v13.__r_.__value_.__r.__words[0];
*(_OWORD *)&v10->getClassTypeInfo = *(_OWORD *)&v13.__r_.__value_.__l.0;
}
p_addSearchPath = (cocos2d::CCFileUtils_vtbl *)&v10->addSearchPath;
a1[3].__vftable = p_addSearchPath;
a1[3].__vftable = p_addSearchPath;
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
LABEL_8:
operator delete(v13.__r_.__value_.__l.__data_);
}
++begin;
}
while ( begin != a2->__end_ );
if ( (v6 & 1) == 0 )
{
LABEL_34:
*(_WORD *)&v13.__r_.__value_.__l.0 = 0;
sub_10017A000((__int64)v12, (__int64)&v13);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v13.__r_.__value_.__l.__data_);
}
}