//
// cocos2d::CCFileUtils::getPathForFilename from 0x100428e60 to 0x100429232 (978 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b41e98
// > ??> @ 0x100b93fd8
//
// 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:18 +0000
//
std::string *__fastcall cocos2d::CCFileUtils::getPathForFilename(
std::string *this,
__int64 a2,
unsigned __int8 *a3,
unsigned __int8 *a4,
__int64 a5)
{
unsigned __int8 v7; // al
const std::string::value_type *v8; // rsi
unsigned __int8 *v9; // rdx
char *v10; // r14
__int64 v11; // r15
size_t v12; // rdi
size_t v13; // rcx
__int64 v14; // r15
size_t v15; // r13
size_t v17; // rbx
char *v18; // rax
unsigned int v19; // ecx
unsigned __int64 v20; // rcx
unsigned __int8 *v21; // rsi
size_t v22; // rdi
size_t v23; // r14
char *v24; // r12
size_t v25; // rbx
std::string::size_type v26; // rdx
unsigned int v27; // edx
std::string::size_type v28; // rdx
const std::string::value_type *v29; // r14
__int64 v32; // [rsp+18h] [rbp-B8h]
std::string *v34; // [rsp+30h] [rbp-A0h]
unsigned __int8 *v35; // [rsp+38h] [rbp-98h]
__int128 v36; // [rsp+40h] [rbp-90h] BYREF
void *v37; // [rsp+50h] [rbp-80h]
unsigned __int8 **v38; // [rsp+60h] [rbp-70h]
void *__dst; // [rsp+68h] [rbp-68h]
std::string::value_type __s[16]; // [rsp+70h] [rbp-60h] BYREF
void *__p; // [rsp+80h] [rbp-50h]
__int128 v42; // [rsp+90h] [rbp-40h] BYREF
void *v43; // [rsp+A0h] [rbp-30h]
v7 = *a3;
if ( (*a3 & 1) != 0 )
{
v11 = a5;
v38 = (unsigned __int8 **)(a3 + 16);
sub_10001AD30(&v36, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
v7 = *a3;
v9 = a3 + 1;
*(_WORD *)__s = 0;
v8 = &__s[1];
if ( (v7 & 1) != 0 )
{
v10 = *((char **)a3 + 2);
a5 = v11;
v12 = *((_QWORD *)a3 + 1);
goto LABEL_7;
}
a5 = v11;
v10 = (char *)(a3 + 1);
}
else
{
v37 = *((void **)a3 + 2);
v36 = *(_OWORD *)a3;
v38 = (unsigned __int8 **)(a3 + 16);
*(_WORD *)__s = 0;
v8 = &__s[1];
v9 = a3 + 1;
v10 = (char *)(a3 + 1);
}
v12 = v7 >> 1;
LABEL_7:
v13 = v12 + 1;
v14 = -(__int64)v12;
do
{
if ( v13 == 1 )
goto LABEL_39;
v15 = v13 - 1;
++v14;
}
while ( v10[v13-- - 2] != 47 );
if ( v15 )
{
v34 = this;
v17 = v15;
if ( v12 < v15 )
v17 = v12;
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v35 = v9;
v32 = a5;
if ( v17 >= 0x17 )
{
v22 = 26;
if ( (v17 | 7) != 0x17 )
v22 = (v17 | 7) + 1;
__dst = (void *)v22;
v18 = (char *)operator new(v22);
v43 = v18;
*(_QWORD *)&v42 = (unsigned __int64)__dst | 1;
*((_QWORD *)&v42 + 1) = v17;
}
else
{
LOBYTE(v42) = 2 * v17;
v18 = (char *)&v42 + 1;
if ( !v12 )
{
*((_BYTE *)&v42 + v17 + 1) = 0;
if ( (__s[0] & 1) == 0 )
goto LABEL_18;
goto LABEL_17;
}
}
__dst = v18;
memmove(v18, v10, v17);
*((_BYTE *)__dst + v17) = 0;
if ( (__s[0] & 1) == 0 )
{
LABEL_18:
__p = v43;
*(_OWORD *)__s = v42;
v19 = *a3;
this = v34;
if ( (v19 & 1) != 0 )
{
v20 = *((_QWORD *)a3 + 1);
if ( v20 <= v15 - 1 )
goto LABEL_56;
v21 = *v38;
}
else
{
v20 = v19 >> 1;
v21 = v35;
if ( v15 - 1 >= v20 )
LABEL_56:
sub_100056810();
}
v23 = v20 - v15;
if ( v20 - v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v38 = (unsigned __int8 **)v20;
if ( v23 >= 0x17 )
{
v25 = 26;
if ( (v23 | 7) != 0x17 )
v25 = (v23 | 7) + 1;
v24 = (char *)operator new(v25);
v43 = v24;
*(_QWORD *)&v42 = v25 | 1;
*((_QWORD *)&v42 + 1) = v23;
this = v34;
}
else
{
LOBYTE(v42) = 2 * (v20 - v15);
v24 = (char *)&v42 + 1;
if ( v20 == v15 )
goto LABEL_36;
}
memmove(v24, &v21[v15], v23);
LABEL_36:
*((_BYTE *)v38 + (_QWORD)v24 + v14 - 1) = 0;
if ( (v36 & 1) != 0 )
operator delete(v37);
v37 = v43;
v36 = v42;
v8 = &__s[1];
a5 = v32;
goto LABEL_39;
}
LABEL_17:
operator delete(__p);
goto LABEL_18;
}
LABEL_39:
if ( (*(_BYTE *)a5 & 1) != 0 )
{
sub_10001AD30(this, *(const void **)(a5 + 16), *(_QWORD *)(a5 + 8));
}
else
{
this->__r_.__value_.__r.__words[2] = *(_QWORD *)(a5 + 16);
*(_OWORD *)&this->__r_.__value_.__l.0 = *(_OWORD *)a5;
}
if ( (__s[0] & 1) != 0 )
{
v8 = (const std::string::value_type *)__p;
v26 = *(_QWORD *)&__s[8];
}
else
{
v26 = (unsigned __int8)__s[0] >> 1;
}
std::string::append(this, v8, v26);
v27 = *a4;
if ( (v27 & 1) != 0 )
{
v28 = *((_QWORD *)a4 + 1);
v29 = *((const std::string::value_type **)a4 + 2);
}
else
{
v29 = (const std::string::value_type *)(a4 + 1);
v28 = v27 >> 1;
}
std::string::append(this, v29, v28);
(*(void (__fastcall **)(__int128 *, __int64, std::string *, __int128 *))(*(_QWORD *)a2 + 232LL))(&v42, a2, this, &v36);
if ( (*(_BYTE *)&this->__r_.__value_.__s.0 & 1) != 0 )
operator delete(this->__r_.__value_.__l.__data_);
this->__r_.__value_.__r.__words[2] = (std::string::size_type)v43;
*(_OWORD *)&this->__r_.__value_.__l.0 = v42;
if ( (__s[0] & 1) != 0 )
operator delete(__p);
if ( (v36 & 1) != 0 )
operator delete(v37);
return this;
}