//
// cocos2d::CCTextureCache::reloadTexture from 0xb35414 to 0xb35584 (368 bytes)
//
// 1 xrefs:
// > ??> @ 0xc7920
//
// 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::CCTextureCache::reloadTexture(cocos2d::CCTextureCache *a1, const char *a2)
{
bool v3; // w21
cocos2d::CCFileUtils *v4; // x0
const char *v5; // x2
char *v6; // x0
cocos2d::CCTexture2D *v8; // x23
cocos2d::CCImage *v9; // x22
unsigned int *v10; // x2
int v11; // w1
cocos2d::CCTexture2D *v12; // x0
const char *v14; // [xsp+60h] [xbp+60h] BYREF
v3 = 0;
v4 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(const char **__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v4->createCCArrayWithContentsOfFile)(
&v14,
v4,
a2,
0);
v5 = v14;
if ( !*((_QWORD *)v14 - 3) )
{
LABEL_2:
v6 = (char *)(v5 - 24);
if ( v5 - 24 == (const char *)&qword_124B6B0 )
return v3;
goto LABEL_7;
}
v8 = (cocos2d::CCTexture2D *)cocos2d::CCDictionary::objectForKey((__int64)a1->m_pTextures, &v14);
if ( !v8 )
{
v12 = cocos2d::CCTextureCache::addImage(a1, v14, 0);
v5 = v14;
v3 = v12 != nullptr;
goto LABEL_2;
}
v9 = (cocos2d::CCImage *)operator new(0x50u);
cocos2d::CCImage::CCImage(v9);
if ( cocos2d::CCImage::initWithImageFile(v9, v14, kFmtPng) )
{
v3 = cocos2d::CCTexture2D::initWithImage(v8, v9);
v5 = v14;
goto LABEL_2;
}
v5 = v14;
v6 = (char *)(v14 - 24);
if ( v14 - 24 == (const char *)&qword_124B6B0 )
return v3;
LABEL_7:
if ( &pthread_create )
{
v10 = (unsigned int *)(v5 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v5 - 2);
*((_DWORD *)v5 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v6);
return v3;
}