//
// cocos2d::CCFileUtils::getNewFilename from 0x1800701e0 to 0x180070324 (324 bytes)
//
// 4 xrefs:
// > ??> @ 0x1801003f8
// > ??> @ 0x180101120
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b4224
//
// 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
//
// Hidden C++ exception states: #wind=1
_QWORD *__fastcall cocos2d::CCFileUtils::getNewFilename(__int64 a1, _QWORD *a2, std::string *CString)
{
char v6; // r14
size_t v7; // rbx
size_t v8; // r8
cocos2d::CCString *v9; // rbp
void *v10; // rcx
void *Block[2]; // [rsp+30h] [rbp-58h] BYREF
__m128i si128; // [rsp+40h] [rbp-48h]
v6 = 0;
v7 = -1;
if ( *(_QWORD *)(a1 + 8) )
{
*(_OWORD *)Block = 0;
si128 = 0;
v8 = -1;
do
++v8;
while ( CString->m_data.m_smallStorage._Elems[v8] );
sub_18000CE60(Block, CString, v8);
v6 = 1;
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 8), (unsigned __int8 *)Block);
}
else
{
v9 = nullptr;
}
if ( (v6 & 1) != 0 )
{
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v10);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block[0]) = 0;
}
if ( v9 && (unsigned int)cocos2d::CCString::length(v9) )
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 0;
do
++v7;
while ( CString->m_data.m_smallStorage._Elems[v7] );
sub_18000CE60(a2, CString, v7);
return a2;
}