//
// cocos2d::CCImage::initWithImageFile from 0xb0c740 to 0xb0c89c (348 bytes)
//
// 3 xrefs:
// > cocos2d::CCTextureCache::addImage @ 0xb352a4
// > cocos2d::CCTextureCache::reloadTexture @ 0xb354e0
// > ??> @ 0x96618
//
// 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
//
bool cocos2d::CCImage::initWithImageFile(cocos2d::CCImage *a1, const char *a2, cocos2d::CCImage::EImageFormat a3)
{
cocos2d::CCFileUtils *v5; // x0
cocos2d::CCFileUtils *v6; // x0
void *v7; // x20
bool v8; // w21
__int64 v9; // x2
void *v10; // x0
unsigned int *v12; // x2
int v13; // w1
int v15[2]; // [xsp+58h] [xbp+58h] BYREF
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
*(_QWORD *)v15 = 0;
v5 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v5->createCCArrayWithContentsOfFile)(
&v16,
v5,
a2,
0);
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = (void *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64, char *, int *))v6->addSearchResolutionsOrder)(
v6,
v16,
"rb",
v15);
if ( !v7 )
{
v9 = v16;
v8 = 0;
v10 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) == &qword_124B6B0 )
return v8;
goto LABEL_7;
}
v8 = 0;
if ( *(_QWORD *)v15 )
v8 = cocos2d::CCImage::initWithImageData(a1, v7, v15[0], a3, 0, 0, 8, 0);
operator delete[](v7);
v9 = v16;
v10 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
LABEL_7:
if ( &pthread_create )
{
v12 = (unsigned int *)(v9 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v10);
}
return v8;
}