//
// cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile from 0x5e99f4 to 0x5e9bb8 (452 bytes)
//
// 24 xrefs:
// > LoadingLayer::loadAssets @ 0x30b758
// > LoadingLayer::loadAssets @ 0x30b77c
// > LoadingLayer::loadAssets @ 0x30b7ba
// > LoadingLayer::loadAssets @ 0x30b804
// > LoadingLayer::loadAssets @ 0x30b81e
// > LoadingLayer::loadAssets @ 0x30b854
// > LoadingLayer::loadAssets @ 0x30b88a
// > LoadingLayer::init @ 0x30c210
// > GameManager::loadDeathEffect @ 0x3226ca
// > GameManager::loadIcon @ 0x32967e
// > GauntletSelectLayer::init @ 0x4d9462
// > GJShopLayer::init @ 0x4e31d0
// > SecretLayer2::init @ 0x4ee652
// > SecretLayer3::init @ 0x4ef062
// > SecretLayer4::init @ 0x4f19fe
// > WorldSelectLayer::init @ 0x4fe25a
// > LevelAreaLayer::init @ 0x56c860
// > LevelAreaInnerLayer::init @ 0x56d118
// > SecretRewardsLayer::init @ 0x585ec0
// > GJPathsLayer::init @ 0x58cd96
// > SecretLayer5::init @ 0x59edce
// > SecretLayer5::init @ 0x59ede8
// > SecretLayer6::init @ 0x59f7d4
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0x5e5e82
//
// 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
//
void cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(cocos2d::CCSpriteFrameCache *a1, const char *a2)
{
int m_nLuaID; // r8
int v5; // r0
int v6; // r8
int v7; // r9
CCContentManager *v8; // r0
cocos2d::CCDictionary *v9; // r9
int v10; // r11
int v11; // r2
int v12; // r3
cocos2d::CCString *v13; // r0
char *CString; // r0
int v15; // r0
int v16; // r0
int v17; // r0
cocos2d::CCTextureCache *v18; // r0
cocos2d::CCTexture2D *v19; // r2
_DWORD *v20; // r9
_DWORD *v21; // r8
_DWORD *v22; // r6
int v23; // r3
_DWORD *v24; // r2
int v25; // r0
unsigned int v26; // r8
int v27; // r0
char *v28; // [sp+4h] [bp-10h] BYREF
const char *v29; // [sp+8h] [bp-Ch] BYREF
m_nLuaID = a1[1].m_nLuaID;
sub_776584((int)&v29, (char *)a2);
v5 = std::_Rb_tree,std::less,std::allocator>::find(
m_nLuaID,
(int)&v29);
v6 = a1[1].m_nLuaID + 4;
v7 = v5;
sub_774008(&v29);
if ( v7 == v6 )
{
v8 = CCContentManager::sharedManager();
v9 = CCContentManager::addDict(v8, a2, 0);
sub_776584((int)&v28, (char *)&unk_939830);
sub_776584((int)&v29, "metadata");
v10 = cocos2d::CCDictionary::objectForKey((int)v9, &v29);
sub_774008(&v29);
if ( v10 )
{
sub_776584((int)&v29, "textureFileName");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, &v29, v11, v12);
CString = (char *)cocos2d::CCString::getCString(v13);
sub_7753D4((int)&v28, CString);
sub_774008(&v29);
}
if ( !*((_DWORD *)v28 - 3) )
{
sub_7753D4((int)&v28, (char *)a2);
v15 = sub_774B44((int)&v28, ".");
v16 = sub_7751B8(&v28, v15, -1);
sub_775D40(&v28, v16);
v17 = sub_774544((int)&v28, ".png");
sub_775D40(&v28, v17);
}
v18 = cocos2d::CCTextureCache::sharedTextureCache();
v19 = cocos2d::CCTextureCache::addImage(v18, v28, 0);
if ( !v19 )
goto LABEL_22;
cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary(a1, v9, v19);
v20 = (_DWORD *)a1[1].m_nLuaID;
sub_776584((int)&v29, (char *)a2);
v21 = (_DWORD *)v20[2];
v22 = v20 + 1;
v23 = 1;
while ( v21 )
{
v22 = v21;
if ( sub_774DBC(&v29, v21 + 4) >= 0 )
{
v24 = (_DWORD *)v21[3];
v23 = 0;
}
else
{
v24 = (_DWORD *)v21[2];
v23 = 1;
}
v21 = v24;
}
if ( v23 )
{
if ( v22 == (_DWORD *)v20[3] )
goto LABEL_18;
v25 = sub_762018(v22);
}
else
{
v25 = (int)v22;
}
if ( sub_774DBC(v25 + 16, &v29) >= 0 )
{
LABEL_21:
sub_774008(&v29);
LABEL_22:
sub_774008(&v28);
return;
}
LABEL_18:
if ( v22 == v20 + 1 )
v26 = 1;
else
v26 = (unsigned int)sub_774DBC(&v29, v22 + 4) >> 31;
v27 = operator new(0x14u);
*(_DWORD *)(v27 + 16) = v29;
v29 = (const char *)&unk_ACDDA8;
sub_7620E8(v26, v27, v22, v20 + 1);
++v20[5];
goto LABEL_21;
}
}