//
// cocos2d::CCTextureCache::addETCImage from 0x10013d060 to 0x10013d1c0 (352 bytes)
//
// 1 xrefs:
// > cocos2d::CCTextureCache::addImage @ 0x10013cb10
//
// 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 10:59:30 +0000
//
void *__fastcall cocos2d::CCTextureCache::addETCImage(__int64 a1, char *a2)
{
__int64 v3; // x19
char *v4; // x1
__int64 v5; // x0
void *v6; // x19
__int64 v7; // x0
void **v8; // x1
__int64 v9; // x20
char *v10; // x1
void *v12[2]; // [xsp+8h] [xbp-68h] BYREF
char v13; // [xsp+1Fh] [xbp-51h]
void *__p[2]; // [xsp+20h] [xbp-50h] BYREF
char v15; // [xsp+37h] [xbp-39h]
void *v16[2]; // [xsp+38h] [xbp-38h] BYREF
char v17; // [xsp+4Fh] [xbp-21h]
sub_100009900(v16, a2);
v3 = *(_QWORD *)(a1 + 56);
if ( v17 >= 0 )
v4 = (char *)v16;
else
v4 = (char *)v16[0];
sub_100009900(__p, v4);
v5 = cocos2d::CCDictionary::objectForKey(v3, __p);
v6 = (void *)v5;
if ( v15 < 0 )
{
operator delete(__p[0]);
if ( v6 )
goto LABEL_21;
}
else if ( v5 )
{
goto LABEL_21;
}
v7 = cocos2d::CCFileUtils::sharedFileUtils(v5);
(*(void (__fastcall **)(void **__return_ptr))(*(_QWORD *)v7 + 48LL))(__p);
v6 = operator new(0x68u);
j_cocos2d::CCTexture2D::CCTexture2D();
if ( v15 >= 0 )
v8 = __p;
else
v8 = (void **)__p[0];
if ( (unsigned int)cocos2d::CCTexture2D::initWithETCFile(v6, v8) )
{
v9 = *(_QWORD *)(a1 + 56);
if ( v17 >= 0 )
v10 = (char *)v16;
else
v10 = (char *)v16[0];
sub_100009900(v12, v10);
cocos2d::CCDictionary::setObject(v9, v6, v12);
if ( v13 < 0 )
operator delete(v12[0]);
cocos2d::CCObject::autorelease((__int64)v6);
}
else
{
(*(void (__fastcall **)(void *))(*(_QWORD *)v6 + 16LL))(v6);
v6 = nullptr;
}
if ( v15 < 0 )
operator delete(__p[0]);
LABEL_21:
if ( v17 < 0 )
operator delete(v16[0]);
return v6;
}