//
// cocos2d::CCAnimationCache::addAnimationsWithDictionary from 0xb143b4 to 0xb146f4 (832 bytes)
//
// 2 xrefs:
// > cocos2d::CCAnimationCache::addAnimationsWithFile @ 0xb1474c
// > ??> @ 0x488d0
//
// 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::CCAnimationCache::addAnimationsWithDictionary(
cocos2d::CCAnimationCache *a1,
cocos2d::CCDictionary *a2,
const char *a3)
{
cocos2d::CCDictionary *v6; // x24
char *v7; // x0
__int64 v8; // x27
char *v9; // x0
cocos2d::CCString *v10; // x0
int v11; // w23
char *v12; // x0
__int64 v13; // x19
char *v14; // x0
unsigned int *v15; // x1
cocos2d::CCString **v16; // x19
__int64 v17; // x0
char *v18; // x27
cocos2d::CCString *v19; // x26
cocos2d::CCFileUtils *v20; // x20
cocos2d::CCString *v21; // x0
unsigned __int8 *(__fastcall *getFileData)(cocos2d::CCFileUtils *__hidden, const unsigned __int8 *, const unsigned __int8 *, unsigned __int64 *); // x26
const char *CString; // x0
cocos2d::CCSpriteFrameCache *v24; // x0
cocos2d::CCSpriteFrameCache *v25; // x20
const char *v26; // x0
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
char *v35; // [xsp+68h] [xbp+68h]
const char *v36; // [xsp+80h] [xbp+80h] BYREF
sub_D153B8((int)&v36, "animations");
v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey((__int64)a2, &v36);
v7 = (char *)(v36 - 24);
if ( v36 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v36 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v7);
}
if ( v6 )
{
sub_D153B8((int)&v36, "properties");
v8 = cocos2d::CCDictionary::objectForKey((__int64)a2, &v36);
v9 = (char *)(v36 - 24);
if ( v36 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v36 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v9);
}
if ( !v8 )
goto LABEL_20;
sub_D153B8((int)&v36, "format");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v8, &v36);
v11 = cocos2d::CCString::intValue(v10);
v12 = (char *)(v36 - 24);
if ( v36 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v36 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v36, "spritesheets");
v13 = cocos2d::CCDictionary::objectForKey(v8, &v36);
v14 = (char *)(v36 - 24);
if ( v36 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_7;
if ( &pthread_create )
{
v31 = (unsigned int *)(v36 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v32 - 1;
}
if ( v32 > 0 )
{
LABEL_7:
if ( !v13 )
goto LABEL_10;
}
else
{
operator delete(v14);
if ( !v13 )
goto LABEL_10;
}
v15 = *(unsigned int **)(v13 + 56);
if ( *v15 )
{
v16 = *((cocos2d::CCString ***)v15 + 2);
v17 = 8LL * *v15 - 8;
v18 = (char *)v16 + v17;
if ( v16 <= (cocos2d::CCString **)((char *)v16 + v17) )
{
do
{
v19 = *v16;
if ( !*v16 )
break;
if ( a3 )
{
v20 = cocos2d::CCFileUtils::sharedFileUtils();
v21 = v19;
getFileData = v20->getFileData;
CString = cocos2d::CCString::getCString(v21);
v35 = (char *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, const char *, const char *))getFileData)(
v20,
CString,
a3);
v24 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v24, v35);
}
else
{
v25 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v26 = cocos2d::CCString::getCString(v19);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v25, v26);
}
++v16;
}
while ( v18 >= (char *)v16 );
}
}
LABEL_10:
if ( v11 != 1 )
{
if ( v11 == 2 )
cocos2d::CCAnimationCache::parseVersion2(a1, v6);
return;
}
LABEL_20:
cocos2d::CCAnimationCache::parseVersion1(a1, v6);
}
}