//
// cocos2d::CCFileUtils::addSearchPath from 0x10042ac60 to 0x10042af14 (692 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b41e30
// > ??> @ 0x100b93f70
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:19 +0000
//
void __fastcall cocos2d::CCFileUtils::addSearchPath(__int64 a1, const char *a2)
{
__int64 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
std::string *v21; // r15
std::string *v22; // r15
std::string v23; // [rsp+10h] [rbp-80h] BYREF
std::string __src; // [rsp+30h] [rbp-60h] BYREF
int v25; // [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_100003630();
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 **)(__int64, std::string *))(*(_QWORD *)a1 + 168LL))(a1, __dst) )
std::string::operator=(&__src, (const std::string *)(a1 + 64));
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_100003630();
if ( v11 > 0x16 )
{
v25 = (int)__src.__r_.__value_.__l.0;
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (std::string::value_type *)operator new(v14);
v23.__r_.__value_.__r.__words[0] = v14 | 1;
v23.__r_.__value_.__r.__words[2] = (std::string::size_type)v13;
v23.__r_.__value_.__l.__size_ = v10 + size;
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(v14 | 1);
v2 = a1;
v7 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)v25;
}
else
{
memset(&v23, 0, sizeof(v23));
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v11);
v23.__r_.__value_.__s.0 = v12;
v13 = nullptr;
}
v15 = (*(_BYTE *)&v12 & 1) == 0;
v16 = v23.__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] = v23;
if ( (*(_BYTE *)&v23.__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 *)&v23.__r_.__value_.__s.0 )
goto LABEL_45;
v20 = *(_BYTE *)&v23.__r_.__value_.__l.0 >> 1;
}
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
{
if ( *((_BYTE *)&__dst[0].__r_.__value_.__l.0 + v20) == 47 )
goto LABEL_45;
goto LABEL_44;
}
if ( *(_BYTE *)(__dst[0].__r_.__value_.__r.__words[2] + v20 - 1) != 47 )
LABEL_44:
std::string::append(__dst, "/");
LABEL_45:
v21 = *(std::string **)(v2 + 48);
if ( (unsigned __int64)v21 >= *(_QWORD *)(v2 + 56) )
{
*(_QWORD *)(v2 + 48) = sub_1000568A0(v2 + 40, (__int64)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_52:
operator delete(__dst[0].__r_.__value_.__l.__data_);
}
else
{
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(*(_QWORD **)(v2 + 48), __dst[0].__r_.__value_.__l.__data_, __dst[0].__r_.__value_.__l.__size_);
else
*v21 = __dst[0];
v22 = v21 + 1;
*(_QWORD *)(v2 + 48) = v22;
*(_QWORD *)(v2 + 48) = v22;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_52;
}
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__src.__r_.__value_.__l.__data_);
}