//
// cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile from 0x7f4688 to 0x7f4910 (648 bytes)
//
// 25 xrefs:
// > LoadingLayer::init @ 0x3fb5d4
// > LoadingLayer::loadAssets @ 0x3fbbf4
// > LoadingLayer::loadAssets @ 0x3fbc18
// > LoadingLayer::loadAssets @ 0x3fbc56
// > LoadingLayer::loadAssets @ 0x3fbca2
// > LoadingLayer::loadAssets @ 0x3fbcc0
// > LoadingLayer::loadAssets @ 0x3fbcf6
// > LoadingLayer::loadAssets @ 0x3fbd2c
// > GameManager::loadDeathEffect @ 0x414672
// > GameManager::loadIcon @ 0x41d720
// > GauntletSelectLayer::init @ 0x60cec8
// > GJShopLayer::init @ 0x612bde
// > SecretLayer2::init @ 0x61f31a
// > SecretLayer3::init @ 0x61fd5c
// > SecretLayer4::init @ 0x622bd6
// > WorldSelectLayer::init @ 0x62e0c2
// > LevelAreaLayer::init @ 0x6a4a94
// > LevelAreaInnerLayer::init @ 0x6a5364
// > SecretRewardsLayer::init @ 0x6cdfa4
// > GJPathsLayer::init @ 0x6d2b3e
// > SecretLayer5::init @ 0x6e5be6
// > SecretLayer5::init @ 0x6e5c04
// > SecretLayer6::init @ 0x6e65ba
// > SelectFontLayer2::loadPreviewSheet @ 0x7a1b36
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0x7f0716
//
// 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:07 +0000
//
CCContentManager *__fastcall cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(
cocos2d::CCSpriteFrameCache *this,
const char *a2)
{
int v3; // r6
size_t v5; // r0
int *v6; // r0
int v7; // r6
int *v8; // r10
CCContentManager *result; // r0
CCContentManager *v10; // r0
cocos2d::CCDictionary *v11; // r10
int v12; // r11
unsigned __int8 *v13; // r0
int v14; // r2
int v15; // r3
cocos2d::CCString *v16; // r0
char *CString; // r4
size_t v18; // r0
int v19; // r3
size_t v20; // r0
char *v21; // r3
int v22; // r4
char *v23; // r4
int v24; // t1
void *v25; // r0
int v26; // r4
char *v27; // r3
int v28; // r3
unsigned int v29; // r1
int v30; // r4
char *v31; // r11
cocos2d::CCTextureCache *v32; // r0
char *v33; // r1
cocos2d::CCTexture2D *v34; // r2
size_t v35; // r0
int v36; // r9
int *v37; // r10
_DWORD *v38; // r0
int v39; // r1
int v40; // r2
int *v41; // r2
int v42; // r3
int v43; // [sp+10h] [bp-2Ch]
char *v44; // [sp+14h] [bp-28h]
int *v45; // [sp+18h] [bp-24h] BYREF
int v46; // [sp+1Ch] [bp-20h] BYREF
int v47; // [sp+20h] [bp-1Ch]
char *v48; // [sp+24h] [bp-18h]
int v49; // [sp+28h] [bp-14h] BYREF
int v50; // [sp+2Ch] [bp-10h]
int v51; // [sp+30h] [bp-Ch]
v3 = *((_DWORD *)this + 15);
v49 = 0;
v50 = 0;
v51 = 0;
v5 = strlen(a2);
std::string::__init(&v49, a2, v5);
v6 = std::__tree::find(v3, (unsigned __int8 *)&v49);
v7 = *((_DWORD *)this + 15) + 4;
v8 = v6;
result = (CCContentManager *)std::string::~string((int)&v49);
if ( v8 == (int *)v7 )
{
v10 = (CCContentManager *)CCContentManager::sharedManager(result);
v46 = 0;
v47 = 0;
v48 = nullptr;
v11 = (cocos2d::CCDictionary *)CCContentManager::addDict(v10, a2, 0);
std::string::__init(&v46, &unk_B6B226, 0);
v49 = 0;
v50 = 0;
v51 = 0;
std::string::__init(&v49, "metadata", 8u);
v12 = cocos2d::CCDictionary::objectForKey((int)v11, (int)&v49);
v13 = (unsigned __int8 *)std::string::~string((int)&v49);
if ( v12 )
{
v49 = 0;
v50 = 0;
v51 = 0;
std::string::__init(&v49, "textureFileName", 0xFu);
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v12, (int)&v49, v14, v15);
CString = cocos2d::CCString::getCString(v16);
v18 = strlen(CString);
std::string::assign(&v46, CString, v18);
v13 = (unsigned __int8 *)std::string::~string((int)&v49);
}
if ( (v46 & 1) != 0 )
v19 = v47;
else
v19 = (int)(unsigned __int8)v46 >> 1;
if ( !v19 )
{
v20 = strlen(a2);
std::string::assign(&v46, a2, v20);
v43 = v46 & 1;
if ( v43 )
{
v21 = v48;
v22 = v47;
}
else
{
v22 = (int)(unsigned __int8)v46 >> 1;
v21 = (char *)&v46 + 1;
}
v23 = &v21[v22];
while ( v23 != v21 )
{
v24 = (unsigned __int8)*--v23;
v44 = v21;
v25 = memchr(".", v24, 1u);
v21 = v44;
if ( v25 )
{
v26 = v23 - v44;
goto LABEL_15;
}
}
v26 = -1;
LABEL_15:
if ( v43 )
{
v27 = v48;
v47 = v26;
}
else
{
LOBYTE(v46) = 2 * v26;
v27 = (char *)&v46 + 1;
}
v27[v26] = 0;
std::string::operator=((unsigned __int8 *)&v46, (unsigned __int8 *)&v46);
if ( (v46 & 1) != 0 )
{
v28 = v47;
v29 = (v46 & 0xFFFFFFFE) - 1;
}
else
{
v28 = (int)(unsigned __int8)v46 >> 1;
v29 = 10;
}
v30 = v28 + 4;
if ( v29 - v28 <= 3 )
{
std::string::__grow_by_and_replace((int)&v46, v29, v30 - v29, v28, v28, 0, 4u, ".png");
}
else
{
if ( (v46 & 1) != 0 )
v31 = v48;
else
v31 = (char *)&v46 + 1;
std::char_traits::copy(&v31[v28], ".png", 4u);
if ( (v46 & 1) != 0 )
v47 = v30;
else
LOBYTE(v46) = 2 * v30;
v31[v30] = 0;
}
v13 = std::string::operator=((unsigned __int8 *)&v46, (unsigned __int8 *)&v46);
}
v32 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)v13);
if ( (v46 & 1) != 0 )
v33 = v48;
else
v33 = (char *)&v46 + 1;
v34 = (cocos2d::CCTexture2D *)cocos2d::CCTextureCache::addImage(v32, v33, 0);
if ( v34 )
{
cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary(this, v11, v34);
v49 = 0;
v50 = 0;
v51 = 0;
v35 = strlen(a2);
v36 = *((_DWORD *)this + 15);
std::string::__init(&v49, a2, v35);
v37 = std::__tree::__find_equal(v36, &v45, (unsigned __int8 *)&v49);
if ( !*v37 )
{
v38 = (_DWORD *)operator new(0x1Cu);
v39 = v50;
v40 = v51;
v38[4] = v49;
v38[5] = v39;
v38[6] = v40;
v41 = v45;
v49 = 0;
v50 = 0;
v51 = 0;
*v38 = 0;
v38[1] = 0;
v38[2] = v41;
*v37 = (int)v38;
v42 = **(_DWORD **)v36;
if ( v42 )
*(_DWORD *)v36 = v42;
std::__tree_balance_after_insert *>(*(_DWORD **)(v36 + 4), (_DWORD *)*v37);
++*(_DWORD *)(v36 + 8);
}
std::string::~string((int)&v49);
}
return (CCContentManager *)std::string::~string((int)&v46);
}
return result;
}