//
// cocos2d::CCFileUtils::fullPathFromRelativeFile from 0x10043c7e0 to 0x10043c9e9 (521 bytes)
//
// 2 xrefs:
// > ??> @ 0x100937fd8
// > ??> @ 0x100980578
//
// 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
//
const char *__fastcall cocos2d::CCFileUtils::fullPathFromRelativeFile(
cocos2d::CCFileUtils *a1,
const char *a2,
const char *a3)
{
double v3; // xmm0_8
cocos2d::CCFileUtils *v5; // r14
size_t v6; // rax
std::string::size_type v7; // r12
char *data; // rbx
size_t v9; // r14
__int64 v10; // r15
size_t v11; // r12
unsigned __int128 v12; // kr00_16
std::string::value_type *v13; // rbx
cocos2d::CCFileUtils *v14; // r13
size_t v15; // r14
const std::string::value_type *v16; // rsi
std::string::size_type v17; // rdx
const char *result; // rax
const char *v19; // rbx
std::string __dst; // [rsp+18h] [rbp-58h] BYREF
std::string::value_type __s[16]; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
v5 = a1;
v6 = strlen(a3);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
data = (char *)operator new(v9);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v9 + 1;
v5 = a1;
__dst.__r_.__value_.__l.__size_ = v7;
goto LABEL_8;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v6);
data = __dst.__r_.__value_.__s.__data_;
if ( v6 )
LABEL_8:
memcpy(data, a3, v7);
data[v7] = 0;
*(_WORD *)__s = 0;
v10 = sub_1007AB360(__s);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
v11 = std::string::rfind(&__dst, 47, 0xFFFFFFFFFFFFFFFFLL) + 1;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
v12 = *(_OWORD *)&__dst.__r_.__value_.__r.__words[1];
else
v12 = __PAIR128__(
(std::string *)((char *)&__dst.__r_.__value_.__l.0 + 1),
*(_BYTE *)&__dst.__r_.__value_.__l.0 >> 1);
if ( (unsigned __int64)v12 < v11 )
v11 = v12;
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
if ( v11 >= 0x17 )
{
v14 = v5;
v15 = 26;
if ( (v11 | 7) != 0x17 )
v15 = (v11 | 7) + 1;
v13 = (std::string::value_type *)operator new(v15);
__p = v13;
*(_QWORD *)__s = v15 | 1;
*(_QWORD *)&__s[8] = v11;
v5 = v14;
goto LABEL_23;
}
__s[0] = 2 * v11;
v13 = &__s[1];
if ( v11 )
LABEL_23:
memmove(v13, *((const void **)&v12 + 1), v11);
v13[v11] = 0;
if ( (*(_BYTE *)(v10 + 56) & 1) != 0 )
operator delete(*(void **)(v10 + 72));
*(_QWORD *)(v10 + 72) = __p;
*(_OWORD *)(v10 + 56) = *(_OWORD *)__s;
((void (__fastcall *)(std::string::value_type *, cocos2d::CCFileUtils *, const char *))v5->setFilenameLookupDictionary)(
__s,
v5,
a2);
if ( (__s[0] & 1) != 0 )
{
v16 = (const std::string::value_type *)__p;
v17 = *(_QWORD *)&__s[8];
}
else
{
v16 = &__s[1];
v17 = (unsigned __int8)__s[0] >> 1;
}
std::string::append((std::string *)(v10 + 56), v16, v17);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
result = cocos2d::CCString::getCString((cocos2d::CCString *)v10);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
v19 = result;
operator delete(__dst.__r_.__value_.__l.__data_);
return v19;
}
return result;
}