//
// cocos2d::CCFileUtils::getNewFilename from 0x100428a70 to 0x100428bd6 (358 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b41e80
// > ??> @ 0x100b93fc0
//
// 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
//
_QWORD *__fastcall cocos2d::CCFileUtils::getNewFilename(_QWORD *a1, __int64 a2, const char *a3)
{
const char *CString; // r14
__int64 v4; // r15
size_t v5; // rax
size_t v6; // r12
char *v7; // r13
size_t v8; // r14
__int64 v9; // r15
size_t v10; // rax
size_t v11; // r15
void *v12; // r12
const char *v13; // r13
size_t v14; // r14
const char *v16; // [rsp+8h] [rbp-48h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
CString = a3;
v4 = *(_QWORD *)(a2 + 8);
if ( !v4 )
goto LABEL_15;
v5 = strlen(a3);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_24;
v6 = v5;
if ( v5 >= 0x17 )
{
v16 = CString;
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst[0] = v8 + 1;
CString = v16;
__dst[1] = v6;
}
else
{
LOBYTE(__dst[0]) = 2 * v5;
v7 = (char *)__dst + 1;
if ( !v5 )
goto LABEL_10;
}
memcpy(v7, CString, v6);
LABEL_10:
v7[v6] = 0;
v9 = cocos2d::CCDictionary::objectForKey(v4, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( v9 && (unsigned int)cocos2d::CCString::length(v9) )
CString = (const char *)cocos2d::CCString::getCString(v9);
LABEL_15:
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_24:
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = CString;
v14 = 26;
if ( (v10 | 7) != 0x17 )
v14 = (v10 | 7) + 1;
v12 = operator new(v14);
a1[2] = v12;
*a1 = v14 + 1;
CString = v13;
a1[1] = v11;
}
else
{
*(_BYTE *)a1 = 2 * v10;
v12 = (char *)a1 + 1;
if ( !v10 )
goto LABEL_23;
}
memmove(v12, CString, v11);
LABEL_23:
*((_BYTE *)v12 + v11) = 0;
return a1;
}