//
// cocos2d::CCFileUtils::addSuffix from 0x100428c20 to 0x100428e41 (545 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b41e90
// > ??> @ 0x100b93fd0
//
// 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
//
__int64 __fastcall cocos2d::CCFileUtils::addSuffix(__int64 a1, __int64 a2, std::string *a3, unsigned __int8 *a4)
{
unsigned int v5; // edx
signed __int64 size; // rdx
unsigned int v7; // r13d
char *v8; // r14
signed __int64 v9; // r13
std::string::pointer v10; // r15
int v11; // ebx
size_t v12; // rdx
char *v13; // rax
char *v14; // r15
std::string::size_type v15; // rax
std::string::pointer data; // rcx
std::string::size_type v17; // rsi
unsigned __int64 v18; // rdx
bool v19; // zf
std::string::size_type v20; // rsi
unsigned int v21; // ecx
const std::string::value_type *v22; // rdx
std::string::size_type v23; // rcx
unsigned int v24; // edx
const std::string::value_type *v25; // rsi
std::string::size_type v26; // rdx
char v28; // [rsp+0h] [rbp-70h]
char *v29; // [rsp+8h] [rbp-68h]
std::string::value_type *v31; // [rsp+20h] [rbp-50h]
std::string::pointer __s; // [rsp+28h] [rbp-48h]
std::string v33; // [rsp+30h] [rbp-40h] BYREF
v5 = (unsigned int)a3->__r_.__value_.__l.0;
v28 = v5;
if ( (v5 & 1) != 0 )
{
size = a3->__r_.__value_.__l.__size_;
__s = a3->__r_.__value_.__l.__data_;
}
else
{
__s = a3->__r_.__value_.__s.__data_;
size = v5 >> 1;
}
v7 = *a4;
v8 = (char *)(a4 + 1);
v31 = (std::string::value_type *)(a4 + 1);
if ( (v7 & 1) != 0 )
{
v8 = *((char **)a4 + 2);
v9 = *((_QWORD *)a4 + 1);
if ( !v9 )
goto LABEL_37;
}
else
{
v9 = v7 >> 1;
if ( !v9 )
{
LABEL_37:
*(_QWORD *)(a1 + 16) = a3->__r_.__value_.__l.__data_;
*(_OWORD *)a1 = *(_OWORD *)&a3->__r_.__value_.__l.0;
*(_OWORD *)&a3->__r_.__value_.__l.0 = 0;
a3->__r_.__value_.__r.__words[2] = 0;
return a1;
}
}
if ( size >= v9 )
{
v10 = __s;
v29 = &__s[size];
v11 = *v8;
do
{
v12 = size - v9 + 1;
if ( !v12 )
break;
v13 = (char *)memchr(v10, v11, v12);
if ( !v13 )
break;
v14 = v13;
if ( !memcmp(v13, v8, v9) )
{
if ( v14 == v29 || v14 - __s == -1 )
break;
goto LABEL_37;
}
v10 = v14 + 1;
size = v29 - v10;
}
while ( v29 - v10 >= v9 );
}
if ( (v28 & 1) != 0 )
sub_10001AD30(&v33, a3->__r_.__value_.__l.__data_, a3->__r_.__value_.__l.__size_);
else
v33 = *a3;
v15 = *(_BYTE *)&v33.__r_.__value_.__l.0 >> 1;
data = v33.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
{
data = v33.__r_.__value_.__l.__data_;
v15 = v33.__r_.__value_.__l.__size_;
}
v17 = v15;
do
{
if ( !v17 )
{
v18 = -1;
break;
}
v18 = v17 - 1;
v19 = data[--v17] == 47;
}
while ( !v19 );
while ( v15 )
{
v20 = v15 - 1;
v19 = data[--v15] == 46;
if ( v19 )
{
if ( v20 != -1 && (v20 > v18 || v18 == -1) )
{
v21 = *a4;
if ( (v21 & 1) != 0 )
{
v22 = *((const std::string::value_type **)a4 + 2);
v23 = *((_QWORD *)a4 + 1);
}
else
{
v23 = v21 >> 1;
v22 = v31;
}
std::string::insert(&v33, v20, v22, v23);
goto LABEL_35;
}
break;
}
}
v24 = *a4;
if ( (v24 & 1) != 0 )
{
v25 = *((const std::string::value_type **)a4 + 2);
v26 = *((_QWORD *)a4 + 1);
}
else
{
v26 = v24 >> 1;
v25 = v31;
}
std::string::append(&v33, v25, v26);
LABEL_35:
*(std::string *)a1 = v33;
return a1;
}