//
// cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile from 0xd8c440 to 0xd8c8a4 (1124 bytes)
//
// 31 xrefs:
// > LoadingLayer::init @ 0x6ed270
// > LoadingLayer::loadAssets @ 0x6edb90
// > LoadingLayer::loadAssets @ 0x6edbbc
// > LoadingLayer::loadAssets @ 0x6edbe8
// > LoadingLayer::loadAssets @ 0x6edc14
// > LoadingLayer::loadAssets @ 0x6edc38
// > LoadingLayer::loadAssets @ 0x6edc64
// > LoadingLayer::loadAssets @ 0x6edc98
// > LoadingLayer::loadAssets @ 0x6edcbc
// > LoadingLayer::loadAssets @ 0x6edd08
// > LoadingLayer::loadAssets @ 0x6edd2c
// > LoadingLayer::loadAssets @ 0x6edd58
// > GameManager::loadDeathEffect @ 0x716758
// > GameManager::loadIcon @ 0x7296e4
// > GauntletSelectLayer::init @ 0xa76b20
// > GJShopLayer::init @ 0xa7f090
// > SecretLayer2::init @ 0xa902a4
// > SecretLayer3::init @ 0xa92528
// > SecretLayer4::init @ 0xa96e4c
// > WorldSelectLayer::init @ 0xaa7f08
// > LevelAreaLayer::init @ 0xb5ba54
// > LevelAreaInnerLayer::init @ 0xb5c848
// > SecretRewardsLayer::init @ 0xb9f084
// > GJPathsLayer::init @ 0xba5c1c
// > SecretLayer5::init @ 0xbc7f54
// > SecretLayer5::init @ 0xbc7f78
// > SecretLayer6::init @ 0xbc9040
// > SelectFontLayer2::loadPreviewSheet @ 0xd030b8
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0xd85b90
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0xd85be4
// > ??> @ 0x466c0
//
// This function is hookable on this platform (idp: arm, 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 13:08:16 +0000
//
__int64 __fastcall cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(cocos2d::CCSpriteFrameCache *this, char *a2)
{
size_t v4; // x0
size_t v5; // x19
__int64 v6; // x25
char *v7; // x3
__int64 *v8; // x21
CCContentManager *v9; // x0
__int64 v10; // x19
unsigned __int64 v12; // x0
CCContentManager *v13; // x0
cocos2d::CCDictionary *v14; // x25
__int64 v15; // x19
cocos2d::CCString *v16; // x0
size_t v17; // x0
unsigned __int64 v18; // x0
size_t v19; // x1
cocos2d::CCTextureCache *v20; // x0
char *v21; // x1
cocos2d::CCTexture2D *v22; // x2
size_t v23; // x0
__int64 v24; // x19
__int64 *v25; // x21
size_t v26; // x0
int v27; // w26
char *v28; // x0
char *v29; // x27
cocos2d::CCTextureCache **v30; // x19
int v31; // t1
__int64 v32; // x19
size_t v33; // x3
unsigned __int64 v34; // x1
char *v35; // x2
size_t v36; // x1
__int64 *v37; // x0
size_t v38; // x3
__int64 v39; // x1
__int64 v40; // x1
__int64 *v41; // x1
int v42[2]; // [xsp+68h] [xbp+68h]
__int64 v43; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCTextureCache *v44; // [xsp+78h] [xbp+78h] BYREF
size_t v45; // [xsp+80h] [xbp+80h]
char *v46; // [xsp+88h] [xbp+88h]
unsigned __int64 v47; // [xsp+90h] [xbp+90h] BYREF
size_t v48; // [xsp+98h] [xbp+98h]
void *v49; // [xsp+A0h] [xbp+A0h]
v47 = 0;
v48 = 0;
v49 = nullptr;
v4 = strlen(a2);
v5 = v4;
v6 = *((_QWORD *)this + 9);
if ( v4 > 0x16 )
{
v12 = (v4 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v47 = v12 | 1;
v7 = (char *)operator new(v12);
v49 = v7;
v48 = v5;
}
else
{
LOBYTE(v47) = 2 * v4;
v7 = (char *)&v47 + 1;
if ( !v4 )
goto LABEL_3;
}
v7 = (char *)memcpy(v7, a2, v5);
LABEL_3:
v7[v5] = 0;
v8 = std::__tree::find(v6, (__int64)&v47);
v9 = (CCContentManager *)(unsigned __int8)v47;
v10 = *((_QWORD *)this + 9) + 8LL;
if ( (v47 & 1) != 0 )
{
operator delete(v49);
if ( (__int64 *)v10 != v8 )
return _stack_chk_guard;
}
else if ( (__int64 *)v10 != v8 )
{
return _stack_chk_guard;
}
v13 = (CCContentManager *)CCContentManager::sharedManager(v9);
v14 = (cocos2d::CCDictionary *)CCContentManager::addDict(v13, a2, 0);
v44 = nullptr;
v45 = 0;
v46 = nullptr;
std::string::__init((__int64 *)&v44, &byte_11B8890, 0);
v47 = 0;
v48 = 0;
v49 = nullptr;
std::string::__init((__int64 *)&v47, "metadata", 8u);
v15 = cocos2d::CCDictionary::objectForKey((__int64)v14, (__int64)&v47);
if ( (v47 & 1) != 0 )
operator delete(v49);
if ( v15 )
{
v47 = 0;
v48 = 0;
v49 = nullptr;
std::string::__init((__int64 *)&v47, "textureFileName", 0xFu);
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v15, (__int64)&v47);
*(_QWORD *)v42 = cocos2d::CCString::getCString(v16);
v17 = strlen(*(const char **)v42);
std::string::assign((__int64 *)&v44, *(const void **)v42, v17);
if ( (v47 & 1) != 0 )
operator delete(v49);
}
v18 = (unsigned __int8)v44;
v19 = (unsigned __int8)v44 >> 1;
if ( ((unsigned __int8)v44 & 1) != 0 )
v19 = v45;
if ( !v19 )
{
v26 = strlen(a2);
std::string::assign((__int64 *)&v44, a2, v26);
v27 = (unsigned __int8)v44 & 1;
if ( v27 )
{
v28 = v46;
v29 = v46;
v30 = (cocos2d::CCTextureCache **)&v46[v45];
if ( v46 != &v46[v45] )
goto LABEL_29;
v32 = -1;
LABEL_33:
if ( v27 )
{
v45 = v32;
goto LABEL_35;
}
LABEL_46:
LOBYTE(v44) = 2 * v32;
LABEL_35:
v28[v32] = 0;
if ( ((unsigned __int8)v44 & 1) != 0 )
{
v33 = v45;
v34 = ((unsigned __int64)v44 & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v34 - v45 > 3 )
{
v35 = v46;
LABEL_38:
v36 = v33 + 4;
*(_DWORD *)&v35[v33] = *(_DWORD *)".png";
v18 = (unsigned __int8)v44;
if ( ((unsigned __int8)v44 & 1) != 0 )
{
v45 = v33 + 4;
}
else
{
v18 = (unsigned int)(2 * v36);
LOBYTE(v44) = 2 * v36;
}
v35[v36] = 0;
goto LABEL_17;
}
}
else
{
v33 = (unsigned __int8)v44 >> 1;
v34 = 22;
v35 = (char *)&v44 + 1;
if ( 22 - v33 > 3 )
goto LABEL_38;
}
std::string::__grow_by_and_replace((__int64)&v44, v34, v33 + 4 - v34, v33, v33, 0, 4u, ".png");
goto LABEL_17;
}
v29 = (char *)&v44 + 1;
v30 = (cocos2d::CCTextureCache **)((char *)&v44 + ((unsigned __int8)v44 >> 1) + 1);
if ( v30 == (cocos2d::CCTextureCache **)((char *)&v44 + 1) )
{
v32 = -1;
}
else
{
do
{
LABEL_29:
v31 = *((unsigned __int8 *)v30 - 1);
v30 = (cocos2d::CCTextureCache **)((char *)v30 - 1);
if ( memchr(&byte_116FB00, v31, 1u) )
{
v32 = (char *)v30 - v29;
goto LABEL_31;
}
}
while ( v30 != (cocos2d::CCTextureCache **)v29 );
v32 = -1;
LABEL_31:
if ( v27 )
{
v28 = v46;
goto LABEL_33;
}
}
v28 = (char *)&v44 + 1;
goto LABEL_46;
}
LABEL_17:
v20 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)v18);
v21 = (char *)&v44 + 1;
if ( ((unsigned __int8)v44 & 1) != 0 )
v21 = v46;
v22 = (cocos2d::CCTexture2D *)cocos2d::CCTextureCache::addImage(v20, v21, 0);
if ( v22 )
{
cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary(this, v14, v22);
v47 = 0;
v48 = 0;
v49 = nullptr;
v23 = strlen(a2);
v24 = *((_QWORD *)this + 9);
std::string::__init((__int64 *)&v47, a2, v23);
v25 = std::__tree::__find_equal(v24, &v43, (__int64)&v47);
if ( !*v25 )
{
v37 = (__int64 *)operator new(0x38u);
v38 = v48;
v37[4] = v47;
v37[5] = v38;
v39 = v43;
v37[6] = (__int64)v49;
v47 = 0;
v48 = 0;
v49 = nullptr;
*v37 = 0;
v37[1] = 0;
v37[2] = v39;
*v25 = (__int64)v37;
v40 = **(_QWORD **)v24;
if ( v40 )
{
*(_QWORD *)v24 = v40;
v41 = (__int64 *)*v25;
}
else
{
v41 = v37;
}
std::__tree_balance_after_insert *>(*(__int64 **)(v24 + 8), v41);
++*(_QWORD *)(v24 + 16);
}
if ( (v47 & 1) != 0 )
operator delete(v49);
}
if ( ((unsigned __int8)v44 & 1) != 0 )
operator delete(v46);
return _stack_chk_guard;
}