//
// CCAnimateFrameCache::addDict from 0x1400416e0 to 0x140041ca6 (1478 bytes)
//
// 2 xrefs:
// > CCAnimateFrameCache::addSpriteFramesWithFile @ 0x1400416b8
// > ??> @ 0x1406c4314
//
// 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=8
cocos2d::CCDictionary *CCAnimateFrameCache::addDict(CCAnimateFrameCache *a1, DS_Dictionary *a2, const char *a3)
{
CCAnimateFrameCache *v5; // rdi
__int64 v6; // r14
size_t v7; // r8
void *v8; // rcx
unsigned int NumKeys; // r13d
unsigned int v10; // ebx
unsigned int v11; // r12d
const char *v12; // rdx
__int64 v13; // rcx
cocos2d::CCArray *v14; // r15
unsigned int v15; // r14d
unsigned int i; // edi
cocos2d::CCString *v17; // rax
const char *CString; // rax
size_t v19; // r8
void **v20; // rdx
SpriteDescription *v21; // rbx
void *v22; // rcx
__int64 v23; // r15
void *v24; // rcx
unsigned int v25; // r14d
__int64 v26; // rdi
const char *v27; // rdx
__int64 StringForKey; // rax
__int64 v29; // rax
__int64 v30; // rax
__int64 v31; // rax
void *v32; // rcx
__int64 v33; // rax
void *v34; // rcx
cocos2d::CCDictionary *v36; // [rsp+20h] [rbp-79h]
void *Block[2]; // [rsp+38h] [rbp-61h] BYREF
__int64 v39; // [rsp+48h] [rbp-51h]
unsigned __int64 v40; // [rsp+50h] [rbp-49h]
_QWORD v41[3]; // [rsp+58h] [rbp-41h] BYREF
unsigned __int64 v42; // [rsp+70h] [rbp-29h]
_BYTE v43[16]; // [rsp+78h] [rbp-21h] BYREF
__int64 v44; // [rsp+88h] [rbp-11h]
_BYTE v45[32]; // [rsp+98h] [rbp-1h] BYREF
v5 = a1;
v6 = cocos2d::CCDictionary::create();
v36 = (cocos2d::CCDictionary *)v6;
*(_OWORD *)Block = 0;
v39 = 0;
v40 = 0;
v7 = -1;
do
++v7;
while ( a3[v7] );
sub_14003A930(Block, a3, v7);
cocos2d::CCDictionary::setObject(v5->m_animateDescriptions, v6, Block);
if ( v40 > 0xF )
{
v8 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
DS_Dictionary::stepIntoSubDictWithKey(a2, "animationContainer");
NumKeys = DS_Dictionary::getNumKeys(a2);
v10 = 0;
v11 = 0;
if ( NumKeys )
{
while ( 1 )
{
DS_Dictionary::getKey(a2, v41, v11);
v12 = (const char *)v41;
if ( v42 > 0xF )
v12 = (const char *)v41[0];
DS_Dictionary::stepIntoSubDictWithKey(a2, v12);
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(v13);
cocos2d::CCDictionary::setObject(v5->m_animateFrames, v14, v41);
v15 = DS_Dictionary::getNumKeys(a2);
for ( i = 0; i < v15; v10 = 0 )
{
v17 = cocos2d::CCString::createWithFormat("sprite_%i", i);
CString = cocos2d::CCString::getCString(v17);
*(_OWORD *)Block = 0;
v39 = 0;
v40 = 0;
v19 = -1;
do
++v19;
while ( CString[v19] );
sub_14003A930(Block, CString, v19);
v20 = Block;
if ( v40 > 0xF )
v20 = (void **)Block[0];
DS_Dictionary::stepIntoSubDictWithKey(a2, (const char *)v20);
v21 = (SpriteDescription *)operator new(0x68u);
cocos2d::CCObject::CCObject(v21);
v21->__vftable = (SpriteDescription_vtbl *)&SpriteDescription::`vftable';
cocos2d::CCPoint::CCPoint(&v21->m_position);
cocos2d::CCPoint::CCPoint(&v21->m_scale);
cocos2d::CCPoint::CCPoint(&v21->m_flipped);
*(_QWORD *)&v21->m_rotation = 0;
v21->m_tag = 0;
v21->m_usesCustomTag = 0;
v21->m_texture = nullptr;
if ( SpriteDescription::initDescription(v21, a2) )
{
cocos2d::CCObject::autorelease(v21);
}
else
{
((void (__fastcall *)(SpriteDescription *, __int64))v21->~SpriteDescription)(v21, 1);
v21 = nullptr;
}
cocos2d::CCArray::addObject(v14, v21);
DS_Dictionary::stepOutOfSubDict(a2);
if ( v40 > 0xF )
{
v22 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v22 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v22 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v22);
}
++i;
}
DS_Dictionary::stepOutOfSubDict(a2);
sub_14003A830((__int64)v41);
if ( ++v11 >= NumKeys )
break;
v5 = a1;
}
v6 = (__int64)v36;
}
DS_Dictionary::stepBackToRootSubDict(a2);
if ( DS_Dictionary::stepIntoSubDictWithKey(a2, "usedTextures") )
{
v23 = cocos2d::CCDictionary::create();
v39 = 12;
v40 = 15;
Block[0] = *(void **)"usedTextures";
Block[1] = (void *)*(unsigned int *)"ures";
cocos2d::CCDictionary::setObject(v6, v23, Block);
if ( v40 > 0xF )
{
v24 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
v25 = DS_Dictionary::getNumKeys(a2);
if ( v25 )
{
do
{
DS_Dictionary::getKey(a2, v41, v10);
v26 = cocos2d::CCDictionary::create();
cocos2d::CCDictionary::setObject(v23, v26, v41);
v27 = (const char *)v41;
if ( v42 > 0xF )
v27 = (const char *)v41[0];
DS_Dictionary::stepIntoSubDictWithKey(a2, v27);
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x65727574786574LL;
StringForKey = DS_Dictionary::getStringForKey(a2, v45, &qword_14052CA08);
v29 = cocos2d::CCString::create(StringForKey);
cocos2d::CCDictionary::setObject(v26, v29, Block);
sub_14003A830((__int64)v45);
sub_14003A830((__int64)Block);
*(_OWORD *)Block = 0;
v39 = 3;
v40 = 15;
LODWORD(Block[0]) = 6775156;
v30 = DS_Dictionary::getStringForKey(a2, v45, &dword_14052CA10);
v31 = cocos2d::CCString::create(v30);
cocos2d::CCDictionary::setObject(v26, v31, Block);
sub_14003A830((__int64)v45);
if ( v40 > 0xF )
{
v32 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v32 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v32 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v32);
}
DS_Dictionary::getStringForKey(a2, v43, "customID");
if ( v44 )
{
Block[1] = nullptr;
v39 = 8;
v40 = 15;
Block[0] = *(void **)"customID";
v33 = cocos2d::CCString::create(v43);
cocos2d::CCDictionary::setObject(v26, v33, Block);
if ( v40 > 0xF )
{
v34 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v34 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v34 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v34);
}
}
DS_Dictionary::stepOutOfSubDict(a2);
sub_14003A830((__int64)v43);
sub_14003A830((__int64)v41);
++v10;
}
while ( v10 < v25 );
}
}
return v36;
}