//
// cocos2d::CCFileUtilsMac::isFileExist from 0x10060ba60 to 0x10060bd93 (819 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009805c8
//
// 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 __fastcall cocos2d::CCFileUtilsMac::isFileExist(double a1, __int64 a2, __int64 a3)
{
char *v3; // rbx
_BYTE *v4; // rsi
unsigned __int64 v5; // rdx
NSString *v6; // rax
unsigned __int64 v7; // r12
char *v8; // r15
char *v9; // rdx
size_t v10; // r13
size_t v11; // rsi
__int64 v12; // r13
size_t v13; // r14
size_t v16; // rdx
char *v17; // rax
size_t v18; // rbx
size_t v19; // rax
char *v20; // r15
char *v21; // r12
size_t v22; // rbx
NSBundle *v23; // r14
char *v24; // rdx
NSString *v25; // r15
NSString *v26; // rax
char *v27; // [rsp+8h] [rbp-78h]
__int128 v28; // [rsp+10h] [rbp-70h] BYREF
void *v29; // [rsp+20h] [rbp-60h]
__int128 __dst; // [rsp+28h] [rbp-58h] BYREF
void *v31; // [rsp+38h] [rbp-48h]
size_t v32[2]; // [rsp+40h] [rbp-40h] BYREF
void *__p; // [rsp+50h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
{
v5 = *(_QWORD *)(a3 + 8);
if ( v5 )
{
v4 = *(_BYTE **)(a3 + 16);
if ( *v4 == 47 )
goto LABEL_7;
sub_100006B70(v32, v4, v5, a1);
goto LABEL_11;
}
LABEL_8:
LODWORD(v3) = 0;
return (unsigned int)v3;
}
if ( !*(_BYTE *)a3 )
goto LABEL_8;
if ( *(_BYTE *)(a3 + 1) == 47 )
{
v4 = (_BYTE *)(a3 + 1);
LABEL_7:
v3 = (char *)qword_1009A3508;
v6 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v4);
LOBYTE(v3) = (unsigned __int8)objc_msgSend(v3, "fileExistsAtPath:", v6) != 0;
return (unsigned int)v3;
}
__p = *(void **)(a3 + 16);
*(_OWORD *)v32 = *(_OWORD *)a3;
LABEL_11:
v28 = 0;
v29 = nullptr;
v7 = LOBYTE(v32[0]) >> 1;
v8 = (char *)__p;
v9 = (char *)__p;
v27 = (char *)v32 + 1;
if ( (v32[0] & 1) == 0 )
v9 = (char *)v32 + 1;
v10 = v32[1];
if ( (v32[0] & 1) == 0 )
v10 = LOBYTE(v32[0]) >> 1;
v11 = v10 + 1;
v12 = -(__int64)v10;
do
{
if ( v11 == 1 )
goto LABEL_19;
v13 = v11 - 1;
++v12;
}
while ( v9[v11-- - 2] != 47 );
if ( v13 )
{
if ( (v32[0] & 1) != 0 )
{
v7 = v32[1];
if ( v32[1] <= v13 - 1 )
LABEL_25:
sub_1000547C0();
}
else
{
v8 = (char *)v32 + 1;
if ( v13 - 1 >= v7 )
goto LABEL_25;
}
v16 = v7 - v13;
if ( v7 - v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
if ( v16 >= 0x17 )
{
v18 = 26;
if ( (v16 | 7) != 0x17 )
v18 = (v16 | 7) + 1;
v17 = (char *)operator new(v18);
v31 = v17;
*(_QWORD *)&__dst = v18 | 1;
v16 = v7 - v13;
*((_QWORD *)&__dst + 1) = v7 - v13;
}
else
{
LOBYTE(__dst) = 2 * (v7 - v13);
v17 = (char *)&__dst + 1;
if ( v7 == v13 )
{
LABEL_35:
v17[v7 - 1 + v12] = 0;
if ( (v28 & 1) != 0 )
operator delete(v29);
v29 = v31;
v28 = __dst;
if ( (v32[0] & 1) != 0 )
{
v19 = v32[1];
v20 = (char *)__p;
}
else
{
v19 = LOBYTE(v32[0]) >> 1;
v20 = (char *)v32 + 1;
}
if ( v19 < v13 )
v13 = v19;
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&__dst);
if ( v13 >= 0x17 )
{
v22 = 26;
if ( (v13 | 7) != 0x17 )
v22 = (v13 | 7) + 1;
v21 = (char *)operator new(v22);
v31 = v21;
v3 = (char *)(v22 | 1);
*(_QWORD *)&__dst = v3;
*((_QWORD *)&__dst + 1) = v13;
}
else
{
LOBYTE(__dst) = 2 * v13;
v21 = (char *)&__dst + 1;
if ( !v19 )
goto LABEL_50;
}
memmove(v21, v20, v13);
LABEL_50:
v21[v13] = 0;
if ( (v32[0] & 1) != 0 )
operator delete(__p);
__p = v31;
*(_OWORD *)v32 = __dst;
v23 = +[NSBundle mainBundle](&OBJC_CLASS___NSBundle, "mainBundle");
if ( (v28 & 1) != 0 )
v24 = (char *)v29;
else
v24 = (char *)&v28 + 1;
v25 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v24);
if ( (v32[0] & 1) != 0 )
v27 = (char *)__p;
v26 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v27);
LOBYTE(v3) = -[NSBundle pathForResource:ofType:inDirectory:](
v23,
"pathForResource:ofType:inDirectory:",
v25,
0,
v26) != nullptr;
if ( (v28 & 1) != 0 )
operator delete(v29);
goto LABEL_20;
}
}
v3 = v17;
memmove(v17, &v8[v13], v16);
v17 = v3;
goto LABEL_35;
}
LABEL_19:
LODWORD(v3) = 0;
LABEL_20:
if ( (v32[0] & 1) != 0 )
operator delete(__p);
return (unsigned int)v3;
}