//
// cocos2d::CCTextureCache::addETCImage from 0x800ebc to 0x800fe4 (296 bytes)
//
// 1 xrefs:
// > cocos2d::CCTextureCache::addImage @ 0x8020ae
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:20 +0000
//
int __fastcall cocos2d::CCTextureCache::addETCImage(cocos2d::CCTextureCache *this, const char *a2)
{
char *v2; // r9
size_t v5; // r0
int v6; // r10
size_t v7; // r0
int v8; // r9
cocos2d::CCFileUtils *v9; // r0
int v10; // r1
char *v11; // r2
cocos2d::CCTexture2D *v12; // r4
char *v13; // r1
int v15; // r9
char *v16; // r7
size_t v17; // r0
int v18[2]; // [sp+0h] [bp-28h] BYREF
char *v19; // [sp+8h] [bp-20h]
unsigned __int8 v20; // [sp+Ch] [bp-1Ch] BYREF
char v21; // [sp+Dh] [bp-1Bh] BYREF
char *v22; // [sp+14h] [bp-14h]
int v23; // [sp+18h] [bp-10h] BYREF
int v24; // [sp+1Ch] [bp-Ch]
int v25; // [sp+20h] [bp-8h]
v18[0] = 0;
v18[1] = 0;
v19 = nullptr;
v5 = strlen(a2);
std::string::__init(v18, a2, v5);
v23 = 0;
v24 = 0;
if ( (v18[0] & 1) == 0 )
v2 = (char *)v18 + 1;
v25 = 0;
if ( (v18[0] & 1) != 0 )
v2 = v19;
v6 = *((_DWORD *)this + 13);
v7 = strlen(v2);
std::string::__init(&v23, v2, v7);
v8 = cocos2d::CCDictionary::objectForKey(v6, (int)&v23);
v9 = (cocos2d::CCFileUtils *)std::string::~string((int)&v23);
if ( !v8 )
{
v10 = cocos2d::CCFileUtils::sharedFileUtils(v9);
if ( (v18[0] & 1) != 0 )
v11 = v19;
else
v11 = (char *)v18 + 1;
(*(void (__fastcall **)(unsigned __int8 *, int, char *, _DWORD))(*(_DWORD *)v10 + 24))(&v20, v10, v11, 0);
v12 = (cocos2d::CCTexture2D *)operator new(0x60u);
cocos2d::CCTexture2D::CCTexture2D(v12);
if ( (v20 & 1) != 0 )
v13 = v22;
else
v13 = &v21;
if ( cocos2d::CCTexture2D::initWithETCFile(v12, v13, COERCE_FLOAT(v20 << 31), COERCE_FLOAT(v20)) )
{
v15 = *((_DWORD *)this + 13);
if ( (v18[0] & 1) != 0 )
v16 = v19;
else
v16 = (char *)v18 + 1;
v23 = 0;
v24 = 0;
v25 = 0;
v17 = strlen(v16);
std::string::__init(&v23, v16, v17);
cocos2d::CCDictionary::setObject(v15, v12, (int)&v23);
std::string::~string((int)&v23);
cocos2d::CCObject::autorelease(v12);
v8 = (int)v12;
}
else
{
(*(void (__fastcall **)(cocos2d::CCTexture2D *))(*(_DWORD *)v12 + 8))(v12);
}
std::string::~string((int)&v20);
}
std::string::~string((int)v18);
return v8;
}