//
// CCAnimateFrameCache::addSpriteFramesWithFile from 0x572a1c to 0x572c10 (500 bytes)
//
// 3 xrefs:
// > CCPartAnimSprite::initWithAnimDesc @ 0x5782a4
// > LoadingLayer::loadAssets @ 0x5c4b18
// > ??> @ 0xa85e8
//
// 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
//
cocos2d::CCDictionary *CCAnimateFrameCache::addSpriteFramesWithFile(CCAnimateFrameCache *a1, const char *a2)
{
cocos2d::CCDictionary *m_animateDescriptions; // x21
__int64 v5; // x25
char *v6; // x0
cocos2d::CCDictionary *v7; // x22
cocos2d::CCDictionary *v8; // x22
char *v9; // x0
unsigned int *v11; // x1
int v12; // w2
DS_Dictionary *v13; // x20
unsigned int *v14; // x20
int v15; // w1
std::string v16; // [xsp+60h] [xbp+60h] BYREF
m_animateDescriptions = a1->m_animateDescriptions;
sub_D153B8((int)&v16, (char *)a2);
v5 = cocos2d::CCDictionary::objectForKey(m_animateDescriptions, &v16);
v6 = (char *)v16.m_data.m_data - 24;
if ( (__int64 *)v16.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v11 = (unsigned int *)((char *)v16.m_data.m_data - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v16.m_data.m_data - 2);
*((_DWORD *)v16.m_data.m_data - 2) = v12 - 1;
}
if ( v12 > 0 )
{
LABEL_2:
if ( !v5 )
{
LABEL_10:
v13 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v13);
DS_Dictionary::loadRootSubDictFromFile(v13, a2);
return CCAnimateFrameCache::addDict(a1, v13, (char *)a2);
}
}
else
{
operator delete(v6);
if ( !v5 )
goto LABEL_10;
}
v7 = a1->m_animateDescriptions;
sub_D153B8((int)&v16, (char *)a2);
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v7, &v16);
v9 = (char *)v16.m_data.m_data - 24;
if ( (__int64 *)v16.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)((char *)v16.m_data.m_data - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v16.m_data.m_data - 2);
*((_DWORD *)v16.m_data.m_data - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v9);
}
return v8;
}