//
// CCAnimateFrameCache::addCustomSpriteFramesWithFile from 0x68ed6c to 0x68f54c (2016 bytes)
//
// 1 xrefs:
// > ??> @ 0xe6c20
//
// This function is hookable on this platform (idp: arm, 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:50:34 +0000
//
__int64 __fastcall CCAnimateFrameCache::addCustomSpriteFramesWithFile(CCAnimateFrameCache *this, char *a2)
{
size_t v4; // x0
__int64 v5; // x19
__int64 v6; // x19
cocos2d::CCNode *v7; // x0
__int64 v9; // x20
cocos2d::CCObject *v10; // x19
size_t v11; // x0
DS_Dictionary *v12; // x19
cocos2d::CCString *v13; // x19
const char *CString; // x0
size_t v15; // x0
cocos2d::CCArray *v16; // x0
cocos2d::CCArray *v17; // x25
unsigned __int64 v18; // x26
_BYTE *v19; // x22
__int64 v20; // x23
unsigned __int8 v21; // w2
unsigned __int64 v22; // x22
size_t v23; // x3
unsigned __int64 v24; // x2
char *i; // x1
size_t v26; // x2
char *v27; // x1
int v28; // w1
const char *v29; // x1
size_t v30; // x0
cocos2d::CCObject *v31; // x0
char *v32; // x2
unsigned __int64 v33; // x0
__int64 *v34; // x0
_BYTE *v35; // x23
char *v36; // x3
char *v37; // x0
unsigned int v38; // w23
cocos2d::CCString *v39; // x27
__int64 v40; // x0
char *v41; // x22
size_t v42; // x0
size_t v43; // x0
unsigned __int8 v44; // w1
size_t v45; // x0
unsigned __int8 v46; // w4
unsigned __int8 v47; // w2
char *v48; // x7
size_t v49; // x1
int v50; // w5
unsigned __int8 *v51; // x8
signed __int64 v52; // x3
size_t v53; // x22
size_t v54; // x2
char *v55; // x3
size_t v56; // x4
size_t v57; // x2
const char *v58; // x1
size_t v59; // x0
ObjectManager *v60; // x0
cocos2d::CCDictionary *v61; // x3
cocos2d::CCDictionary *v62; // x1
char *v63; // x2
char *v64; // x0
char *v65; // x1
char *v66; // x12
char *v67; // x0
unsigned __int8 *v68; // x3
char *v69; // x22
char *v70; // x13
unsigned __int8 *v71; // x6
char *v72; // x9
int v73; // t1
cocos2d::CCString *DictForKey; // [xsp+60h] [xbp+60h]
char *v75; // [xsp+68h] [xbp+68h]
char *v76; // [xsp+68h] [xbp+68h]
char *v77; // [xsp+68h] [xbp+68h]
cocos2d::CCDictionary *v78; // [xsp+68h] [xbp+68h]
__int64 v79; // [xsp+70h] [xbp+70h] BYREF
unsigned __int64 v80; // [xsp+78h] [xbp+78h]
void *v81; // [xsp+80h] [xbp+80h]
__int64 v82; // [xsp+88h] [xbp+88h] BYREF
size_t v83; // [xsp+90h] [xbp+90h]
void *v84; // [xsp+98h] [xbp+98h]
__int64 v85; // [xsp+A0h] [xbp+A0h] BYREF
size_t v86; // [xsp+A8h] [xbp+A8h]
void *v87; // [xsp+B0h] [xbp+B0h]
v85 = 0;
v86 = 0;
v87 = nullptr;
v4 = strlen(a2);
v5 = *((_QWORD *)this + 9);
std::string::__init(&v85, a2, v4);
v6 = cocos2d::CCDictionary::objectForKey(v5, &v85);
v7 = (cocos2d::CCNode *)(unsigned __int8)v85;
if ( (v85 & 1) != 0 )
{
operator delete(v87);
if ( v6 )
return _stack_chk_guard;
}
else if ( v6 )
{
return _stack_chk_guard;
}
v9 = *((_QWORD *)this + 9);
v10 = (cocos2d::CCObject *)cocos2d::CCNode::create(v7);
v85 = 0;
v86 = 0;
v87 = nullptr;
v11 = strlen(a2);
std::string::__init(&v85, a2, v11);
cocos2d::CCDictionary::setObject(v9, v10);
if ( (v85 & 1) != 0 )
operator delete(v87);
v12 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v12);
DS_Dictionary::loadRootSubDictFromFile(v12, a2);
DictForKey = (cocos2d::CCString *)DS_Dictionary::getDictForKey(v12, nullptr, 0);
v85 = 0;
v86 = 0;
v87 = nullptr;
std::string::__init(&v85, "copies", 6u);
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(DictForKey, &v85);
if ( (v85 & 1) != 0 )
operator delete(v87);
if ( v13 )
{
CString = (const char *)cocos2d::CCString::getCString(v13);
v79 = 0;
v75 = (char *)CString;
v80 = 0;
v81 = nullptr;
v15 = strlen(CString);
v16 = (cocos2d::CCArray *)std::string::__init(&v79, v75, v15);
v17 = (cocos2d::CCArray *)cocos2d::CCArray::create(v16);
if ( (v79 & 1) != 0 )
{
v18 = v80;
v19 = v81;
if ( !v80 )
{
LABEL_12:
v18 = 0;
LABEL_13:
v20 = -1;
LABEL_14:
v21 = v79;
v82 = 0;
v22 = 0;
v83 = 0;
v23 = v20;
v84 = nullptr;
if ( (v79 & 1) == 0 )
goto LABEL_33;
LABEL_15:
v24 = v80;
if ( v22 > v80 )
LABEL_111:
sub_62B2A0();
for ( i = (char *)v81; ; i = (char *)&v79 + 1 )
{
v26 = v24 - v22;
v27 = &i[v22];
if ( v26 > v23 )
v26 = v23;
std::string::__init(&v82, v27, v26);
v28 = v82 & 1;
if ( v28 )
{
if ( v22 == v18 )
{
v28 = 1;
if ( !v83 )
goto LABEL_26;
}
v29 = (const char *)v84;
}
else
{
if ( v22 == v18 && !((int)(unsigned __int8)v82 >> 1) )
goto LABEL_26;
v29 = (char *)&v82 + 1;
}
v76 = (char *)v29;
v85 = 0;
v86 = 0;
v87 = nullptr;
v30 = strlen(v29);
std::string::__init(&v85, v76, v30);
v31 = (cocos2d::CCObject *)cocos2d::CCString::create(&v85);
cocos2d::CCArray::addObject(v17, v31);
if ( (v85 & 1) != 0 )
operator delete(v87);
v28 = v82 & 1;
LABEL_26:
if ( v20 == -1 )
{
if ( v28 )
operator delete(v84);
if ( (v79 & 1) != 0 )
operator delete(v81);
v38 = 0;
while ( 2 )
{
if ( v38 >= (unsigned int)cocos2d::CCArray::count(v17) )
return _stack_chk_guard;
v39 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v17, v38);
v40 = cocos2d::CCString::getCString(v39);
v79 = 0;
v41 = (char *)v40;
v80 = 0;
v81 = nullptr;
v42 = strlen(a2);
std::string::__init(&v79, a2, v42);
v82 = 0;
v83 = 0;
v84 = nullptr;
std::string::__init(&v82, "xyz", 3u);
v85 = 0;
v86 = 0;
v87 = nullptr;
v43 = strlen(v41);
std::string::__init(&v85, v41, v43);
v44 = v79;
v45 = 0;
v46 = v85;
if ( (v79 & 1) == 0 )
goto LABEL_77;
LABEL_65:
v47 = v82;
v48 = (char *)v81;
v49 = v80;
v50 = v82 & 1;
if ( (v82 & 1) != 0 )
{
LABEL_66:
v51 = (unsigned __int8 *)v84;
v52 = v83;
if ( v45 <= v49 )
goto LABEL_67;
goto LABEL_79;
}
while ( 1 )
{
v52 = v47 >> 1;
v51 = (unsigned __int8 *)&v82 + 1;
if ( v45 > v49 )
goto LABEL_79;
LABEL_67:
if ( v49 - v45 < v52 )
goto LABEL_79;
v53 = v45;
if ( v52 )
break;
LABEL_69:
if ( v53 == -1 )
goto LABEL_79;
v54 = v47 >> 1;
if ( v50 )
v54 = v83;
if ( (v46 & 1) != 0 )
{
v55 = (char *)v87;
v56 = v86;
}
else
{
v56 = v46 >> 1;
v55 = (char *)&v85 + 1;
}
std::string::replace(&v79, v53, v54, v55, v56);
v46 = v85;
v57 = (unsigned __int8)v85 >> 1;
if ( (v85 & 1) != 0 )
v57 = v86;
v44 = v79;
v45 = v57 + v53;
if ( (v79 & 1) != 0 )
goto LABEL_65;
LABEL_77:
v47 = v82;
v49 = v44 >> 1;
v48 = (char *)&v79 + 1;
v50 = v82 & 1;
if ( (v82 & 1) != 0 )
goto LABEL_66;
}
v64 = &v48[v45];
v65 = &v48[v49];
if ( v52 > v65 - v64 || (v66 = &v65[1 - v52], v64 == v66) )
{
LABEL_79:
if ( (v46 & 1) != 0 )
goto LABEL_92;
}
else
{
v67 = v64 + 1;
v68 = &v51[v52];
do
{
v69 = v67 - 1;
v70 = v67;
if ( (unsigned __int8)*(v67 - 1) == *v51 )
{
v71 = v51;
v72 = v67 - 1;
while ( ++v71 != v68 )
{
v73 = (unsigned __int8)*++v72;
if ( v73 != *v71 )
goto LABEL_104;
}
if ( v65 != v69 )
{
v53 = v69 - v48;
goto LABEL_69;
}
goto LABEL_79;
}
LABEL_104:
++v67;
}
while ( v66 != v70 );
if ( (v46 & 1) == 0 )
goto LABEL_80;
LABEL_92:
operator delete(v87);
v50 = v82 & 1;
}
LABEL_80:
if ( v50 )
operator delete(v84);
v58 = (char *)&v79 + 1;
if ( (v79 & 1) != 0 )
v58 = (const char *)v81;
v82 = 0;
v83 = 0;
v84 = nullptr;
v77 = (char *)v58;
v59 = strlen(v58);
std::string::__init(&v82, v77, v59);
if ( (v79 & 1) != 0 )
operator delete(v81);
v85 = 0;
v86 = 0;
v87 = nullptr;
std::string::__init(&v85, "xyz", 3u);
v60 = (ObjectManager *)cocos2d::CCString::create(&v85);
v62 = (cocos2d::CCDictionary *)ObjectManager::replaceAllOccurencesOfString(v60, v39, DictForKey, v61);
if ( (v85 & 1) != 0 )
{
v78 = v62;
operator delete(v87);
v62 = v78;
}
v63 = (char *)&v82 + 1;
if ( (v82 & 1) != 0 )
v63 = (char *)v84;
CCAnimateFrameCache::addDict(this, v62, v63);
++v38;
if ( (v82 & 1) != 0 )
operator delete(v84);
continue;
}
}
v22 = v20 + 1;
if ( (v79 & 1) != 0 )
{
v32 = (char *)v81;
v33 = v80;
}
else
{
v33 = (unsigned __int8)v79 >> 1;
v32 = (char *)&v79 + 1;
}
v20 = -1;
if ( v22 >= v33 || (v36 = &v32[v22], v37 = &v32[v33], &v32[v22] == v37) )
{
if ( !v28 )
goto LABEL_31;
}
else if ( v32[v22] == 32 )
{
LABEL_56:
v20 = v36 - v32;
if ( !v28 )
goto LABEL_31;
}
else
{
while ( v37 != ++v36 )
{
if ( *v36 == 32 )
goto LABEL_56;
}
v20 = -1;
if ( !v28 )
{
LABEL_31:
v21 = v79;
goto LABEL_32;
}
}
operator delete(v84);
v21 = v79;
LABEL_32:
v82 = 0;
v23 = v20 - v22;
v83 = 0;
v84 = nullptr;
if ( (v21 & 1) != 0 )
goto LABEL_15;
LABEL_33:
v24 = v21 >> 1;
if ( v22 > v24 )
goto LABEL_111;
}
}
v34 = (__int64 *)((char *)v81 + v80);
if ( v81 == (char *)v81 + v80 )
goto LABEL_13;
}
else
{
LODWORD(v18) = (int)(unsigned __int8)v79 >> 1;
if ( !(_DWORD)v18 )
goto LABEL_12;
v19 = (char *)&v79 + 1;
v20 = -1;
v34 = (__int64 *)((char *)&v79 + (int)v18 + 1);
if ( v34 == (__int64 *)((char *)&v79 + 1) )
{
LABEL_107:
v18 = (int)v18;
goto LABEL_14;
}
}
v35 = v19;
if ( *v19 == 32 )
{
v20 = 0;
goto LABEL_108;
}
do
{
if ( v34 == (__int64 *)++v35 )
{
v20 = -1;
goto LABEL_108;
}
}
while ( *v35 != 32 );
v20 = v35 - v19;
LABEL_108:
LODWORD(v18) = (int)(unsigned __int8)v79 >> 1;
if ( (v79 & 1) != 0 )
{
v18 = v80;
goto LABEL_14;
}
goto LABEL_107;
}
return _stack_chk_guard;
}