//
// cocos2d::CCAnimationCache::parseVersion2 from 0xb13e30 to 0xb143b4 (1412 bytes)
//
// 2 xrefs:
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0xb14524
// > ??> @ 0x36240
//
// 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::parseVersion2(cocos2d::CCAnimationCache *a1, cocos2d::CCDictionary *a2)
{
__int64 v2; // x0
__int64 v3; // x28
__int64 v4; // x25
char *v5; // x0
cocos2d::CCString *v6; // x0
char *v7; // x0
cocos2d::CCArray *v8; // x22
char *v9; // x0
cocos2d::CCArray *v10; // x0
cocos2d::CCArray *v11; // x26
cocos2d::ccArray *data; // x1
__int64 *arr; // x22
__int64 v14; // x0
char *v15; // x27
__int64 v16; // x23
cocos2d::CCString *v17; // x0
const char *CString; // x24
char *v19; // x0
cocos2d::CCSpriteFrame *v20; // x24
cocos2d::CCString *v21; // x0
__int128 v22; // q0
char *v23; // x0
cocos2d::CCObject *v24; // x2
char *v25; // x0
__int128 v26; // q0
cocos2d::CCAnimationFrame *v27; // x23
cocos2d::CCObject *v28; // x2
cocos2d::CCString *v29; // x0
__int128 v30; // q0
char *v31; // x0
cocos2d::CCAnimation *v32; // x22
unsigned int v33; // w0
unsigned int v34; // w2
float v35; // s0
cocos2d::CCAnimationCache *v36; // x0
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w3
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
char *v51[13]; // [xsp+0h] [xbp+0h] BYREF
char *v52; // [xsp+68h] [xbp+68h]
_BYTE v53[9]; // [xsp+77h] [xbp+77h]
char *v54; // [xsp+80h] [xbp+80h]
char *v55; // [xsp+88h] [xbp+88h]
char *v56; // [xsp+90h] [xbp+90h]
char *v57; // [xsp+98h] [xbp+98h]
cocos2d::CCSpriteFrameCache *v58; // [xsp+A0h] [xbp+A0h]
cocos2d::CCObject *v59; // [xsp+A8h] [xbp+A8h]
__int128 v60; // [xsp+B0h] [xbp+B0h]
char v61; // [xsp+C8h] [xbp+C8h] BYREF
const char *v62; // [xsp+D0h] [xbp+D0h] BYREF
*(_QWORD *)&v60 = a2;
v58 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( (_QWORD)v60 )
{
v2 = *(_QWORD *)(v60 + 56);
v56 = (char *)v2;
if ( v2 )
{
v3 = *(_QWORD *)(v2 + 288);
v52 = "loops";
v51[12] = &v61;
v57 = "spriteframe";
v54 = "delayUnits";
while ( 1 )
{
v4 = *((_QWORD *)v56 + 33);
sub_D153B8((int)&v62, v52);
*(_QWORD *)&v53[1] = cocos2d::CCDictionary::valueForKey(v4, &v62);
v5 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(v62 - 8);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v5);
}
sub_D153B8((unsigned int)v51 + 208, "restoreOriginalFrame");
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, &v62);
v53[0] = cocos2d::CCString::boolValue(v6);
v7 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v62 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v7);
}
sub_D153B8((unsigned int)v51 + 208, "frames");
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v4, &v62);
v9 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v62 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v9);
}
if ( v8 )
{
v10 = (cocos2d::CCArray *)cocos2d::CCArray::count(v8);
v11 = cocos2d::CCArray::createWithCapacity(v10);
cocos2d::CCObject::retain(v11);
data = v8->data;
if ( data->num )
{
arr = (__int64 *)data->arr;
v14 = 8LL * data->num - 8;
v15 = (char *)arr + v14;
if ( arr <= (__int64 *)((char *)arr + v14) )
{
v16 = *arr;
if ( *arr )
{
v55 = "notification";
do
{
sub_D153B8((int)&v62, v57);
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v16, &v62);
CString = cocos2d::CCString::getCString(v17);
v19 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v62 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v19);
}
v20 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v58, CString);
if ( v20 )
{
sub_D153B8((int)&v62, v54);
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v16, &v62);
*(float *)&v22 = cocos2d::CCString::floatValue(v21);
v23 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v62 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v44 - 1;
}
if ( v44 <= 0 )
{
v60 = v22;
operator delete(v23);
v22 = v60;
}
}
v60 = v22;
sub_D153B8((int)&v62, v55);
v24 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v16, &v62);
v25 = (char *)(v62 - 24);
v26 = v60;
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v62 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v42 - 1;
}
if ( v42 <= 0 )
{
v59 = v24;
v60 = v26;
operator delete(v25);
v24 = v59;
v26 = v60;
}
}
v59 = v24;
v60 = v26;
v27 = (cocos2d::CCAnimationFrame *)operator new(0x50u);
cocos2d::CCAnimationFrame::CCAnimationFrame(v27);
cocos2d::CCAnimationFrame::initWithSpriteFrame(
v27,
v20,
*(float *)&v60,
(cocos2d::CCDictionary *)v59);
cocos2d::CCArray::addObject(v11, (cocos2d::_ccArray *)v27, v28);
cocos2d::CCObject::release(v27);
}
if ( v15 < (char *)++arr )
break;
v16 = *arr;
}
while ( *arr );
}
}
}
sub_D153B8((unsigned int)v51 + 208, "delayPerUnit");
v29 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, &v62);
*(float *)&v30 = cocos2d::CCString::floatValue(v29);
v31 = (char *)(v62 - 24);
if ( v62 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v62 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v50 - 1;
}
if ( v50 <= 0 )
{
v60 = v30;
operator delete(v31);
v30 = v60;
}
}
v60 = v30;
v32 = (cocos2d::CCAnimation *)operator new(0x58u);
cocos2d::CCAnimation::CCAnimation(v32);
v33 = cocos2d::CCString::length(*(cocos2d::CCString **)&v53[1]);
v34 = 1;
v35 = *(float *)&v60;
if ( v33 )
{
v34 = cocos2d::CCString::intValue(*(cocos2d::CCString **)&v53[1]);
v35 = *(float *)&v60;
}
cocos2d::CCAnimation::initWithAnimationFrames(v32, v11, v35, v34);
cocos2d::CCObject::release(v11);
v32->m_bRestoreOriginalFrame = v53[0];
v36 = cocos2d::CCAnimationCache::sharedAnimationCache();
cocos2d::CCAnimationCache::addAnimation(v36, v32, v56);
cocos2d::CCObject::release(v32);
}
if ( !v3 )
break;
v56 = (char *)v3;
v3 = *(_QWORD *)(v3 + 288);
}
}
}
}