//
// cocos2d::CCTextureCache::addImage from 0x801e90 to 0x8023c2 (1330 bytes)
//
// 87 xrefs:
// > ButtonSprite::updateBGImage @ 0x3c3176
// > CCAnimatedSprite::loadType @ 0x3c3902
// > CCAnimatedSprite::initWithType @ 0x3c3c38
// > LoadingLayer::init @ 0x3fb5c0
// > LoadingLayer::loadAssets @ 0x3fbbc6
// > LoadingLayer::loadAssets @ 0x3fbbe6
// > LoadingLayer::loadAssets @ 0x3fbc0a
// > LoadingLayer::loadAssets @ 0x3fbc28
// > LoadingLayer::loadAssets @ 0x3fbc48
// > LoadingLayer::loadAssets @ 0x3fbc74
// > LoadingLayer::loadAssets @ 0x3fbc94
// > LoadingLayer::loadAssets @ 0x3fbcb2
// > LoadingLayer::loadAssets @ 0x3fbcce
// > LoadingLayer::loadAssets @ 0x3fbcdc
// > LoadingLayer::loadAssets @ 0x3fbcea
// > LoadingLayer::loadAssets @ 0x3fbd04
// > LoadingLayer::loadAssets @ 0x3fbd20
// > LoadingLayer::loadAssets @ 0x3fbd3a
// > LoadingLayer::loadAssets @ 0x3fbd48
// > LoadingLayer::loadAssets @ 0x3fbd56
// > LoadingLayer::loadAssets @ 0x3fbd64
// > LoadingLayer::loadAssets @ 0x3fbd80
// > LoadingLayer::loadAssets @ 0x3fbd8e
// > LoadingLayer::loadAssets @ 0x3fbd9c
// > LoadingLayer::loadAssets @ 0x3fbdaa
// > LoadingLayer::loadAssets @ 0x3fbdb8
// > LoadingLayer::loadAssets @ 0x3fbdc6
// > LoadingLayer::loadAssets @ 0x3fbe2e
// > LoadingLayer::loadAssets @ 0x3fbe3c
// > GameManager::loadFont @ 0x41457e
// > GameManager::loadDeathEffect @ 0x414656
// > GameManager::loadBackground @ 0x41472e
// > GameManager::loadMiddleground @ 0x414808
// > GameManager::loadMiddleground @ 0x414824
// > GameManager::loadGround @ 0x414a04
// > GameManager::loadGround @ 0x414a2c
// > GameManager::loadIcon @ 0x41d708
// > PlayerObject::setupStreak @ 0x446fd8
// > PlayerObject::update @ 0x4493a4
// > GameObject::createWithKey @ 0x45bb74
// > LevelEditorLayer::updateLevelFont @ 0x466dba
// > LevelEditorLayer::updateLevelFont @ 0x466f44
// > AudioEffectsLayer::init @ 0x50a7f6
// > GJMoreGamesLayer::getMoreGamesList @ 0x538376
// > GJBaseGameLayer::createTextLayers @ 0x58cac4
// > GJBaseGameLayer::createTextLayers @ 0x58cbe8
// > GJBaseGameLayer::createTextLayers @ 0x58cc0e
// > GJBaseGameLayer::setupLayers @ 0x59945e
// > GJBaseGameLayer::setupLayers @ 0x599470
// > GJBaseGameLayer::setupLayers @ 0x599482
// > GJBaseGameLayer::setupLayers @ 0x599494
// > GJBaseGameLayer::setupLayers @ 0x5994a6
// > GJBaseGameLayer::setupLayers @ 0x5994b8
// > FMODLevelVisualizer::init @ 0x5d540c
// > GJPromoPopup::init @ 0x5dee0a
// > CurrencyRewardLayer::init @ 0x605542
// > GauntletSelectLayer::init @ 0x60ceb4
// > GJShopLayer::init @ 0x612bae
// > SecretLayer2::init @ 0x61f30c
// > SecretLayer3::init @ 0x61fd4e
// > SecretLayer4::init @ 0x622bc8
// > WorldSelectLayer::init @ 0x62e0b0
// > LevelAreaLayer::init @ 0x6a4a88
// > LevelAreaInnerLayer::init @ 0x6a5358
// > SecretRewardsLayer::init @ 0x6cdf96
// > GJPathsLayer::init @ 0x6d2b32
// > SecretLayer5::init @ 0x6e5bd8
// > SecretLayer5::init @ 0x6e5bf6
// > SecretLayer6::init @ 0x6e65ae
// > EditorUI::getCreateBtn @ 0x6f80ec
// > cocos2d::CCAtlasNode::initWithTileFile @ 0x7c319e
// > cocos2d::CCLabelAtlas::initWithString @ 0x7d244c
// > cocos2d::CCLabelBMFont::setFntFile @ 0x7d5b68
// > cocos2d::CCLabelBMFont::initWithString @ 0x7d5be8
// > cocos2d::CCMotionStreak::initWithFade @ 0x7deda8
// > cocos2d::CCParticleSystem::initWithDictionary @ 0x7e540e
// > cocos2d::CCParticleBatchNode::initWithFile @ 0x7e5a28
// > cocos2d::CCAnimation::addSpriteFrameWithFileName @ 0x7f0006
// > cocos2d::CCSprite::initWithFile @ 0x7f09f4
// > cocos2d::CCSprite::initWithFile @ 0x7f0a58
// > cocos2d::CCSpriteBatchNode::initWithFile @ 0x7f2d30
// > cocos2d::CCSpriteFrame::getTexture @ 0x7f35c0
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x7f3f1e
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x7f484e
// > cocos2d::CCTextureAtlas::initWithFile @ 0x8001fa
// > cocos2d::CCTextureCache::reloadTexture @ 0x802448
// > cocos2d::CCTMXLayer::initWithTilesetInfo @ 0x804654
//
// 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:21 +0000
//
int __fastcall cocos2d::CCTextureCache::addImage(cocos2d::CCTextureCache *this, const char *a2, int a3)
{
size_t v6; // r0
cocos2d::CCFileUtils *v7; // r0
int v8; // r1
char *v9; // r2
int v10; // r0
int v11; // r1
char *v12; // r2
int v13; // r4
int v14; // r10
char *v15; // r4
size_t v16; // r0
unsigned __int8 *v17; // r11
unsigned int v18; // r2
unsigned int v19; // r3
unsigned __int8 *v20; // r1
char *v21; // r1
cocos2d::CCTexture2D *v22; // r0
cocos2d::CCImage *v23; // r6
char *v25; // r1
unsigned __int8 *v26; // r3
char v27; // r0
unsigned __int8 *v28; // r11
unsigned int v29; // r3
char *v30; // r1
unsigned __int8 *v31; // r11
unsigned int v32; // r3
unsigned __int8 *v33; // r11
unsigned int v34; // r3
unsigned __int8 *v35; // r11
unsigned int v36; // r3
unsigned __int8 *v37; // r11
unsigned int v38; // r3
unsigned __int8 *v39; // r11
unsigned int v40; // r3
unsigned __int8 *v41; // r11
unsigned int v42; // r3
int v43; // r11
char *v44; // r1
char *v45; // r1
int v46; // r11
size_t v47; // r0
unsigned __int8 *v48; // [sp+10h] [bp-14h]
unsigned int v49; // [sp+10h] [bp-14h]
unsigned __int8 *v50; // [sp+10h] [bp-14h]
unsigned __int8 *v51; // [sp+10h] [bp-14h]
unsigned __int8 *v52; // [sp+10h] [bp-14h]
unsigned __int8 *v53; // [sp+10h] [bp-14h]
unsigned __int8 *v54; // [sp+10h] [bp-14h]
unsigned __int8 *v55; // [sp+10h] [bp-14h]
unsigned __int8 *v56; // [sp+10h] [bp-14h]
char *v57; // [sp+14h] [bp-10h]
unsigned __int8 *v58[2]; // [sp+1Ch] [bp-8h] BYREF
int v59; // [sp+24h] [bp+0h] BYREF
int v60; // [sp+28h] [bp+4h]
char *v61; // [sp+2Ch] [bp+8h]
int v62[2]; // [sp+30h] [bp+Ch] BYREF
char *v63; // [sp+38h] [bp+14h]
int v64; // [sp+3Ch] [bp+18h] BYREF
unsigned int v65; // [sp+40h] [bp+1Ch]
unsigned __int8 *v66; // [sp+44h] [bp+20h]
int v67; // [sp+48h] [bp+24h] BYREF
int v68; // [sp+4Ch] [bp+28h]
char *v69; // [sp+50h] [bp+2Ch]
v59 = 0;
v60 = 0;
v61 = nullptr;
v6 = strlen(a2);
v7 = (cocos2d::CCFileUtils *)std::string::__init(&v59, a2, v6);
v8 = cocos2d::CCFileUtils::sharedFileUtils(v7);
if ( (v59 & 1) != 0 )
v9 = v61;
else
v9 = (char *)&v59 + 1;
(*(void (__fastcall **)(int *, int, char *, int))(*(_DWORD *)v8 + 24))(&v67, v8, v9, a3);
if ( (v59 & 1) != 0 )
{
*v61 = 0;
v60 = 0;
}
else
{
LOWORD(v59) = 0;
}
std::string::reserve(&v59, 0);
v10 = v67;
v11 = v68;
v12 = v69;
v67 = 0;
v68 = 0;
v69 = nullptr;
v59 = v10;
v60 = v11;
v61 = v12;
std::string::~string((int)&v67);
if ( (v59 & 1) != 0 )
{
v13 = v60;
if ( !v60 )
goto LABEL_28;
v14 = *((_DWORD *)this + 13);
v15 = v61;
}
else
{
v13 = (int)(unsigned __int8)v59 >> 1;
if ( !v13 )
goto LABEL_28;
v14 = *((_DWORD *)this + 13);
v15 = (char *)&v59 + 1;
}
v67 = 0;
v68 = 0;
v69 = nullptr;
v16 = strlen(v15);
std::string::__init(&v67, v15, v16);
v13 = cocos2d::CCDictionary::objectForKey(v14, (int)&v67);
std::string::~string((int)&v67);
if ( !v13 )
{
v17 = (unsigned __int8 *)&v64 + 1;
std::string::basic_string(v62, (int)&v59);
std::string::basic_string(&v64, (int)&v59);
v18 = 0;
while ( 1 )
{
if ( (v64 & 1) != 0 )
{
v19 = v65;
v20 = v66;
if ( v18 >= v65 )
{
v17 = v66;
LABEL_18:
if ( v19 > 3 )
{
v48 = &v17[v19];
std::__search(
v58,
v17,
&v17[v19],
".pvr",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq);
if ( v58[0] != v48 && v58[0] - v17 != -1 )
{
if ( (v62[0] & 1) != 0 )
v21 = v63;
else
v21 = (char *)v62 + 1;
v22 = cocos2d::CCTextureCache::addPVRImage(this, v21);
goto LABEL_25;
}
}
if ( (v64 & 1) != 0 )
{
v28 = v66;
v29 = v65;
}
else
{
v29 = (int)(unsigned __int8)v64 >> 1;
v28 = (unsigned __int8 *)&v64 + 1;
}
if ( v29 > 3 )
{
v50 = &v28[v29];
std::__search(
v58,
v28,
&v28[v29],
".pkm",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq);
if ( v58[0] != v50 && v58[0] - v28 != -1 )
{
if ( (v62[0] & 1) != 0 )
v30 = v63;
else
v30 = (char *)v62 + 1;
v22 = (cocos2d::CCTexture2D *)cocos2d::CCTextureCache::addETCImage(this, v30);
LABEL_25:
v13 = (int)v22;
v23 = nullptr;
LABEL_26:
std::string::~string((int)&v64);
std::string::~string((int)v62);
if ( v23 )
cocos2d::CCObject::release(v23);
break;
}
}
if ( (v64 & 1) != 0 )
{
v31 = v66;
v32 = v65;
}
else
{
v32 = (int)(unsigned __int8)v64 >> 1;
v31 = (unsigned __int8 *)&v64 + 1;
}
if ( v32 <= 3
|| (v51 = &v31[v32],
std::__search(
v58,
v31,
&v31[v32],
".png",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v51)
|| v58[0] - v31 == -1 )
{
if ( (v64 & 1) != 0 )
{
v33 = v66;
v34 = v65;
}
else
{
v34 = (int)(unsigned __int8)v64 >> 1;
v33 = (unsigned __int8 *)&v64 + 1;
}
if ( (v34 <= 3
|| (v52 = &v33[v34],
std::__search(
v58,
v33,
&v33[v34],
".jpg",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v52)
|| v58[0] - v33 == -1)
&& ((v64 & 1) == 0
? (v36 = (int)(unsigned __int8)v64 >> 1, v35 = (unsigned __int8 *)&v64 + 1)
: (unsigned __int8 *)(v35 = v66, v36 = v65),
v36 <= 4
|| (v53 = &v35[v36],
std::__search(
v58,
v35,
&v35[v36],
".jpeg",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v53)
|| v58[0] - v35 == -1) )
{
if ( (v64 & 1) != 0 )
{
v37 = v66;
v38 = v65;
}
else
{
v38 = (int)(unsigned __int8)v64 >> 1;
v37 = (unsigned __int8 *)&v64 + 1;
}
if ( v38 <= 3
|| (v54 = &v37[v38],
std::__search(
v58,
v37,
&v37[v38],
".tif",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v54)
|| v58[0] - v37 == -1 )
{
if ( (v64 & 1) != 0 )
{
v39 = v66;
v40 = v65;
}
else
{
v40 = (int)(unsigned __int8)v64 >> 1;
v39 = (unsigned __int8 *)&v64 + 1;
}
if ( v40 <= 4
|| (v55 = &v39[v40],
std::__search(
v58,
v39,
&v39[v40],
".tiff",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v55)
|| v58[0] - v39 == -1 )
{
if ( (v64 & 1) != 0 )
{
v41 = v66;
v42 = v65;
}
else
{
v42 = (int)(unsigned __int8)v64 >> 1;
v41 = (unsigned __int8 *)&v64 + 1;
}
if ( v42 <= 4
|| (v56 = &v41[v42],
std::__search(
v58,
v41,
&v41[v42],
".webp",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v58[0] == v56)
|| v58[0] - v41 == -1 )
{
v43 = 5;
goto LABEL_75;
}
v43 = 3;
v23 = (cocos2d::CCImage *)operator new(0x48u);
cocos2d::CCImage::CCImage(v23);
LABEL_76:
if ( (v62[0] & 1) != 0 )
v44 = v63;
else
v44 = (char *)v62 + 1;
if ( cocos2d::CCImage::initWithImageFile(v23, (int)v44, v43) )
{
v13 = operator new(0x60u);
cocos2d::CCTexture2D::CCTexture2D((cocos2d::CCTexture2D *)v13);
if ( cocos2d::CCTexture2D::initWithImage((cocos2d::CCTexture2D *)v13, v23) )
{
if ( (v62[0] & 1) != 0 )
v45 = v63;
else
v45 = (char *)v62 + 1;
cocos2d::VolatileTexture::addImageTexture(
(cocos2d::VolatileTexture *)v13,
(cocos2d::CCTexture2D *)v45,
v43);
v46 = *((_DWORD *)this + 13);
if ( (v59 & 1) == 0 )
this = (cocos2d::CCTextureCache *)((char *)&v59 + 1);
v67 = 0;
if ( (v59 & 1) != 0 )
this = (cocos2d::CCTextureCache *)v61;
v68 = 0;
v69 = nullptr;
v47 = strlen((const char *)this);
std::string::__init(&v67, this, v47);
cocos2d::CCDictionary::setObject(v46, (cocos2d::CCObject *)v13, (int)&v67);
std::string::~string((int)&v67);
cocos2d::CCObject::release((_DWORD *)v13);
}
}
goto LABEL_26;
}
}
v43 = 2;
}
else
{
v43 = 0;
}
LABEL_75:
v23 = (cocos2d::CCImage *)operator new(0x48u);
cocos2d::CCImage::CCImage(v23);
goto LABEL_76;
}
v43 = 1;
v23 = (cocos2d::CCImage *)operator new(0x48u);
cocos2d::CCImage::CCImage(v23);
goto LABEL_76;
}
}
else
{
v19 = (int)(unsigned __int8)v64 >> 1;
if ( v18 >= v19 )
goto LABEL_18;
v20 = (unsigned __int8 *)&v64 + 1;
}
v25 = (char *)&v20[v18];
if ( (v64 & 1) != 0 )
v26 = v66;
else
v26 = (unsigned __int8 *)&v64 + 1;
v57 = v25;
v49 = v18;
v27 = tolower(v26[v18]);
v18 = v49 + 1;
*v57 = v27;
}
}
LABEL_28:
std::string::~string((int)&v59);
return v13;
}