//
// cocos2d::CCFileUtils::fullPathForFilename from 0xb06f2c to 0xb07710 (2020 bytes)
//
// 3 xrefs:
// > ??> @ 0x6a1d0
// > ??> @ 0x1217ac0
// > ??> @ 0x1217f80
//
// 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
//
char **__usercall cocos2d::CCFileUtils::fullPathForFilename@(
cocos2d::CCFileUtils *this@,
char *a2@,
unsigned __int8 a3@,
char **a4@)
{
void (__fastcall *loadFilenameLookupDictionaryFromFile)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *); // x23
int v8; // w23
char *v9; // x0
cocos2d::CCFileUtils *v10; // x23
char *v11; // x0
void *v12; // x0
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
cocos2d::CCFileUtils_vtbl *v18; // x2
__int64 v19; // x1
__int64 v20; // x0
cocos2d::CCDirector *v21; // x0
float ContentScaleFactor; // s0
int v23; // w28
char *v24; // x0
char *v25; // x0
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
cocos2d::CCDirector *v30; // x0
float v31; // s0
char *v32; // x3
char *v33; // x0
void *v34; // x0
unsigned int *v35; // x1
int v36; // w2
void *v37; // x0
char *v38; // x0
char *v39; // x0
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x3
int v45; // w1
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
cocos2d::CCFileUtils_vtbl *v50; // x2
int v51; // w0
char *v52; // x1
__int64 *v53; // x0
cocos2d::CCFileUtils_vtbl *v54; // x2
__int64 v55; // [xsp+0h] [xbp+0h] BYREF
__int64 *v56; // [xsp+78h] [xbp+78h]
void (__fastcall *setSearchPaths)(cocos2d::CCFileUtils *__hidden, const std::vector *); // [xsp+80h] [xbp+80h]
char *v58; // [xsp+88h] [xbp+88h]
char *v59; // [xsp+90h] [xbp+90h]
int v60[2]; // [xsp+98h] [xbp+98h]
char *v61; // [xsp+A0h] [xbp+A0h]
_QWORD *v62; // [xsp+A8h] [xbp+A8h]
__int64 *v63; // [xsp+B0h] [xbp+B0h]
__int64 v64; // [xsp+B8h] [xbp+B8h]
__int64 v65; // [xsp+C0h] [xbp+C0h]
unsigned int v66; // [xsp+CCh] [xbp+CCh]
char v67; // [xsp+D8h] [xbp+D8h] BYREF
char v68; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v69; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v70; // [xsp+F0h] [xbp+F0h] BYREF
char *v71; // [xsp+F8h] [xbp+F8h] BYREF
char *v72; // [xsp+100h] [xbp+100h] BYREF
__int64 v73; // [xsp+108h] [xbp+108h] BYREF
char v74; // [xsp+110h] [xbp+110h] BYREF
_DWORD *v75; // [xsp+118h] [xbp+118h] BYREF
__int64 v76; // [xsp+120h] [xbp+120h] BYREF
v66 = a3;
if ( !*a2 )
{
sub_D153B8((int)a4, a2);
return a4;
}
sub_D153B8((int)&v69, a2);
loadFilenameLookupDictionaryFromFile = this->loadFilenameLookupDictionaryFromFile;
sub_D153B8((unsigned int)&v55 + 280, a2);
v8 = ((unsigned __int8 (__fastcall *)(cocos2d::CCFileUtils *, _DWORD **))loadFilenameLookupDictionaryFromFile)(
this,
&v75);
v9 = (char *)(v75 - 6);
if ( v75 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_3;
if ( &pthread_create )
{
v14 = v75 - 2;
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(v75 - 2);
*(v75 - 2) = v15 - 1;
}
if ( v15 > 0 )
{
LABEL_3:
if ( v8 )
{
LABEL_9:
sub_D153B8((int)a4, a2);
goto LABEL_7;
}
}
else
{
operator delete(v9);
if ( v8 )
goto LABEL_9;
}
v62 = this + 9;
sub_D153B8((int)&v75, a2);
v10 = (cocos2d::CCFileUtils *)std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find(
(__int64)(this + 9),
(const void **)&v75);
v11 = (char *)(v75 - 6);
if ( v75 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = v75 - 2;
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(v75 - 2);
*(v75 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v11);
}
if ( v10 != this + 10 )
{
sub_D18D28(a4);
goto LABEL_7;
}
v18 = this->__vftable;
v63 = &v70;
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCFileUtils *, char *))v18->setFilenameLookupDictionary)(
&v70,
this,
a2);
sub_D153B8((int)&v71, &byte_F288A0);
v19 = *((_QWORD *)this + 6);
v64 = *((_QWORD *)this + 5);
if ( v19 == v64 )
goto LABEL_53;
v20 = *((_QWORD *)this + 3);
*(_QWORD *)v60 = &v74;
v58 = "-hd";
do
{
v65 = *((_QWORD *)this + 2);
v59 = &v67;
if ( v65 == v20 )
goto LABEL_52;
while ( 2 )
{
v21 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v21);
if ( (ContentScaleFactor >= 4.0) <= v66 )
{
v30 = cocos2d::CCDirector::sharedDirector();
v31 = cocos2d::CCDirector::getContentScaleFactor(v30);
if ( (v31 >= 2.0) > v66 )
v23 = 1;
else
v23 = 2;
}
else
{
v23 = 0;
}
v61 = &v68;
do
{
v72 = &byte_124B6C8;
if ( v23 )
{
if ( v23 != 1 )
{
sub_D18EA8(&v72, v63);
goto LABEL_36;
}
v50 = this->__vftable;
v56 = &qword_124B6B0;
setSearchPaths = v50->setSearchPaths;
sub_D18D28(&v73);
v51 = v60[0];
v52 = v58;
}
else
{
v54 = this->__vftable;
v56 = &qword_124B6B0;
setSearchPaths = v54->setSearchPaths;
sub_D18D28(&v73);
v51 = v60[0];
v52 = "-uhd";
}
sub_D153B8(v51, v52);
((void (__fastcall *)(_DWORD **__return_ptr, cocos2d::CCFileUtils *, __int64 *, _QWORD))setSearchPaths)(
&v75,
this,
&v73,
*(_QWORD *)v60);
sub_D163D4(&v72, &v75);
if ( v75 - 6 != (_DWORD *)v56 )
sub_4DDDE8(v75 - 6);
v53 = (__int64 *)(**(_QWORD **)v60 - 24LL);
if ( v53 != &qword_124B6B0 )
sub_4DDDE8(v53);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
sub_4DDDE8((void *)(v73 - 24));
LABEL_36:
((void (__fastcall *)(_DWORD **__return_ptr, cocos2d::CCFileUtils *, char **, __int64, __int64))this->setSearchResolutionsOrder)(
&v75,
this,
&v72,
v65,
v64);
sub_D163D4(&v71, &v75);
v25 = (char *)(v75 - 6);
if ( v75 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = v75 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v75 - 2);
*(v75 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v25);
}
if ( *((_QWORD *)v71 - 3) )
{
sub_D153B8((int)&v75, a2);
sub_D18D28(&v76);
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_insert_unique>(
v62,
(__int64)&v75);
v37 = (void *)(v76 - 24);
if ( (__int64 *)(v76 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v76 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(v76 - 8);
*(_DWORD *)(v76 - 8) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v37);
}
v38 = (char *)(v75 - 6);
if ( v75 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = v75 - 2;
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(v75 - 2);
*(v75 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v38);
}
*a4 = v71;
v39 = v72 - 24;
v32 = v72;
v71 = &byte_124B6C8;
if ( v72 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v72 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v72 - 2);
*((_DWORD *)v72 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v39);
v32 = v71;
}
goto LABEL_59;
}
v24 = v72 - 24;
if ( v72 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v72 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v72 - 2);
*((_DWORD *)v72 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v24);
}
++v23;
}
while ( v23 != 3 );
v20 = *((_QWORD *)this + 3);
v65 += 8;
if ( v20 != v65 )
continue;
break;
}
v19 = *((_QWORD *)this + 6);
LABEL_52:
v64 += 8;
}
while ( v19 != v64 );
LABEL_53:
if ( *((_QWORD *)v71 - 3) )
{
sub_D153B8((int)&v75, a2);
sub_D18D28(&v76);
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_insert_unique>(
v62,
(__int64)&v75);
if ( (__int64 *)(v76 - 24) != &qword_124B6B0 )
sub_4DDDE8((void *)(v76 - 24));
if ( v75 - 6 != (_DWORD *)&qword_124B6B0 )
sub_4DDDE8(v75 - 6);
*a4 = v71;
v32 = &byte_124B6C8;
v71 = &byte_124B6C8;
}
else
{
sub_D153B8((int)a4, a2);
v32 = v71;
}
LABEL_59:
v33 = v32 - 24;
if ( v32 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v32 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v32 - 2);
*((_DWORD *)v32 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v33);
}
v34 = (void *)(v70 - 24);
if ( (__int64 *)(v70 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v70 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v70 - 8);
*(_DWORD *)(v70 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v34);
}
LABEL_7:
v12 = (void *)(v69 - 24);
if ( (__int64 *)(v69 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v69 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v69 - 8);
*(_DWORD *)(v69 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v12);
}
return a4;
}