//
// cocos2d::CCTextureCache::textureForKey from 0xb343e4 to 0xb344c4 (224 bytes)
//
// 4 xrefs:
// > GameManager::loadIcon @ 0x5fd2f0
// > sub_AFA7C0 @ 0xafa7e0
// > cocos2d::CCSprite::setTexture @ 0xb1558c
// > ??> @ 0x77c40
//
// 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
//
cocos2d::CCTexture2D *cocos2d::CCTextureCache::textureForKey(cocos2d::CCTextureCache *a1, const char *a2)
{
cocos2d::CCDictionary *m_pTextures; // x21
cocos2d::CCFileUtils *v3; // x0
cocos2d::CCTexture2D *v4; // x20
char *v5; // x0
unsigned int *v7; // x2
int v8; // w1
const char *v10; // [xsp+50h] [xbp+50h] BYREF
m_pTextures = a1->m_pTextures;
v3 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(const char **__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v3->createCCArrayWithContentsOfFile)(
&v10,
v3,
a2,
0);
v4 = (cocos2d::CCTexture2D *)cocos2d::CCDictionary::objectForKey((__int64)m_pTextures, &v10);
v5 = (char *)(v10 - 24);
if ( v10 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v10 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *((_DWORD *)v10 - 2);
*((_DWORD *)v10 - 2) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v5);
}
return v4;
}