//
// cocos2d::CCTextureCache::textureForKey from 0xda56ac to 0xda580c (352 bytes)
//
// 4 xrefs:
// > GameManager::loadIcon @ 0x72954c
// > sub_D6B8F8 @ 0xd6b918
// > cocos2d::CCSprite::setTexture @ 0xd86a68
// > ??> @ 0xa0558
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:08:32 +0000
//
__int64 __fastcall cocos2d::CCTextureCache::textureForKey(cocos2d::CCTextureCache *this, const char *a2)
{
size_t v4; // x0
size_t v5; // x19
__int64 v6; // x25
char *v7; // x3
__int64 v8; // x19
cocos2d::CCFileUtils *v9; // x0
unsigned __int64 v11; // x0
__int64 v12; // x19
__int64 v13; // x0
__int64 v14; // [xsp+50h] [xbp+50h] BYREF
size_t v15; // [xsp+58h] [xbp+58h]
void *v16; // [xsp+60h] [xbp+60h]
v14 = 0;
v15 = 0;
v16 = nullptr;
v4 = strlen(a2);
v5 = v4;
v6 = *((_QWORD *)this + 7);
if ( v4 > 0x16 )
{
v11 = (v4 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v14 = v11 | 1;
v7 = (char *)operator new(v11);
v16 = v7;
v15 = v5;
}
else
{
LOBYTE(v14) = 2 * v4;
v7 = (char *)&v14 + 1;
if ( !v4 )
{
BYTE1(v14) = 0;
v8 = cocos2d::CCDictionary::objectForKey(v6, (__int64)&v14);
v9 = (cocos2d::CCFileUtils *)(unsigned __int8)v14;
if ( (v14 & 1) == 0 )
goto LABEL_4;
goto LABEL_8;
}
}
*((_BYTE *)memcpy(v7, a2, v5) + v5) = 0;
v8 = cocos2d::CCDictionary::objectForKey(v6, (__int64)&v14);
v9 = (cocos2d::CCFileUtils *)(unsigned __int8)v14;
if ( (v14 & 1) == 0 )
{
LABEL_4:
if ( v8 )
return v8;
goto LABEL_9;
}
LABEL_8:
operator delete(v16);
if ( v8 )
return v8;
LABEL_9:
v12 = *((_QWORD *)this + 7);
v13 = cocos2d::CCFileUtils::sharedFileUtils(v9);
(*(void (__fastcall **)(__int64 *__return_ptr, __int64, const char *, _QWORD))(*(_QWORD *)v13 + 48LL))(
&v14,
v13,
a2,
0);
v8 = cocos2d::CCDictionary::objectForKey(v12, (__int64)&v14);
if ( (v14 & 1) != 0 )
operator delete(v16);
return v8;
}