//
// cocos2d::CCTextureCache::addImage from 0x1006c0b60 to 0x1006c1153 (1523 bytes)
//
// 95 xrefs:
// > ButtonSprite::updateBGImage @ 0x10005a759
// > LevelEditorLayer::updateLevelFont @ 0x1000c4945
// > LevelEditorLayer::updateLevelFont @ 0x1000c4c2c
// > GJBaseGameLayer::setupLayers @ 0x1000ed8df
// > GJBaseGameLayer::setupLayers @ 0x1000ed8f8
// > GJBaseGameLayer::setupLayers @ 0x1000ed912
// > GJBaseGameLayer::setupLayers @ 0x1000ed92c
// > GJBaseGameLayer::setupLayers @ 0x1000ed945
// > GJBaseGameLayer::setupLayers @ 0x1000ed95f
// > GJBaseGameLayer::createTextLayers @ 0x1000fbce9
// > GJBaseGameLayer::createTextLayers @ 0x1000fbeb4
// > GJBaseGameLayer::createTextLayers @ 0x1000fbef2
// > cocos2d::CCSpriteBatchNode::create @ 0x100155937
// > cocos2d::CCSpriteBatchNode::initWithFile @ 0x10015599f
// > cocos2d::CCTMXLayer::initWithTilesetInfo @ 0x100243a99
// > LevelAreaLayer::init @ 0x100263f7e
// > LevelAreaInnerLayer::init @ 0x10026635d
// > cocos2d::CCSprite::initWithFile_1 @ 0x100273f05
// > cocos2d::CCSprite::initWithFile @ 0x100273f90
// > cocos2d::CCAnimation::addSpriteFrameWithFileName @ 0x100281532
// > FMODLevelVisualizer::init @ 0x10029db5b
// > sub_1002A4500 @ 0x1002a4541
// > GJPathsLayer::init @ 0x1002e8f25
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_1 @ 0x100308170
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_2 @ 0x1003083eb
// > GJShopLayer::init @ 0x10030e974
// > cocos2d::CCAtlasNode::create @ 0x1003161b0
// > cocos2d::CCAtlasNode::initWithTileFile @ 0x10031623a
// > CCAnimatedSprite::initWithType @ 0x10033b735
// > CCAnimatedSprite::loadType @ 0x10033baaf
// > cocos2d::CCSpriteFrame::getTexture @ 0x100343d7f
// > GameManager::loadIcon @ 0x10036b49b
// > GameManager::loadFont @ 0x10036c48f
// > GameManager::loadDeathEffect @ 0x10036c5f0
// > GameManager::loadBackground @ 0x10036c76b
// > GameManager::loadMiddleground @ 0x10036c96a
// > GameManager::loadMiddleground @ 0x10036c998
// > GameManager::loadGround @ 0x10036cc87
// > GameManager::loadGround @ 0x10036ccc2
// > LoadingLayer::init @ 0x10038bd2f
// > LoadingLayer::loadAssets @ 0x10038c51b
// > LoadingLayer::loadAssets @ 0x10038c53f
// > LoadingLayer::loadAssets @ 0x10038c66a
// > LoadingLayer::loadAssets @ 0x10038c694
// > LoadingLayer::loadAssets @ 0x10038c6be
// > LoadingLayer::loadAssets @ 0x10038c6d4
// > LoadingLayer::loadAssets @ 0x10038c6ea
// > LoadingLayer::loadAssets @ 0x10038c714
// > LoadingLayer::loadAssets @ 0x10038c87c
// > LoadingLayer::loadAssets @ 0x10038c8a6
// > LoadingLayer::loadAssets @ 0x10038c8bc
// > LoadingLayer::loadAssets @ 0x10038c8d2
// > LoadingLayer::loadAssets @ 0x10038c8e8
// > LoadingLayer::loadAssets @ 0x10038c97b
// > LoadingLayer::loadAssets @ 0x10038c9a2
// > LoadingLayer::loadAssets @ 0x10038c9de
// > LoadingLayer::loadAssets @ 0x10038ca08
// > LoadingLayer::loadAssets @ 0x10038ca2f
// > LoadingLayer::loadAssets @ 0x10038ca45
// > LoadingLayer::loadAssets @ 0x10038ca5b
// > LoadingLayer::loadAssets @ 0x10038ca71
// > LoadingLayer::loadAssets @ 0x10038ca87
// > LoadingLayer::loadAssets @ 0x10038ca9d
// > LoadingLayer::loadAssets @ 0x10038cb32
// > LoadingLayer::loadAssets @ 0x10038cb48
// > SecretLayer4::init @ 0x10039a0b8
// > WorldSelectLayer::init @ 0x1003ab1ec
// > cocos2d::CCParticleBatchNode::create @ 0x1003b1ff5
// > cocos2d::CCParticleBatchNode::initWithFile @ 0x1003b205f
// > PlayerObject::setupStreak @ 0x1003e9c3d
// > PlayerObject::update @ 0x1003eb0d3
// > SecretLayer5::init @ 0x10046e9e9
// > SecretLayer5::init @ 0x10046ea13
// > SecretLayer6::init @ 0x100473505
// > SecretLayer2::init @ 0x1004961a8
// > SecretLayer3::init @ 0x10049c617
// > cocos2d::CCTextureAtlas::create @ 0x1004a6076
// > cocos2d::CCTextureAtlas::initWithFile @ 0x1004a60ef
// > AudioEffectsLayer::init @ 0x1004a89d7
// > PlatformToolbox::spriteFromSavedFile @ 0x1004bd782
// > GauntletSelectLayer::init @ 0x10059e6b5
// > cocos2d::CCMotionStreak::create_1 @ 0x1005a3804
// > cocos2d::CCMotionStreak::initWithFade_1 @ 0x1005a38a2
// > EditorUI::getCreateBtn @ 0x100637f48
// > GameObject::createWithKey @ 0x10066ed3e
// > cocos2d::CCLabelBMFont::initWithString @ 0x1006aa0e7
// > cocos2d::CCLabelBMFont::setFntFile @ 0x1006ace05
// > cocos2d::CCTextureCache::reloadTexture @ 0x1006c1cde
// > SecretRewardsLayer::init @ 0x10070cd12
// > GJMoreGamesLayer::getMoreGamesList @ 0x100875dd6
// > cocos2d::CCLabelAtlas::create @ 0x1008799bd
// > cocos2d::CCLabelAtlas::initWithString_1 @ 0x100879a6e
// > cocos2d::CCLabelAtlas::initWithString_2 @ 0x100879f9f
// > CurrencyRewardLayer::init @ 0x100888f83
// > cocos2d::CCParticleSystem::initWithDictionary @ 0x1008afd35
//
// This function is hookable on this platform (idp: pc, 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 12:35:32 +0000
//
_DWORD *__fastcall cocos2d::CCTextureCache::addImage(__int64 a1, const char *a2, unsigned __int8 a3)
{
const char *v4; // rdi
size_t v5; // rax
size_t v6; // rbx
char *v7; // r13
size_t v8; // r14
__int64 v9; // rax
char *v10; // rdx
__int64 v11; // r15
const char *v12; // r12
size_t v13; // rax
size_t v14; // r13
char *v15; // rbx
_DWORD *v16; // r15
size_t v17; // r14
unsigned int v18; // eax
char *v19; // rbx
__int64 v20; // r15
unsigned __int8 v21; // r14
unsigned __int64 v22; // rdx
char *v23; // rax
char v24; // al
char *v25; // rcx
char *v26; // r15
char *v27; // r12
void *v28; // rax
char *v29; // rax
__int64 v30; // r15
char *v31; // r14
__int64 v32; // rdx
void *v33; // rax
char *v34; // rax
void *v35; // rax
char *v36; // rax
char *v37; // rsi
char *v38; // rsi
unsigned int v39; // r15d
_DWORD *v40; // r14
char *v41; // rsi
__int64 v42; // rdx
__int64 v43; // rcx
__int64 v44; // r8
__int64 v45; // rbx
__int64 v47; // rax
void *v48[3]; // [rsp+0h] [rbp-B0h] BYREF
const char *v49; // [rsp+18h] [rbp-98h]
__int64 *v50; // [rsp+20h] [rbp-90h]
__int64 v51; // [rsp+28h] [rbp-88h]
__int128 __s; // [rsp+30h] [rbp-80h] BYREF
void *v53; // [rsp+40h] [rbp-70h]
__int128 v54; // [rsp+50h] [rbp-60h] BYREF
void *v55; // [rsp+60h] [rbp-50h]
__int128 __dst; // [rsp+70h] [rbp-40h] BYREF
void *__p; // [rsp+80h] [rbp-30h]
v51 = a1;
v4 = a2;
v5 = strlen(a2);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
*(_QWORD *)&__dst = v8 + 1;
*((_QWORD *)&__dst + 1) = v6;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( v5 )
{
LABEL_8:
v4 = v7;
memcpy(v7, a2, v6);
}
v7[v6] = 0;
v9 = cocos2d::CCFileUtils::sharedFileUtils(v4, a2);
v10 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
v10 = (char *)__p;
(*(void (__fastcall **)(__int128 *, __int64, char *, _QWORD))(*(_QWORD *)v9 + 48LL))(&v54, v9, v10, a3);
if ( (__dst & 1) != 0 )
operator delete(__p);
__p = v55;
__dst = v54;
if ( (v54 & 1) == 0 )
{
if ( (_BYTE)v54 )
{
v50 = (__int64 *)(v51 + 56);
v11 = *(_QWORD *)(v51 + 56);
v12 = (char *)&__dst + 1;
goto LABEL_18;
}
LABEL_22:
v16 = nullptr;
goto LABEL_98;
}
if ( !*((_QWORD *)&__dst + 1) )
goto LABEL_22;
v50 = (__int64 *)(v51 + 56);
v11 = *(_QWORD *)(v51 + 56);
v12 = (const char *)__p;
LABEL_18:
v13 = strlen(v12);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
v49 = (char *)&__dst + 1;
if ( v13 >= 0x17 )
{
v17 = 26;
if ( (v13 | 7) != 0x17 )
v17 = (v13 | 7) + 1;
v15 = (char *)operator new(v17);
v55 = v15;
*(_QWORD *)&v54 = v17 | 1;
*((_QWORD *)&v54 + 1) = v14;
goto LABEL_26;
}
LOBYTE(v54) = 2 * v13;
v15 = (char *)&v54 + 1;
if ( v13 )
LABEL_26:
memmove(v15, v12, v14);
v15[v14] = 0;
v16 = (_DWORD *)cocos2d::CCDictionary::objectForKey(v11, (char *)&v54);
if ( (v54 & 1) != 0 )
operator delete(v55);
if ( v16 )
goto LABEL_98;
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&v54, __p, *((unsigned __int64 *)&__dst + 1));
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&__s, __p, *((unsigned __int64 *)&__dst + 1));
goto LABEL_35;
}
}
else
{
v55 = __p;
v54 = __dst;
}
v53 = __p;
__s = __dst;
LABEL_35:
v18 = 0;
v19 = (char *)&__s + 1;
while ( 1 )
{
v20 = v18;
v21 = __s;
if ( (__s & 1) != 0 )
break;
v22 = (unsigned __int8)__s >> 1;
if ( v18 >= (unsigned int)v22 )
{
v26 = (char *)&__s + 1;
if ( v22 < 4 )
goto LABEL_54;
goto LABEL_48;
}
LABEL_41:
v23 = (char *)&__s + 1;
if ( (__s & 1) != 0 )
v23 = (char *)v53;
v24 = __tolower(v23[v20]);
v25 = (char *)&__s + 1;
if ( (__s & 1) != 0 )
v25 = (char *)v53;
v25[v20] = v24;
v18 = v20 + 1;
}
v22 = *((_QWORD *)&__s + 1);
if ( *((_QWORD *)&__s + 1) > (unsigned __int64)v18 )
goto LABEL_41;
v26 = (char *)v53;
if ( *((_QWORD *)&__s + 1) < 4u )
goto LABEL_54;
LABEL_48:
v27 = &v26[v22];
v28 = v26;
do
{
v29 = (char *)memchr(v28, 46, v22 - 3);
if ( !v29 )
break;
if ( *(_DWORD *)v29 == 1920364590 )
{
if ( v29 == v27 || v29 - v26 == -1 )
break;
if ( (v54 & 1) != 0 )
v37 = (char *)v55;
else
v37 = (char *)&v54 + 1;
v47 = cocos2d::CCTextureCache::addPVRImage(v51, v37);
LABEL_105:
v16 = (_DWORD *)v47;
v40 = nullptr;
if ( (__s & 1) == 0 )
goto LABEL_91;
goto LABEL_95;
}
v28 = v29 + 1;
v22 = v27 - (_BYTE *)v28;
}
while ( v27 - (_BYTE *)v28 >= 4 );
LABEL_54:
if ( (v21 & 1) != 0 )
v19 = (char *)v53;
v30 = v21 >> 1;
if ( (v21 & 1) != 0 )
v30 = *((_QWORD *)&__s + 1);
if ( v30 >= 4 )
{
v31 = &v19[v30];
v32 = v30;
v33 = v19;
do
{
v34 = (char *)memchr(v33, 46, v32 - 3);
if ( !v34 )
break;
if ( *(_DWORD *)v34 == 1835757614 )
{
if ( v34 != v31 && v34 - v19 != -1 )
{
if ( (v54 & 1) != 0 )
v38 = (char *)v55;
else
v38 = (char *)&v54 + 1;
v47 = cocos2d::CCTextureCache::addETCImage(v51, v38);
goto LABEL_105;
}
break;
}
v33 = v34 + 1;
v32 = v31 - (_BYTE *)v33;
}
while ( v31 - (_BYTE *)v33 >= 4 );
v35 = v19;
do
{
v36 = (char *)memchr(v35, 46, v30 - 3);
if ( !v36 )
break;
if ( *(_DWORD *)v36 == 1735290926 )
{
v39 = 1;
if ( v36 != v31 && v36 - v19 != -1 )
goto LABEL_80;
break;
}
v35 = v36 + 1;
v30 = v31 - (_BYTE *)v35;
}
while ( v31 - (_BYTE *)v35 >= 4 );
}
v39 = 0;
if ( sub_1006C1230(&__s, ".jpg", 0) == -1 )
{
v39 = 0;
if ( sub_1006C1230(&__s, ".jpeg", 0) == -1 )
{
v39 = 2;
if ( sub_1006C1230(&__s, ".tif", 0) == -1 && sub_1006C1230(&__s, ".tiff", 0) == -1 )
v39 = 2 * (sub_1006C1230(&__s, ".webp", 0) == -1) + 3;
}
}
LABEL_80:
v40 = operator new(0x50u);
cocos2d::CCImage::CCImage((__int64)v40);
if ( (v54 & 1) != 0 )
v41 = (char *)v55;
else
v41 = (char *)&v54 + 1;
if ( (unsigned __int8)cocos2d::CCImage::initWithImageFile((__int64)v40, (__int64)v41, v39) )
{
v16 = operator new(0x68u);
sub_10046C920((__int64)v16);
if ( cocos2d::CCTexture2D::initWithImage((__int64)v16, (__int64)v40, v42, v43, v44) )
{
if ( (__dst & 1) != 0 )
v49 = (const char *)__p;
v45 = *v50;
sub_10000E4E0(v48, v49);
cocos2d::CCDictionary::setObject(v45, (__int64)v16, (char *)v48);
if ( ((__int64)v48[0] & 1) != 0 )
operator delete(v48[2]);
cocos2d::CCObject::release(v16);
}
if ( (__s & 1) == 0 )
{
LABEL_91:
if ( (v54 & 1) == 0 )
goto LABEL_92;
LABEL_96:
operator delete(v55);
if ( v40 )
goto LABEL_97;
goto LABEL_98;
}
}
else
{
v16 = nullptr;
if ( (__s & 1) == 0 )
goto LABEL_91;
}
LABEL_95:
operator delete(v53);
if ( (v54 & 1) != 0 )
goto LABEL_96;
LABEL_92:
if ( v40 )
LABEL_97:
cocos2d::CCObject::release(v40);
LABEL_98:
if ( (__dst & 1) != 0 )
operator delete(__p);
return v16;
}