//
// cocos2d::CCFileUtilsMac::getFullPathForDirectoryAndFilename from 0x10060bdd0 to 0x10060c086 (694 bytes)
//
// 1 xrefs:
// > ??> @ 0x100980610
//
// 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
//
size_t *__fastcall cocos2d::CCFileUtilsMac::getFullPathForDirectoryAndFilename(
size_t *a1,
double a2,
__int64 a3,
unsigned __int8 *a4,
unsigned __int8 *a5)
{
unsigned int v7; // r15d
unsigned __int8 *v8; // rbx
_BYTE *v9; // rsi
size_t v10; // r15
unsigned int v11; // ecx
_BYTE *v12; // rax
unsigned __int8 *v13; // r14
unsigned __int64 v14; // r12
size_t *v15; // r13
char v16; // r12
char *v17; // rbx
NSString *v18; // r14
NSString *v19; // rax
NSString *v20; // rax
const char *v21; // r14
size_t v22; // rax
size_t v23; // rbx
char *v24; // r15
size_t v25; // r13
size_t v26; // r13
bool v27; // zf
char *v28; // r12
char *v29; // rbx
const void *v30; // r14
size_t v31; // r12
char *v32; // r15
id v33; // rbx
NSString *v34; // rax
char v36; // [rsp+4h] [rbp-3Ch]
NSBundle *v37; // [rsp+8h] [rbp-38h]
_BYTE *v38; // [rsp+8h] [rbp-38h]
v7 = *a4;
v8 = a4 + 1;
v9 = a4 + 1;
if ( (v7 & 1) != 0 )
v9 = *((_BYTE **)a4 + 2);
if ( *v9 != 47 )
{
v37 = +[NSBundle mainBundle](&OBJC_CLASS___NSBundle, "mainBundle");
if ( (*a5 & 1) != 0 )
v13 = *((unsigned __int8 **)a5 + 2);
else
v13 = a5 + 1;
v18 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v13);
if ( (*a4 & 1) != 0 )
v8 = *((unsigned __int8 **)a4 + 2);
v19 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v8);
v20 = -[NSBundle pathForResource:ofType:inDirectory:](v37, "pathForResource:ofType:inDirectory:", v18, 0, v19);
v15 = a1;
if ( !v20 )
goto LABEL_44;
v21 = -[NSString UTF8String](v20, "UTF8String");
v22 = strlen(v21);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_47:
sub_100006BF0(a2);
v23 = v22;
if ( v22 >= 0x17 )
{
v31 = 26;
if ( (v22 | 7) != 0x17 )
v31 = (v22 | 7) + 1;
v24 = (char *)operator new(v31);
a1[2] = (size_t)v24;
*a1 = v31 + 1;
a1[1] = v23;
}
else
{
*(_BYTE *)a1 = 2 * v22;
v24 = (char *)a1 + 1;
if ( !v22 )
goto LABEL_36;
}
memmove(v24, v21, v23);
LABEL_36:
v32 = &v24[v23];
LABEL_45:
*v32 = 0;
return v15;
}
if ( (v7 & 1) != 0 )
{
v10 = *((_QWORD *)a4 + 1);
v11 = *a5;
if ( (v11 & 1) == 0 )
{
LABEL_6:
v12 = (_BYTE *)(v11 >> 1);
goto LABEL_11;
}
}
else
{
v10 = v7 >> 1;
v11 = *a5;
if ( (v11 & 1) == 0 )
goto LABEL_6;
}
v12 = *((_BYTE **)a5 + 1);
LABEL_11:
v38 = v12;
v14 = (unsigned __int64)&v12[v10];
if ( (unsigned __int64)&v12[v10] >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_47;
v36 = v11;
if ( v14 > 0x16 )
{
v25 = 26;
if ( (v14 | 7) != 0x17 )
v25 = (v14 | 7) + 1;
v17 = (char *)operator new(v25);
v26 = v25 + 1;
*a1 = v26;
a1[2] = (size_t)v17;
a1[1] = v14;
v16 = v26;
v15 = a1;
}
else
{
v15 = a1;
*(_OWORD *)a1 = 0;
a1[2] = 0;
v16 = 2 * v14;
*(_BYTE *)a1 = v16;
v17 = nullptr;
}
v27 = (v16 & 1) == 0;
v28 = (char *)v15 + 1;
if ( v27 )
v17 = (char *)v15 + 1;
if ( v10 )
memmove(v17, v9, v10);
v29 = &v17[v10];
if ( v38 )
{
if ( (v36 & 1) != 0 )
v30 = *((const void **)a5 + 2);
else
v30 = a5 + 1;
memmove(v29, v30, (size_t)v38);
}
v38[(_QWORD)v29] = 0;
if ( (*(_BYTE *)v15 & 1) != 0 )
v28 = (char *)v15[2];
v33 = qword_1009A3508;
v34 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v28);
if ( !(unsigned __int8)objc_msgSend(v33, "fileExistsAtPath:", v34) )
{
if ( (*(_BYTE *)v15 & 1) != 0 )
operator delete((void *)v15[2]);
LABEL_44:
*(_BYTE *)v15 = 0;
v32 = (char *)v15 + 1;
goto LABEL_45;
}
return v15;
}