//
// cocos2d::CCTextureCache::addImage from 0x5f5340 to 0x5f553c (508 bytes)
//
// 87 xrefs:
// > ButtonSprite::updateBGImage @ 0x2e39f2
// > CCAnimatedSprite::loadType @ 0x2e3e36
// > CCAnimatedSprite::initWithType @ 0x2e40ee
// > LoadingLayer::loadAssets @ 0x30b72a
// > LoadingLayer::loadAssets @ 0x30b74a
// > LoadingLayer::loadAssets @ 0x30b76e
// > LoadingLayer::loadAssets @ 0x30b78c
// > LoadingLayer::loadAssets @ 0x30b7ac
// > LoadingLayer::loadAssets @ 0x30b7d8
// > LoadingLayer::loadAssets @ 0x30b7f8
// > LoadingLayer::loadAssets @ 0x30b812
// > LoadingLayer::loadAssets @ 0x30b82c
// > LoadingLayer::loadAssets @ 0x30b83a
// > LoadingLayer::loadAssets @ 0x30b848
// > LoadingLayer::loadAssets @ 0x30b862
// > LoadingLayer::loadAssets @ 0x30b87e
// > LoadingLayer::loadAssets @ 0x30b898
// > LoadingLayer::loadAssets @ 0x30b8a6
// > LoadingLayer::loadAssets @ 0x30b8b4
// > LoadingLayer::loadAssets @ 0x30b8c2
// > LoadingLayer::loadAssets @ 0x30b8de
// > LoadingLayer::loadAssets @ 0x30b8ec
// > LoadingLayer::loadAssets @ 0x30b8fa
// > LoadingLayer::loadAssets @ 0x30b908
// > LoadingLayer::loadAssets @ 0x30b916
// > LoadingLayer::loadAssets @ 0x30b924
// > LoadingLayer::loadAssets @ 0x30b982
// > LoadingLayer::loadAssets @ 0x30b990
// > LoadingLayer::init @ 0x30c1fc
// > GameManager::loadFont @ 0x3225d6
// > GameManager::loadDeathEffect @ 0x3226ae
// > GameManager::loadBackground @ 0x322786
// > GameManager::loadMiddleground @ 0x322860
// > GameManager::loadMiddleground @ 0x32287c
// > GameManager::loadGround @ 0x322a5c
// > GameManager::loadGround @ 0x322a84
// > GameManager::loadIcon @ 0x329672
// > PlayerObject::setupStreak @ 0x34ee2e
// > PlayerObject::update @ 0x34f8f2
// > GameObject::createWithKey @ 0x362466
// > LevelEditorLayer::updateLevelFont @ 0x36845a
// > LevelEditorLayer::updateLevelFont @ 0x3685ce
// > EditorUI::getCreateBtn @ 0x38637e
// > AudioEffectsLayer::init @ 0x4019a4
// > GJMoreGamesLayer::getMoreGamesList @ 0x42b380
// > GJBaseGameLayer::createTextLayers @ 0x46df28
// > GJBaseGameLayer::createTextLayers @ 0x46e04c
// > GJBaseGameLayer::createTextLayers @ 0x46e072
// > GJBaseGameLayer::setupLayers @ 0x47a97a
// > GJBaseGameLayer::setupLayers @ 0x47a98c
// > GJBaseGameLayer::setupLayers @ 0x47a99e
// > GJBaseGameLayer::setupLayers @ 0x47a9b0
// > GJBaseGameLayer::setupLayers @ 0x47a9c2
// > GJBaseGameLayer::setupLayers @ 0x47a9d4
// > FMODLevelVisualizer::init @ 0x4b14c8
// > GJPromoPopup::init @ 0x4b38e2
// > CurrencyRewardLayer::init @ 0x4d2246
// > GauntletSelectLayer::init @ 0x4d944e
// > GJShopLayer::init @ 0x4e31ac
// > SecretLayer2::init @ 0x4ee644
// > SecretLayer3::init @ 0x4ef054
// > SecretLayer4::init @ 0x4f19f0
// > WorldSelectLayer::init @ 0x4fe248
// > LevelAreaLayer::init @ 0x56c854
// > LevelAreaInnerLayer::init @ 0x56d10c
// > SecretRewardsLayer::init @ 0x585eb2
// > GJPathsLayer::init @ 0x58cd8a
// > SecretLayer5::init @ 0x59edc2
// > SecretLayer5::init @ 0x59eddc
// > SecretLayer6::init @ 0x59f7c8
// > cocos2d::CCAtlasNode::initWithTileFile @ 0x5bc80e
// > cocos2d::CCLabelAtlas::initWithString @ 0x5cb1f2
// > cocos2d::CCLabelBMFont::setFntFile @ 0x5cd4c8
// > cocos2d::CCLabelBMFont::initWithString @ 0x5cdbca
// > cocos2d::CCMotionStreak::initWithFade @ 0x5d6f8c
// > cocos2d::CCParticleSystem::initWithDictionary @ 0x5dcbce
// > cocos2d::CCParticleBatchNode::initWithFile @ 0x5dd268
// > cocos2d::CCAnimation::addSpriteFrameWithFileName @ 0x5e57ee
// > cocos2d::CCSprite::initWithFile @ 0x5e6154
// > cocos2d::CCSprite::initWithFile @ 0x5e61b8
// > cocos2d::CCSpriteBatchNode::initWithFile @ 0x5e848c
// > cocos2d::CCSpriteFrame::getTexture @ 0x5e8fba
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x5e95a6
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x5e9ae4
// > cocos2d::CCTextureAtlas::initWithFile @ 0x5f4676
// > cocos2d::CCTextureCache::reloadTexture @ 0x5f55a4
// > cocos2d::CCTMXLayer::initWithTilesetInfo @ 0x5f7374
//
// 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::addImage(cocos2d::CCTextureCache *a1, const char *a2, bool a3)
{
_BOOL4 v3; // r5
cocos2d::CCFileUtils *v5; // r0
cocos2d::CCTexture2D *v6; // r4
cocos2d::CCDictionary *m_pTextures; // r4
unsigned int v8; // r7
int v9; // r8
cocos2d::CCTexture2D *v10; // r0
cocos2d::CCImage *v11; // r7
cocos2d::CCImage::EImageFormat v12; // r8
cocos2d::CCDictionary *v14; // r10
char *v15; // [sp+Ch] [bp-18h] BYREF
char *v16; // [sp+10h] [bp-14h] BYREF
int v17; // [sp+14h] [bp-10h] BYREF
const char *v18; // [sp+18h] [bp-Ch] BYREF
v3 = a3;
sub_776584((int)&v15, (char *)a2);
v5 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(const char **, cocos2d::CCFileUtils *, char *, _BOOL4))v5->createCCArrayWithContentsOfFile)(
&v18,
v5,
v15,
v3);
sub_774794(&v15, &v18);
sub_774008(&v18);
v6 = *((cocos2d::CCTexture2D **)v15 - 3);
if ( !v6 )
goto LABEL_21;
m_pTextures = a1->m_pTextures;
sub_776584((int)&v18, v15);
v6 = (cocos2d::CCTexture2D *)cocos2d::CCDictionary::objectForKey((int)m_pTextures, &v18);
sub_774008(&v18);
if ( v6 )
goto LABEL_21;
v8 = 0;
sub_775C20(&v16);
sub_775C20(&v17);
while ( v8 < *(_DWORD *)(v17 - 12) )
{
sub_775170(&v17);
v9 = v17;
sub_775170(&v17);
*(_BYTE *)(v9 + v8) = tolower(*(unsigned __int8 *)(v17 + v8));
++v8;
}
if ( sub_7748A0((int)&v17, ".pvr") == -1 )
{
if ( sub_7748A0((int)&v17, ".pkm") == -1 )
{
if ( sub_7748A0((int)&v17, ".png") == -1 )
{
if ( sub_7748A0((int)&v17, ".jpg") == -1 && sub_7748A0((int)&v17, ".jpeg") == -1 )
{
if ( sub_7748A0((int)&v17, ".tif") == -1 && sub_7748A0((int)&v17, ".tiff") == -1 )
{
if ( sub_7748A0((int)&v17, ".webp") == -1 )
v12 = kFmtUnKnown;
else
v12 = kFmtWebp;
}
else
{
v12 = kFmtTiff;
}
}
else
{
v12 = kFmtJpg;
}
}
else
{
v12 = kFmtPng;
}
v11 = (cocos2d::CCImage *)operator new(0x48u);
cocos2d::CCImage::CCImage(v11);
if ( cocos2d::CCImage::initWithImageFile(v11, v16, v12) )
{
v6 = (cocos2d::CCTexture2D *)operator new(0x60u);
cocos2d::CCTexture2D::CCTexture2D(v6);
if ( cocos2d::CCTexture2D::initWithImage(v6, v11) )
{
cocos2d::VolatileTexture::addImageTexture((cocos2d::VolatileTexture *)v6, (cocos2d::CCTexture2D *)v16, v12);
v14 = a1->m_pTextures;
sub_776584((int)&v18, v15);
cocos2d::CCDictionary::setObject((int)v14, v6, &v18);
sub_774008(&v18);
cocos2d::CCObject::release(v6);
}
}
goto LABEL_19;
}
v10 = cocos2d::CCTextureCache::addETCImage(a1, v16);
}
else
{
v10 = cocos2d::CCTextureCache::addPVRImage(a1, v16);
}
v6 = v10;
v11 = nullptr;
LABEL_19:
sub_774008(&v17);
sub_774008(&v16);
if ( v11 )
cocos2d::CCObject::release(v11);
LABEL_21:
sub_774008(&v15);
return v6;
}