//
// cocos2d::CCFileUtils::getNewFilename from 0xb04f04 to 0xb05014 (272 bytes)
//
// 3 xrefs:
// > ??> @ 0x828f0
// > ??> @ 0x1217b58
// > ??> @ 0x1218018
//
// 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
//
__int64 __usercall cocos2d::CCFileUtils::getNewFilename@(
cocos2d::CCFileUtils *this@,
char *a2@,
__int64 a3@)
{
__int64 v3; // x22
char *CString; // x23
cocos2d::CCString *v6; // x22
char *v7; // x0
unsigned int *v9; // x2
int v10; // w1
const char *v11; // [xsp+50h] [xbp+50h] BYREF
v3 = *((_QWORD *)this + 1);
CString = a2;
if ( v3 )
{
sub_D153B8((int)&v11, a2);
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v3, &v11);
v7 = (char *)(v11 - 24);
if ( v11 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v11 - 2);
*((_DWORD *)v11 - 2) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
if ( v6 && cocos2d::CCString::length(v6) )
CString = (char *)cocos2d::CCString::getCString(v6);
}
sub_D153B8(a3, CString);
return a3;
}