//
// CCAnimateFrameCache::addDict from 0x100598d40 to 0x10059914d (1037 bytes)
//
// 2 xrefs:
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x1005989e2
// > CCAnimateFrameCache::addSpriteFramesWithFile @ 0x100599295
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:32:30 +0000
//
__int64 __fastcall CCAnimateFrameCache::addDict(__int64 a1, __int64 a2, const char *a3)
{
__int64 v4; // rbx
size_t v5; // rax
size_t v6; // r15
_BYTE *v7; // r12
size_t v8; // r13
__int64 v9; // r12
unsigned int v10; // r13d
__int64 v11; // rax
size_t v12; // rax
size_t v13; // rbx
_BYTE *v14; // r14
size_t v15; // r15
__int64 v16; // rdi
__int64 v17; // rbx
size_t v18; // rax
size_t v19; // r13
_BYTE *v20; // r14
size_t v21; // r12
unsigned int i; // r14d
__int64 v23; // rax
const char *CString; // r13
size_t v25; // rax
size_t v26; // rbx
_BYTE *v27; // r12
size_t v28; // r15
__int64 v29; // r13
_QWORD *v30; // rbx
__int64 v32; // [rsp+0h] [rbp-80h]
__int64 v33; // [rsp+8h] [rbp-78h]
__int64 v34; // [rsp+10h] [rbp-70h]
__int64 v35; // [rsp+18h] [rbp-68h]
unsigned int v36; // [rsp+2Ch] [rbp-54h]
__int64 v37; // [rsp+30h] [rbp-50h]
const char *__src; // [rsp+38h] [rbp-48h]
_BYTE __dst[48]; // [rsp+40h] [rbp-40h] BYREF
v32 = a1;
v4 = *(_QWORD *)(a1 + 72);
v5 = strlen(a3);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_51:
sub_100003630();
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = operator new(v8);
*(_QWORD *)&__dst[16] = v7;
*(_QWORD *)__dst = v8 + 1;
*(_QWORD *)&__dst[8] = v6;
goto LABEL_8;
}
__dst[0] = 2 * v5;
v7 = &__dst[1];
if ( v5 )
LABEL_8:
memcpy(v7, a3, v6);
v7[v6] = 0;
cocos2d::CCDictionary::setObject(v4, a2, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
strcpy(__dst, "$animationContainer");
v35 = cocos2d::CCDictionary::objectForKey(a2, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v9 = cocos2d::CCDictionary::allKeys(v35);
if ( (unsigned int)sub_1007FEF90(v9) )
{
v10 = 0;
v33 = v9;
while ( 1 )
{
v11 = sub_1007FEFE0(v9, v10);
__src = (const char *)cocos2d::CCString::getCString(v11);
v12 = strlen(__src);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v13 = v12;
if ( v12 >= 0x17 )
break;
__dst[0] = 2 * v12;
v14 = &__dst[1];
if ( v12 )
goto LABEL_23;
LABEL_24:
v14[v13] = 0;
v16 = v35;
v37 = cocos2d::CCDictionary::objectForKey(v35, __dst);
v36 = v10;
if ( (__dst[0] & 1) != 0 )
{
v16 = *(_QWORD *)&__dst[16];
operator delete(*(void **)&__dst[16]);
}
v34 = sub_1007FE900(v16);
v17 = *(_QWORD *)(v32 + 56);
v18 = strlen(__src);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = (v18 | 7) + 1;
if ( (v18 | 7) == 0x17 )
v21 = 26;
v20 = operator new(v21);
*(_QWORD *)&__dst[16] = v20;
*(_QWORD *)__dst = v21 + 1;
*(_QWORD *)&__dst[8] = v19;
LABEL_33:
memmove(v20, __src, v19);
goto LABEL_34;
}
__dst[0] = 2 * v18;
v20 = &__dst[1];
if ( v18 )
goto LABEL_33;
LABEL_34:
v20[v19] = 0;
cocos2d::CCDictionary::setObject(v17, v34, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
if ( (unsigned int)cocos2d::CCDictionary::count(v37) )
{
for ( i = 0; i < (unsigned int)cocos2d::CCDictionary::count(v37); ++i )
{
v23 = sub_10088E820("sprite_%i", v32);
CString = (const char *)cocos2d::CCString::getCString(v23);
v25 = strlen(CString);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_51;
v26 = v25;
if ( v25 >= 0x17 )
{
v28 = (v25 | 7) + 1;
if ( (v25 | 7) == 0x17 )
v28 = 26;
v27 = operator new(v28);
*(_QWORD *)&__dst[16] = v27;
*(_QWORD *)__dst = v28 + 1;
*(_QWORD *)&__dst[8] = v26;
}
else
{
__dst[0] = 2 * v25;
v27 = &__dst[1];
if ( !v25 )
goto LABEL_46;
}
memmove(v27, CString, v26);
LABEL_46:
v27[v26] = 0;
v29 = cocos2d::CCDictionary::objectForKey(v37, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v30 = operator new(0x68u);
cocos2d::CCObject::CCObject((__int64)v30);
*v30 = off_100B71630;
sub_1002782A0(v30 + 7);
sub_1002782A0(v30 + 8);
sub_1002782A0(v30 + 9);
v30[12] = 0;
v30[10] = 0;
*(_QWORD *)((char *)v30 + 85) = 0;
SpriteDescription::initDescription(v30, v29);
cocos2d::CCObject::autorelease((__int64)v30);
sub_1007FEBF0(v34, v30);
}
}
v10 = v36 + 1;
v9 = v33;
if ( v36 + 1 >= (unsigned int)sub_1007FEF90(v33) )
return a2;
}
v15 = (v12 | 7) + 1;
if ( (v12 | 7) == 0x17 )
v15 = 26;
v14 = operator new(v15);
*(_QWORD *)&__dst[16] = v14;
*(_QWORD *)__dst = v15 + 1;
*(_QWORD *)&__dst[8] = v13;
LABEL_23:
memmove(v14, __src, v13);
goto LABEL_24;
}
return a2;
}