//
// cocos2d::CCTextureCache::addImage from 0x100113dec to 0x1001142b4 (1224 bytes)
//
// 76 xrefs:
// > ButtonSprite::updateBGImage @ 0x10005fa5c
// > GJMoreGamesLayer::getMoreGamesList @ 0x100065098
// > SecretLayer5::init @ 0x100074008
// > SecretLayer5::init @ 0x10007402c
// > GJShopLayer::init @ 0x10014a8b4
// > cocos2d::CCMotionStreak::initWithFade_1 @ 0x100176c80
// > cocos2d::CCParticleSystem::initWithDictionary @ 0x100194258
// > GauntletSelectLayer::init @ 0x1001be6b0
// > LoadingLayer::init @ 0x1001d607c
// > LoadingLayer::loadAssets @ 0x1001d6804
// > LoadingLayer::loadAssets @ 0x1001d6828
// > LoadingLayer::loadAssets @ 0x1001d6910
// > LoadingLayer::loadAssets @ 0x1001d6934
// > LoadingLayer::loadAssets @ 0x1001d6958
// > LoadingLayer::loadAssets @ 0x1001d696c
// > LoadingLayer::loadAssets @ 0x1001d6980
// > LoadingLayer::loadAssets @ 0x1001d69a4
// > LoadingLayer::loadAssets @ 0x1001d6ad0
// > LoadingLayer::loadAssets @ 0x1001d6af4
// > LoadingLayer::loadAssets @ 0x1001d6b08
// > LoadingLayer::loadAssets @ 0x1001d6b1c
// > LoadingLayer::loadAssets @ 0x1001d6b30
// > LoadingLayer::loadAssets @ 0x1001d6bb8
// > LoadingLayer::loadAssets @ 0x1001d6bdc
// > LoadingLayer::loadAssets @ 0x1001d6c0c
// > LoadingLayer::loadAssets @ 0x1001d6c30
// > LoadingLayer::loadAssets @ 0x1001d6c54
// > LoadingLayer::loadAssets @ 0x1001d6c68
// > LoadingLayer::loadAssets @ 0x1001d6c7c
// > LoadingLayer::loadAssets @ 0x1001d6c90
// > LoadingLayer::loadAssets @ 0x1001d6ca4
// > LoadingLayer::loadAssets @ 0x1001d6cb8
// > LoadingLayer::loadAssets @ 0x1001d6d3c
// > LoadingLayer::loadAssets @ 0x1001d6d50
// > cocos2d::CCSpriteBatchNode::initWithFile @ 0x1001d71b0
// > GJBaseGameLayer::setupLayers @ 0x1001db788
// > GJBaseGameLayer::setupLayers @ 0x1001db7a0
// > GJBaseGameLayer::setupLayers @ 0x1001db7b8
// > GJBaseGameLayer::setupLayers @ 0x1001db7d0
// > GJBaseGameLayer::setupLayers @ 0x1001db7e8
// > GJBaseGameLayer::setupLayers @ 0x1001db800
// > GJBaseGameLayer::createTextLayers @ 0x1001e2fc0
// > GJBaseGameLayer::createTextLayers @ 0x1001e3160
// > GJBaseGameLayer::createTextLayers @ 0x1001e3194
// > PlayerObject::setupStreak @ 0x1002192f4
// > PlayerObject::update @ 0x10021a2b0
// > cocos2d::CCSprite::initWithFile_1 @ 0x100237a44
// > cocos2d::CCSprite::initWithFile @ 0x100237ad8
// > cocos2d::CCSpriteFrame::getTexture @ 0x10024e554
// > GameObject::createWithKey @ 0x100254940
// > FMODLevelVisualizer::init @ 0x1002e0f94
// > GJPromoPopup::init @ 0x1002e527c
// > SecretRewardsLayer::init @ 0x1002e8014
// > cocos2d::CCLabelBMFont::initWithString @ 0x1002fb1b8
// > CCAnimatedSprite::initWithType @ 0x1002fd384
// > CCAnimatedSprite::loadType @ 0x1002fd534
// > SecretLayer2::init @ 0x10030979c
// > SecretLayer3::init @ 0x10030ddc4
// > GameManager::loadIcon @ 0x100317b74
// > GameManager::loadFont @ 0x1003181b4
// > GameManager::loadDeathEffect @ 0x100318348
// > GameManager::loadBackground @ 0x1003184ac
// > GameManager::loadMiddleground @ 0x1003186c8
// > GameManager::loadMiddleground @ 0x1003186f4
// > GameManager::loadGround @ 0x1003189f8
// > GameManager::loadGround @ 0x100318a30
// > CurrencyRewardLayer::init @ 0x10031e8a0
// > LevelAreaLayer::init @ 0x100343c00
// > LevelAreaInnerLayer::init @ 0x1003457a4
// > SecretLayer4::init @ 0x100353e60
// > LevelEditorLayer::updateLevelFont @ 0x100362034
// > LevelEditorLayer::updateLevelFont @ 0x100362240
// > GJPathsLayer::init @ 0x1003b7fec
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x1003bca50
// > AudioEffectsLayer::init @ 0x1003c460c
// > EditorUI::getCreateBtn @ 0x1003ea268
//
// 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 *__fastcall cocos2d::CCTextureCache::addImage(
cocos2d::CCTextureCache *a1,
const char *a2,
bool a3)
{
cocos2d::CCFileUtils *v4; // x0
cocos2d::CCDictionary *m_pTextures; // x20
cocos2d::CCDictionary **p_m_pTextures; // x21
char *v7; // x1
__int64 v8; // x0
cocos2d::CCTexture2D *v9; // x20
unsigned int i; // w8
unsigned __int64 v11; // x23
__int64 v12; // x22
__int128 *v13; // x8
char v14; // w0
__int128 *v15; // x8
__int128 *p_s; // x20
unsigned __int64 v17; // x8
char *v18; // x23
__int128 *v19; // x0
char *v20; // x0
void **v21; // x1
cocos2d::CCTexture2D *v22; // x0
__int128 *v23; // x20
__int64 v24; // x23
char *v25; // x22
__int64 v26; // x8
__int128 *v27; // x0
char *v28; // x0
void **v29; // x1
cocos2d::CCImage *v30; // x19
__int128 *v31; // x0
char *v32; // x0
cocos2d::CCImage::EImageFormat v33; // w20
void **v34; // x1
cocos2d::CCDictionary *v35; // x21
char *v36; // x1
void *v38[2]; // [xsp+8h] [xbp-A8h] BYREF
char v39; // [xsp+1Fh] [xbp-91h]
__int128 __s; // [xsp+20h] [xbp-90h] BYREF
__int64 v41; // [xsp+30h] [xbp-80h]
void *__p[2]; // [xsp+40h] [xbp-70h] BYREF
__int64 v43; // [xsp+50h] [xbp-60h]
__int128 v44; // [xsp+60h] [xbp-50h] BYREF
__int64 v45; // [xsp+70h] [xbp-40h]
sub_100009900(&v44, (char *)a2);
v4 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(void **__return_ptr))v4->createCCArrayWithContentsOfFile)(__p);
if ( SHIBYTE(v45) < 0 )
operator delete((void *)v44);
v45 = v43;
v44 = *(_OWORD *)__p;
if ( SHIBYTE(v43) < 0 )
{
if ( !*((_QWORD *)&v44 + 1) )
{
v9 = nullptr;
goto LABEL_92;
}
p_m_pTextures = &a1->m_pTextures;
m_pTextures = a1->m_pTextures;
v7 = (char *)v44;
}
else
{
if ( !HIBYTE(v43) )
return nullptr;
p_m_pTextures = &a1->m_pTextures;
m_pTextures = a1->m_pTextures;
v7 = (char *)&v44;
}
sub_100009900(__p, v7);
v8 = cocos2d::CCDictionary::objectForKey_1(m_pTextures, __p);
v9 = (cocos2d::CCTexture2D *)v8;
if ( SHIBYTE(v43) < 0 )
{
operator delete(__p[0]);
if ( v9 )
goto LABEL_92;
}
else if ( v8 )
{
goto LABEL_92;
}
if ( SHIBYTE(v45) < 0 )
{
sub_1000097D0(__p, (void *)v44, *((unsigned __int64 *)&v44 + 1));
if ( SHIBYTE(v45) < 0 )
{
sub_1000097D0(&__s, (void *)v44, *((unsigned __int64 *)&v44 + 1));
goto LABEL_18;
}
}
else
{
*(_OWORD *)__p = v44;
v43 = v45;
}
__s = v44;
v41 = v45;
LABEL_18:
for ( i = 0; ; i = v11 + 1 )
{
v11 = i;
v12 = SHIBYTE(v41);
if ( SHIBYTE(v41) < 0 )
break;
if ( i >= SHIBYTE(v41) )
{
p_s = &__s;
v17 = SHIBYTE(v41);
goto LABEL_30;
}
LABEL_23:
v13 = (__int128 *)__s;
if ( v41 >= 0 )
v13 = &__s;
v14 = __tolower(*((char *)v13 + v11));
if ( v41 >= 0 )
v15 = &__s;
else
v15 = (__int128 *)__s;
*((_BYTE *)v15 + v11) = v14;
}
v17 = *((_QWORD *)&__s + 1);
if ( *((_QWORD *)&__s + 1) > v11 )
goto LABEL_23;
p_s = (__int128 *)__s;
LABEL_30:
if ( v17 >= 4 )
{
v18 = (char *)p_s + v17;
v19 = p_s;
do
{
v20 = (char *)memchr(v19, 46, v17 - 3);
if ( !v20 )
break;
if ( *(_DWORD *)v20 == 1920364590 )
{
if ( v20 == v18 || v20 - (char *)p_s == -1 )
break;
if ( v43 >= 0 )
v21 = __p;
else
v21 = (void **)__p[0];
v22 = cocos2d::CCTextureCache::addPVRImage(a1, (const char *)v21);
LABEL_60:
v9 = v22;
v30 = nullptr;
goto LABEL_85;
}
v19 = (__int128 *)(v20 + 1);
v17 = v18 - (char *)v19;
}
while ( v18 - (char *)v19 >= 4 );
}
if ( (int)v12 >= 0 )
v23 = &__s;
else
v23 = (__int128 *)__s;
if ( (int)v12 >= 0 )
v24 = v12;
else
v24 = *((_QWORD *)&__s + 1);
if ( v24 >= 4 )
{
v25 = (char *)v23 + v24;
v26 = v24;
v27 = v23;
do
{
v28 = (char *)memchr(v27, 46, v26 - 3);
if ( !v28 )
break;
if ( *(_DWORD *)v28 == 1835757614 )
{
if ( v28 != v25 && v28 - (char *)v23 != -1 )
{
if ( v43 >= 0 )
v29 = __p;
else
v29 = (void **)__p[0];
v22 = cocos2d::CCTextureCache::addETCImage(a1, (const char *)v29);
goto LABEL_60;
}
break;
}
v27 = (__int128 *)(v28 + 1);
v26 = v25 - (char *)v27;
}
while ( v25 - (char *)v27 >= 4 );
v31 = v23;
do
{
v32 = (char *)memchr(v31, 46, v24 - 3);
if ( !v32 )
break;
if ( *(_DWORD *)v32 == 1735290926 )
{
if ( v32 != v25 && v32 - (char *)v23 != -1 )
{
v33 = kFmtPng;
goto LABEL_73;
}
break;
}
v31 = (__int128 *)(v32 + 1);
v24 = v25 - (char *)v31;
}
while ( v25 - (char *)v31 >= 4 );
}
if ( sub_100114350((int)&__s, ".jpg") == -1 && sub_100114350((int)&__s, ".jpeg") == -1 )
{
if ( sub_100114350((int)&__s, ".tif") == -1 && sub_100114350((int)&__s, ".tiff") == -1 )
{
if ( sub_100114350((int)&__s, ".webp") == -1 )
v33 = kFmtUnKnown;
else
v33 = kFmtWebp;
}
else
{
v33 = kFmtTiff;
}
}
else
{
v33 = kFmtJpg;
}
LABEL_73:
v30 = (cocos2d::CCImage *)operator new(0x50u);
cocos2d::CCImage::CCImage((__int64)v30);
if ( v43 >= 0 )
v34 = __p;
else
v34 = (void **)__p[0];
if ( cocos2d::CCImage::initWithImageFile(v30, (const char *)v34, v33) )
{
v9 = (cocos2d::CCTexture2D *)operator new(0x68u);
j_cocos2d::CCTexture2D::CCTexture2D();
if ( cocos2d::CCTexture2D::initWithImage(v9, v30) )
{
v35 = *p_m_pTextures;
if ( v45 >= 0 )
v36 = (char *)&v44;
else
v36 = (char *)v44;
sub_100009900(v38, v36);
cocos2d::CCDictionary::setObject_1(v35, v9, v38);
if ( v39 < 0 )
operator delete(v38[0]);
cocos2d::CCObject::release(v9);
}
}
else
{
v9 = nullptr;
}
LABEL_85:
if ( SHIBYTE(v41) < 0 )
operator delete((void *)__s);
if ( SHIBYTE(v43) < 0 )
{
operator delete(__p[0]);
if ( v30 )
goto LABEL_91;
}
else
{
if ( !v30 )
goto LABEL_92;
LABEL_91:
cocos2d::CCObject::release(v30);
}
LABEL_92:
if ( SHIBYTE(v45) < 0 )
operator delete((void *)v44);
return v9;
}