//
// cocos2d::CCAnimationCache::parseVersion1 from 0x18008a7b0 to 0x18008aaaa (762 bytes)
//
// 3 xrefs:
// > cocos2d::CCAnimationCache::addAnimationsWithDictionary @ 0x18008a67b
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5a90
//
// 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
//
// Hidden C++ exception states: #wind=3
void __fastcall cocos2d::CCAnimationCache::parseVersion1(
cocos2d::CCAnimationCache *this,
struct cocos2d::CCDictionary *a2)
{
cocos2d::CCSpriteFrameCache *v3; // rdi
cocos2d::CCDictElement *m_pElements; // r12
cocos2d::CCDictElement *i; // r15
__int64 m_pObject; // rbx
cocos2d::CCArray *v7; // r13
void *v8; // rcx
cocos2d::CCString *v9; // rax
float v10; // xmm7_4
void *v11; // rcx
unsigned int v12; // eax
cocos2d::CCArray *v13; // r14
cocos2d::ccArray *data; // rbx
__int64 num; // rcx
cocos2d::CCString **arr; // rbx
cocos2d::CCString **j; // rbp
std::string *CString; // rax
struct cocos2d::CCSpriteFrame *v19; // rsi
cocos2d::CCAnimationFrame *v20; // rax
cocos2d::CCAnimationFrame *v21; // rdi
struct cocos2d::CCSpriteFrame *v22; // rbx
cocos2d::CCSpriteFrameCache *v23; // rax
cocos2d::CCSpriteFrameCache *v24; // [rsp+20h] [rbp-A8h]
__int128 v25; // [rsp+30h] [rbp-98h] BYREF
__int64 v26; // [rsp+40h] [rbp-88h]
unsigned __int64 v27; // [rsp+48h] [rbp-80h]
__int128 v28; // [rsp+50h] [rbp-78h] BYREF
__int64 v29; // [rsp+60h] [rbp-68h]
unsigned __int64 v30; // [rsp+68h] [rbp-60h]
v3 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v24 = v3;
if ( a2 )
{
m_pElements = a2->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
m_pObject = (__int64)m_pElements->m_pObject;
v25 = 0;
v26 = 6;
v27 = 15;
strcpy((char *)&v25, "frames");
v7 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(m_pObject, (unsigned __int8 *)&v25);
if ( v27 > 0xF )
{
v8 = (void *)v25;
if ( v27 + 1 >= 0x1000 )
{
v8 = *(void **)(v25 - 8);
if ( (unsigned __int64)(v25 - (_QWORD)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v8);
}
v26 = 0;
v27 = 15;
LOBYTE(v25) = 0;
v28 = 0;
v29 = 5;
v30 = 15;
strcpy((char *)&v28, "delay");
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_pObject, (unsigned __int8 *)&v28);
v10 = cocos2d::CCString::floatValue(v9);
if ( v30 > 0xF )
{
v11 = (void *)v28;
if ( v30 + 1 >= 0x1000 )
{
v11 = *(void **)(v28 - 8);
if ( (unsigned __int64)(v28 - (_QWORD)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v11);
}
if ( v7 )
{
v12 = cocos2d::CCArray::count(v7);
v13 = cocos2d::CCArray::createWithCapacity(v12);
cocos2d::CCObject::retain(v13);
data = v7->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCString **)data->arr;
for ( j = &arr[num - 1]; arr <= j; ++arr )
{
if ( !*arr )
break;
CString = cocos2d::CCString::getCString(*arr);
v19 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v3, CString->m_data.m_smallStorage._Elems);
if ( v19 )
{
v20 = (cocos2d::CCAnimationFrame *)operator new(0x50u);
if ( v20 )
v21 = cocos2d::CCAnimationFrame::CCAnimationFrame(v20);
else
v21 = nullptr;
cocos2d::CCAnimationFrame::initWithSpriteFrame(v21, v19, 1.0, nullptr);
cocos2d::CCArray::addObject(v13, v21);
cocos2d::CCObject::release(v21);
v3 = v24;
}
}
}
if ( (unsigned int)cocos2d::CCArray::count(v13) )
{
cocos2d::CCArray::count(v13);
cocos2d::CCArray::count(v7);
v22 = (struct cocos2d::CCSpriteFrame *)cocos2d::CCAnimation::create(v13, v10, 1u);
v23 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCAnimationCache::sharedAnimationCache();
cocos2d::CCSpriteFrameCache::addSpriteFrame(v23, v22, m_pElements->m_szKey);
cocos2d::CCObject::release(v13);
}
}
m_pElements = i;
if ( !i )
break;
}
}
}
}