//
// CCAnimateFrameCache::addDict from 0x10056bc80 to 0x10056c08d (1037 bytes)
//
// 2 xrefs:
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x10056b922
// > CCAnimateFrameCache::addSpriteFramesWithFile @ 0x10056c1d5
//
// 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 *__fastcall CCAnimateFrameCache::addDict(
CCAnimateFrameCache *a1,
cocos2d::CCDictionary *a2,
const char *a3)
{
double v3; // xmm0_8
cocos2d::CCDictionary *m_animateDescriptions; // rbx
size_t v6; // rax
size_t v7; // r15
_BYTE *v8; // r12
size_t v9; // r13
cocos2d::CCArray *v10; // r12
unsigned int v11; // r13d
cocos2d::CCString *v12; // rax
size_t v13; // rax
size_t v14; // rbx
_BYTE *v15; // r14
size_t v16; // r15
cocos2d::CCDictionary *v17; // rdi
__int64 m_animateFrames; // rbx
size_t v19; // rax
size_t v20; // r13
_BYTE *v21; // r14
size_t v22; // r12
unsigned int i; // r14d
cocos2d::CCString *v24; // rax
const char *CString; // r13
size_t v26; // rax
size_t v27; // rbx
_BYTE *v28; // r12
size_t v29; // r15
cocos2d::CCDictionary *v30; // r13
char *v31; // rbx
CCAnimateFrameCache *v33; // [rsp+0h] [rbp-80h]
cocos2d::CCArray *v34; // [rsp+8h] [rbp-78h]
cocos2d::CCObject *v35; // [rsp+10h] [rbp-70h]
cocos2d::CCDictionary *v36; // [rsp+18h] [rbp-68h]
unsigned int v37; // [rsp+2Ch] [rbp-54h]
cocos2d::CCDictionary *v38; // [rsp+30h] [rbp-50h]
const char *__src; // [rsp+38h] [rbp-48h]
_BYTE __dst[48]; // [rsp+40h] [rbp-40h] BYREF
v33 = a1;
m_animateDescriptions = a1->m_animateDescriptions;
v6 = strlen(a3);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_51:
sub_100006BF0(v3);
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = operator new(v9);
*(_QWORD *)&__dst[16] = v8;
*(_QWORD *)__dst = v9 + 1;
*(_QWORD *)&__dst[8] = v7;
goto LABEL_8;
}
__dst[0] = 2 * v6;
v8 = &__dst[1];
if ( v6 )
LABEL_8:
memcpy(v8, a3, v7);
v8[v7] = 0;
cocos2d::CCDictionary::setObject_1((__int64)m_animateDescriptions, a2, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
strcpy(__dst, "$animationContainer");
v3 = *(double *)"animationContainer";
v36 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)a2, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v10 = cocos2d::CCDictionary::allKeys(v36);
if ( (unsigned int)sub_100720070(v10) )
{
v11 = 0;
v34 = v10;
while ( 1 )
{
v12 = (cocos2d::CCString *)sub_1007200C0(v10, v11);
__src = cocos2d::CCString::getCString(v12);
v13 = strlen(__src);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v14 = v13;
if ( v13 >= 0x17 )
break;
__dst[0] = 2 * v13;
v15 = &__dst[1];
if ( v13 )
goto LABEL_23;
LABEL_24:
v15[v14] = 0;
v17 = v36;
v38 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)v36, __dst);
v37 = v11;
if ( (__dst[0] & 1) != 0 )
{
v17 = *(cocos2d::CCDictionary **)&__dst[16];
operator delete(*(void **)&__dst[16]);
}
v35 = (cocos2d::CCObject *)sub_10071F9E0(v17, __dst);
m_animateFrames = (__int64)v33->m_animateFrames;
v19 = strlen(__src);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v20 = v19;
if ( v19 >= 0x17 )
{
v22 = (v19 | 7) + 1;
if ( (v19 | 7) == 0x17 )
v22 = 26;
v21 = operator new(v22);
*(_QWORD *)&__dst[16] = v21;
*(_QWORD *)__dst = v22 + 1;
*(_QWORD *)&__dst[8] = v20;
LABEL_33:
memmove(v21, __src, v20);
goto LABEL_34;
}
__dst[0] = 2 * v19;
v21 = &__dst[1];
if ( v19 )
goto LABEL_33;
LABEL_34:
v21[v20] = 0;
cocos2d::CCDictionary::setObject_1(m_animateFrames, v35, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
if ( cocos2d::CCDictionary::count(v38) )
{
for ( i = 0; i < cocos2d::CCDictionary::count(v38); ++i )
{
v24 = (cocos2d::CCString *)sub_1007AB580("sprite_%i", (char)v33);
CString = cocos2d::CCString::getCString(v24);
v26 = strlen(CString);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v27 = v26;
if ( v26 >= 0x17 )
{
v29 = (v26 | 7) + 1;
if ( (v26 | 7) == 0x17 )
v29 = 26;
v28 = operator new(v29);
*(_QWORD *)&__dst[16] = v28;
*(_QWORD *)__dst = v29 + 1;
*(_QWORD *)&__dst[8] = v27;
}
else
{
__dst[0] = 2 * v26;
v28 = &__dst[1];
if ( !v26 )
goto LABEL_46;
}
memmove(v28, CString, v27);
LABEL_46:
v28[v27] = 0;
v30 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)v38, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v31 = (char *)operator new(0x68u);
cocos2d::CCObject::CCObject((__int64)v31);
*(_QWORD *)v31 = off_100964100;
sub_10028CC30((_QWORD *)v31 + 7);
sub_10028CC30((_QWORD *)v31 + 8);
sub_10028CC30((_QWORD *)v31 + 9);
*((_QWORD *)v31 + 12) = 0;
*((_QWORD *)v31 + 10) = 0;
*(_QWORD *)(v31 + 85) = 0;
SpriteDescription::initDescription((SpriteDescription *)v31, v30);
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v31);
sub_10071FCD0(v35, v31);
}
}
v11 = v37 + 1;
v10 = v34;
if ( v37 + 1 >= (unsigned int)sub_100720070(v34) )
return a2;
}
v16 = (v13 | 7) + 1;
if ( (v13 | 7) == 0x17 )
v16 = 26;
v15 = operator new(v16);
*(_QWORD *)&__dst[16] = v15;
*(_QWORD *)__dst = v16 + 1;
*(_QWORD *)&__dst[8] = v14;
LABEL_23:
memmove(v15, __src, v14);
goto LABEL_24;
}
return a2;
}