//
// cocos2d::CCFileUtils::fullPathFromRelativeFile from 0x10042a220 to 0x10042a429 (521 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b41e08
// > ??> @ 0x100b93f48
//
// 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
//
__int64 __fastcall cocos2d::CCFileUtils::fullPathFromRelativeFile(__int64 a1, __int64 a2, const char *a3)
{
__int64 v4; // r14
size_t v5; // rax
std::string::size_type v6; // r12
char *data; // rbx
size_t v8; // r14
__int64 v9; // r15
size_t v10; // r12
unsigned __int128 v11; // kr00_16
std::string::value_type *v12; // rbx
__int64 v13; // r13
size_t v14; // r14
const std::string::value_type *v15; // rsi
std::string::size_type v16; // rdx
__int64 result; // rax
__int64 v18; // 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]
v4 = a1;
v5 = strlen(a3);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
data = (char *)operator new(v8);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v8 + 1;
v4 = a1;
__dst.__r_.__value_.__l.__size_ = v6;
goto LABEL_8;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v5);
data = __dst.__r_.__value_.__s.__data_;
if ( v5 )
LABEL_8:
memcpy(data, a3, v6);
data[v6] = 0;
*(_WORD *)__s = 0;
v9 = sub_10088E600(__s);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
v10 = std::string::rfind(&__dst, 47, 0xFFFFFFFFFFFFFFFFLL) + 1;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
v11 = *(_OWORD *)&__dst.__r_.__value_.__r.__words[1];
else
v11 = __PAIR128__(
(std::string *)((char *)&__dst.__r_.__value_.__l.0 + 1),
*(_BYTE *)&__dst.__r_.__value_.__l.0 >> 1);
if ( (unsigned __int64)v11 < v10 )
v10 = v11;
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v10 >= 0x17 )
{
v13 = v4;
v14 = 26;
if ( (v10 | 7) != 0x17 )
v14 = (v10 | 7) + 1;
v12 = (std::string::value_type *)operator new(v14);
__p = v12;
*(_QWORD *)__s = v14 | 1;
*(_QWORD *)&__s[8] = v10;
v4 = v13;
goto LABEL_23;
}
__s[0] = 2 * v10;
v12 = &__s[1];
if ( v10 )
LABEL_23:
memmove(v12, *((const void **)&v11 + 1), v10);
v12[v10] = 0;
if ( (*(_BYTE *)(v9 + 56) & 1) != 0 )
operator delete(*(void **)(v9 + 72));
*(_QWORD *)(v9 + 72) = __p;
*(_OWORD *)(v9 + 56) = *(_OWORD *)__s;
(*(void (__fastcall **)(std::string::value_type *, __int64, __int64))(*(_QWORD *)v4 + 200LL))(__s, v4, a2);
if ( (__s[0] & 1) != 0 )
{
v15 = (const std::string::value_type *)__p;
v16 = *(_QWORD *)&__s[8];
}
else
{
v15 = &__s[1];
v16 = (unsigned __int8)__s[0] >> 1;
}
std::string::append((std::string *)(v9 + 56), v15, v16);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
result = cocos2d::CCString::getCString(v9);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
v18 = result;
operator delete(__dst.__r_.__value_.__l.__data_);
return v18;
}
return result;
}