//
// cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile from 0xb1baf4 to 0xb1bed4 (992 bytes)
//
// 30 xrefs:
// > LoadingLayer::loadAssets @ 0x5c46a4
// > LoadingLayer::loadAssets @ 0x5c46d0
// > LoadingLayer::loadAssets @ 0x5c46fc
// > LoadingLayer::loadAssets @ 0x5c4728
// > LoadingLayer::loadAssets @ 0x5c474c
// > LoadingLayer::loadAssets @ 0x5c4778
// > LoadingLayer::loadAssets @ 0x5c47ac
// > LoadingLayer::loadAssets @ 0x5c47d0
// > LoadingLayer::loadAssets @ 0x5c481c
// > LoadingLayer::loadAssets @ 0x5c4840
// > LoadingLayer::loadAssets @ 0x5c486c
// > LoadingLayer::init @ 0x5c52dc
// > GameManager::loadDeathEffect @ 0x5ebd58
// > GameManager::loadIcon @ 0x5fd784
// > GauntletSelectLayer::init @ 0x91c540
// > GJShopLayer::init @ 0x92df54
// > SecretLayer2::init @ 0x9422b4
// > SecretLayer3::init @ 0x944d0c
// > SecretLayer4::init @ 0x94a824
// > WorldSelectLayer::init @ 0x961130
// > LevelAreaLayer::init @ 0xa2f734
// > LevelAreaInnerLayer::init @ 0xa305f8
// > SecretRewardsLayer::init @ 0xa623f4
// > GJPathsLayer::init @ 0xa6ef64
// > SecretLayer5::init @ 0xa95b30
// > SecretLayer5::init @ 0xa95b54
// > SecretLayer6::init @ 0xa96ec0
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0xb14598
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0xb145c4
// > ??> @ 0x2ef98
//
// 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)
{
__int64 v3; // x20
_QWORD *v5; // x26
char *v6; // x0
__int64 v7; // x20
CCContentManager *v8; // x0
cocos2d::CCDictionary *v9; // x27
__int64 v10; // x28
char *v11; // x0
cocos2d::CCString *v12; // x0
size_t v13; // x0
char *v14; // x0
cocos2d::CCTextureCache *v15; // x0
cocos2d::CCTexture2D *v16; // x2
_QWORD *v17; // x20
char *v18; // x0
char *v19; // x0
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
size_t v26; // x0
unsigned __int64 v27; // x0
unsigned __int64 v28; // x3
__int64 v29; // x0
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
_QWORD v34[2]; // [xsp+0h] [xbp+0h] BYREF
const char *CString; // [xsp+68h] [xbp+68h]
char *v36; // [xsp+88h] [xbp+88h] BYREF
_DWORD *v37; // [xsp+90h] [xbp+90h] BYREF
v3 = *(_QWORD *)&a1[1].m_nTag;
sub_D153B8((int)&v37, (char *)a2);
v5 = std::_Rb_tree,std::less,std::allocator>::find(
v3,
(const void **)&v37);
v6 = (char *)(v37 - 6);
v7 = *(_QWORD *)&a1[1].m_nTag + 8LL;
if ( v37 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = v37 - 2;
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(v37 - 2);
*(v37 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v6);
}
if ( (_QWORD *)v7 == v5 )
{
v8 = CCContentManager::sharedManager();
v9 = CCContentManager::addDict(v8, a2, 0);
sub_D153B8((unsigned int)v34 + 136, &byte_F288A0);
sub_D153B8((int)&v37, "metadata");
v10 = cocos2d::CCDictionary::objectForKey((__int64)v9, (const char **)&v37);
v11 = (char *)(v37 - 6);
if ( v37 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = v37 - 2;
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(v37 - 2);
*(v37 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v11);
}
if ( v10 )
{
sub_D153B8((int)&v37, "textureFileName");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, (const char **)&v37);
CString = cocos2d::CCString::getCString(v12);
v13 = strlen(CString);
sub_D1798C(&v36, CString, v13);
v14 = (char *)(v37 - 6);
if ( v37 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = v37 - 2;
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(v37 - 2);
*(v37 - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v14);
}
}
if ( !*((_QWORD *)v36 - 3) )
{
v26 = strlen(a2);
sub_D1798C(&v36, a2, v26);
v27 = sub_D16A88((unsigned int)v34 + 136, &byte_EEFB80, -1, 1u);
v28 = *((_QWORD *)v36 - 3);
if ( v27 > v28 )
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::erase", v27, v28);
sub_D174B8(&v36, v27, v28 - v27, 0);
sub_D18EA8(&v36, &v36);
v29 = sub_D15FD4(&v36, ".png", 4);
sub_D18EA8(&v36, v29);
}
v15 = cocos2d::CCTextureCache::sharedTextureCache();
v16 = cocos2d::CCTextureCache::addImage(v15, v36, 0);
if ( v16 )
{
cocos2d::CCSpriteFrameCache::addSpriteFramesWithDictionary(a1, v9, v16);
v17 = *(_QWORD **)&a1[1].m_nTag;
sub_D153B8((int)&v37, (char *)a2);
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
v17,
(const void **)&v37);
v18 = (char *)(v37 - 6);
if ( v37 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = v37 - 2;
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(v37 - 2);
*(v37 - 2) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v18);
}
}
v19 = v36 - 24;
if ( v36 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v36 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v19);
}
}
}