//
// CCAnimateFrameCache::addCustomSpriteFramesWithFile from 0x1005980d0 to 0x100598bdc (2828 bytes)
//
// 0 xrefs:
//
// 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
//
void __fastcall CCAnimateFrameCache::addCustomSpriteFramesWithFile(__int64 a1, const char *a2)
{
__int64 v2; // rbx
size_t v3; // rax
size_t v4; // r14
char *v5; // r15
size_t v6; // r12
__int64 v7; // rbx
__int64 v8; // rbx
void *v9; // r14
size_t v10; // rax
size_t v11; // r15
char *v12; // r12
size_t v13; // r13
_QWORD *v14; // rbx
__int64 DictForKey; // rax
__int64 v16; // rbx
const char *CString; // r14
const char *v18; // rdi
size_t v19; // rax
size_t v20; // rbx
char *v21; // r15
size_t v22; // r12
char *v23; // rax
unsigned __int64 v24; // r13
__int64 v25; // r14
unsigned __int64 v26; // rsi
char *v27; // rdx
unsigned __int64 v28; // r12
bool v29; // zf
unsigned __int64 v30; // rbx
char *v31; // r15
size_t v32; // rbx
char *v33; // r12
char v34; // al
const char *v35; // rbx
size_t v36; // r13
size_t v37; // rax
size_t v38; // r15
std::string::value_type *v39; // r12
size_t v40; // r13
__int64 v41; // rax
__int64 v42; // rbx
char *v43; // rax
unsigned __int64 v44; // rsi
char *v45; // rdx
unsigned __int64 v46; // rdi
__int64 v47; // r14
unsigned int v48; // ebx
const char *v49; // rbx
size_t v50; // rax
std::string::size_type v51; // r15
char *data; // r14
size_t v53; // r12
size_t v54; // rax
size_t v55; // r15
std::string::value_type *v56; // r14
size_t v57; // r12
signed __int64 v58; // r12
char *v59; // rbx
unsigned __int128 v60; // kr00_16
std::string::size_type v61; // rbx
const std::string::value_type *v62; // rcx
std::string::size_type v63; // r8
size_t v64; // rax
unsigned int v65; // ecx
std::string::pointer v66; // rbx
size_t v67; // rax
size_t v68; // r15
char *v69; // r14
__int64 v70; // rax
__int64 v71; // rbx
char v72; // r15
void *v73; // r14
char *v74; // rdx
size_t v75; // r12
signed __int64 v76; // rdx
char *v77; // r13
int v78; // r14d
char *v79; // r15
size_t v80; // rdx
char *v81; // rax
char *v82; // r15
std::string::size_type v83; // r15
const std::string::value_type *v84; // rcx
std::string::size_type v85; // r8
size_t v86; // rax
unsigned int v87; // r13d
std::string::size_type v88; // r13
std::string::size_type v89; // rax
std::string::size_type v90; // rax
unsigned int v91; // [rsp+0h] [rbp-D0h]
__int64 v92; // [rsp+8h] [rbp-C8h]
void *v93; // [rsp+10h] [rbp-C0h]
__int64 v95; // [rsp+20h] [rbp-B0h]
unsigned __int64 v96; // [rsp+28h] [rbp-A8h]
__int64 v97; // [rsp+28h] [rbp-A8h]
std::string::pointer v98; // [rsp+30h] [rbp-A0h]
unsigned __int64 v100; // [rsp+40h] [rbp-90h]
char v101; // [rsp+40h] [rbp-90h]
std::string v102; // [rsp+48h] [rbp-88h] BYREF
std::string::value_type __s[8]; // [rsp+60h] [rbp-70h] BYREF
size_t v104; // [rsp+68h] [rbp-68h]
void *v105; // [rsp+70h] [rbp-60h]
__int64 v106; // [rsp+78h] [rbp-58h] BYREF
unsigned __int64 v107; // [rsp+80h] [rbp-50h]
void *v108; // [rsp+88h] [rbp-48h]
__int64 __dst; // [rsp+90h] [rbp-40h] BYREF
size_t __n; // [rsp+98h] [rbp-38h]
void *__p; // [rsp+A0h] [rbp-30h]
v2 = *(_QWORD *)(a1 + 72);
v3 = strlen(a2);
if ( v3 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_174;
v4 = v3;
if ( v3 >= 0x17 )
{
v6 = 26;
if ( (v3 | 7) != 0x17 )
v6 = (v3 | 7) + 1;
v5 = (char *)operator new(v6);
__p = v5;
__dst = v6 + 1;
__n = v4;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v3;
v5 = (char *)&__dst + 1;
if ( v3 )
LABEL_8:
memcpy(v5, a2, v4);
v5[v4] = 0;
v7 = cocos2d::CCDictionary::objectForKey(v2, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v7 )
{
v8 = *(_QWORD *)(a1 + 72);
v9 = cocos2d::CCNode::create();
v10 = strlen(a2);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_174;
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
__p = v12;
__dst = v13 + 1;
__n = v11;
}
else
{
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( !v10 )
{
LABEL_21:
v12[v11] = 0;
cocos2d::CCDictionary::setObject(v8, (__int64)v9, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v14 = operator new(0xF0u);
sub_100158EB0((__int64)v14);
DS_Dictionary::loadRootSubDictFromFile(v14, a2);
DictForKey = DS_Dictionary::getDictForKey(v14, nullptr, 0);
__dst = 0x736569706F630CLL;
v92 = DictForKey;
v16 = cocos2d::CCDictionary::objectForKey(DictForKey, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v16 )
return;
CString = (const char *)cocos2d::CCString::getCString(v16);
v18 = CString;
v19 = strlen(CString);
if ( v19 < 0xFFFFFFFFFFFFFFF8LL )
{
v20 = v19;
if ( v19 >= 0x17 )
{
v22 = 26;
if ( (v19 | 7) != 0x17 )
v22 = (v19 | 7) + 1;
v21 = (char *)operator new(v22);
v108 = v21;
v106 = v22 + 1;
v107 = v20;
}
else
{
LOBYTE(v106) = 2 * v19;
v21 = (char *)&v106 + 1;
if ( !v19 )
{
LABEL_34:
v21[v20] = 0;
v95 = sub_1007FE900(v18);
if ( (v106 & 1) != 0 )
{
v23 = (char *)v108;
v24 = v107;
v25 = -1;
if ( !v107 )
goto LABEL_44;
}
else
{
v24 = (unsigned __int8)v106 >> 1;
v23 = (char *)&v106 + 1;
v25 = -1;
if ( !((unsigned __int8)v106 >> 1) )
{
LABEL_44:
v28 = 0;
v96 = v24;
while ( 1 )
{
if ( (v106 & 1) != 0 )
{
v30 = v107;
if ( v107 < v28 )
LABEL_172:
sub_100056810();
v31 = (char *)v108;
}
else
{
v30 = (unsigned __int8)v106 >> 1;
v31 = (char *)&v106 + 1;
if ( v28 > v30 )
goto LABEL_172;
}
v32 = v30 - v28;
if ( v32 >= v25 - v28 )
v32 = v25 - v28;
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v100 = v28;
if ( v32 >= 0x17 )
{
v36 = (v32 | 7) + 1;
if ( (v32 | 7) == 0x17 )
v36 = 26;
v33 = (char *)operator new(v36);
__p = v33;
__dst = v36 | 1;
__n = v32;
v24 = v96;
}
else
{
LOBYTE(__dst) = 2 * v32;
v33 = (char *)&__dst + 1;
if ( !v32 )
{
BYTE1(__dst) = 0;
v34 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_57;
goto LABEL_64;
}
}
memmove(v33, &v31[v100], v32);
v33[v32] = 0;
v34 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_57:
v28 = v100;
if ( !v34 && v100 == v24 )
goto LABEL_77;
v35 = (char *)&__dst + 1;
goto LABEL_67;
}
LABEL_64:
v28 = v100;
if ( !__n && v100 == v24 )
goto LABEL_77;
v35 = (const char *)__p;
LABEL_67:
v37 = strlen(v35);
if ( v37 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v38 = v37;
if ( v37 >= 0x17 )
{
v40 = (v37 | 7) + 1;
if ( (v37 | 7) == 0x17 )
v40 = 26;
v39 = (std::string::value_type *)operator new(v40);
v105 = v39;
*(_QWORD *)__s = v40 | 1;
v104 = v38;
v24 = v96;
LABEL_74:
memmove(v39, v35, v38);
goto LABEL_75;
}
__s[0] = 2 * v37;
v39 = &__s[1];
if ( v37 )
goto LABEL_74;
LABEL_75:
v39[v38] = 0;
v41 = sub_10088E600(__s);
sub_1007FEBF0(v95, v41);
v28 = v100;
if ( (__s[0] & 1) != 0 )
operator delete(v105);
LABEL_77:
v42 = -1;
if ( v25 != -1 )
{
if ( (v106 & 1) != 0 )
{
v43 = (char *)v108;
v44 = v107;
v28 = v25 + 1;
if ( v107 > v25 + 1 )
goto LABEL_84;
}
else
{
v44 = (unsigned __int8)v106 >> 1;
v43 = (char *)&v106 + 1;
v28 = v25 + 1;
if ( v44 > v25 + 1 )
{
LABEL_84:
v45 = &v43[v28];
v46 = v44 + ~v25;
while ( *v45 != 32 )
{
++v45;
if ( !--v46 )
{
v45 = &v43[v44];
break;
}
}
v42 = v45 - v43;
if ( v45 == &v43[v44] )
v42 = -1;
}
}
}
if ( (__dst & 1) != 0 )
operator delete(__p);
v29 = v25 == -1;
v25 = v42;
if ( v29 )
{
if ( (v106 & 1) != 0 )
operator delete(v108);
v47 = v95;
if ( !(unsigned int)sub_1007FEF90(v95) )
return;
v48 = 0;
while ( 2 )
{
v91 = v48;
v97 = sub_1007FEFE0(v47, v48);
v49 = (const char *)cocos2d::CCString::getCString(v97);
v50 = strlen(a2);
if ( v50 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_174;
v51 = v50;
if ( v50 >= 0x17 )
{
v53 = (v50 | 7) + 1;
if ( (v50 | 7) == 0x17 )
v53 = 26;
data = (char *)operator new(v53);
v102.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
v102.__r_.__value_.__r.__words[0] = v53 + 1;
v102.__r_.__value_.__l.__size_ = v51;
}
else
{
v102.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v50);
data = v102.__r_.__value_.__s.__data_;
if ( !v50 )
{
LABEL_104:
data[v51] = 0;
LOBYTE(__dst) = 6;
*(_DWORD *)((char *)&__dst + 1) = 8026488;
v54 = strlen(v49);
if ( v54 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v55 = v54;
if ( v54 >= 0x17 )
{
v57 = (v54 | 7) + 1;
if ( (v54 | 7) == 0x17 )
v57 = 26;
v56 = (std::string::value_type *)operator new(v57);
v105 = v56;
*(_QWORD *)__s = v57 | 1;
v104 = v55;
}
else
{
__s[0] = 2 * v54;
v56 = &__s[1];
if ( !v54 )
{
LABEL_112:
v56[v55] = 0;
if ( (__dst & 1) != 0 )
{
v58 = __n;
v59 = (char *)__p;
v93 = __p;
v101 = __dst;
if ( !__n )
goto LABEL_117;
LABEL_114:
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
v60 = *(_OWORD *)&v102.__r_.__value_.__r.__words[1];
else
v60 = __PAIR128__(
(std::string *)((char *)&v102.__r_.__value_.__l.0 + 1),
*(_BYTE *)&v102.__r_.__value_.__l.0 >> 1);
v98 = *((std::string::pointer *)&v60 + 1);
while ( 2 )
{
v76 = v60 - *((_QWORD *)&v60 + 1);
if ( (_QWORD)v60 - *((_QWORD *)&v60 + 1) >= v58 )
{
v77 = &v98[v60];
v78 = *v59;
v79 = &v98[*((_QWORD *)&v60 + 1)];
while ( 1 )
{
v80 = v76 - v58 + 1;
if ( !v80 )
goto LABEL_128;
v81 = (char *)memchr(v79, v78, v80);
if ( !v81 )
goto LABEL_128;
v82 = v81;
if ( !memcmp(v81, v59, v58) )
break;
v79 = v82 + 1;
v76 = v77 - v79;
if ( v77 - v79 < v58 )
goto LABEL_128;
}
if ( v82 == v77 )
break;
v83 = v82 - v98;
if ( v83 == -1 )
break;
if ( (__s[0] & 1) != 0 )
{
v84 = (const std::string::value_type *)v105;
v85 = v104;
}
else
{
v85 = (unsigned __int8)__s[0] >> 1;
v84 = &__s[1];
}
std::string::replace(&v102, v83, v58, v84, v85);
if ( (__s[0] & 1) != 0 )
{
v86 = v104;
v87 = (unsigned int)v102.__r_.__value_.__l.0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_167;
}
else
{
v86 = (unsigned __int8)__s[0] >> 1;
v87 = (unsigned int)v102.__r_.__value_.__l.0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_167:
v88 = v87 >> 1;
v98 = v102.__r_.__value_.__s.__data_;
v89 = v83 + v86;
v60 = __PAIR128__(v89, v88);
if ( v88 >= v89 )
continue;
break;
}
}
v98 = v102.__r_.__value_.__l.__data_;
v90 = v83 + v86;
v60 = __PAIR128__(v90, v102.__r_.__value_.__l.__size_);
if ( v102.__r_.__value_.__l.__size_ >= v90 )
continue;
}
break;
}
LABEL_128:
if ( (__s[0] & 1) != 0 )
{
operator delete(v105);
if ( (v101 & 1) != 0 )
goto LABEL_134;
LABEL_130:
v66 = v102.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_131;
LABEL_135:
v66 = v102.__r_.__value_.__l.__data_;
v67 = strlen(v102.__r_.__value_.__l.__data_);
if ( v67 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_176:
sub_100003630();
}
else
{
if ( (v101 & 1) == 0 )
goto LABEL_130;
LABEL_134:
operator delete(v93);
v66 = v102.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_135;
LABEL_131:
v67 = strlen(v102.__r_.__value_.__s.__data_);
if ( v67 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_176;
}
v68 = v67;
if ( v67 >= 0x17 )
{
v75 = (v67 | 7) + 1;
if ( (v67 | 7) == 0x17 )
v75 = 26;
v69 = (char *)operator new(v75);
v108 = v69;
v106 = v75 | 1;
v107 = v68;
}
else
{
LOBYTE(v106) = 2 * v67;
v69 = (char *)&v106 + 1;
if ( !v67 )
{
BYTE1(v106) = 0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_139;
goto LABEL_140;
}
}
memmove(v69, v66, v68);
v69[v68] = 0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
LABEL_139:
operator delete(v102.__r_.__value_.__l.__data_);
LABEL_140:
LOBYTE(__dst) = 6;
*(_DWORD *)((char *)&__dst + 1) = 8026488;
v70 = sub_10088E600(&__dst);
v71 = ObjectManager::replaceAllOccurencesOfString(v70, v97, v92);
if ( (__dst & 1) != 0 )
operator delete(__p);
v72 = v106 & 1;
v73 = v108;
v74 = (char *)v108;
if ( (v106 & 1) == 0 )
v74 = (char *)&v106 + 1;
CCAnimateFrameCache::addDict(a1, v71, v74);
if ( v72 )
operator delete(v73);
v48 = v91 + 1;
v47 = v95;
if ( v91 + 1 >= (unsigned int)sub_1007FEF90(v95) )
return;
continue;
}
v58 = (unsigned __int8)__dst >> 1;
v59 = (char *)&__dst + 1;
v93 = __p;
v101 = __dst;
if ( (unsigned __int8)__dst >> 1 )
goto LABEL_114;
LABEL_117:
v61 = 0;
while ( 1 )
{
if ( v61 == -1 )
goto LABEL_128;
if ( (__s[0] & 1) != 0 )
{
v62 = (const std::string::value_type *)v105;
v63 = v104;
}
else
{
v63 = (unsigned __int8)__s[0] >> 1;
v62 = &__s[1];
}
std::string::replace(&v102, v61, 0, v62, v63);
if ( (__s[0] & 1) != 0 )
{
v64 = v104;
v65 = (unsigned int)v102.__r_.__value_.__l.0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_118;
}
else
{
v64 = (unsigned __int8)__s[0] >> 1;
v65 = (unsigned int)v102.__r_.__value_.__l.0;
if ( (*(_BYTE *)&v102.__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_118:
v61 += v64;
if ( v102.__r_.__value_.__l.__size_ < v61 )
goto LABEL_128;
continue;
}
}
v61 += v64;
if ( v65 >> 1 < v61 )
goto LABEL_128;
}
}
}
memcpy(v56, v49, v55);
goto LABEL_112;
}
}
break;
}
memcpy(data, a2, v51);
goto LABEL_104;
}
}
}
}
v26 = v24;
v27 = v23;
while ( *v27 != 32 )
{
++v27;
if ( !--v26 )
{
v27 = &v23[v24];
break;
}
}
v25 = -1;
if ( v27 != &v23[v24] )
v25 = v27 - v23;
goto LABEL_44;
}
}
v18 = v21;
memmove(v21, CString, v20);
goto LABEL_34;
}
LABEL_174:
sub_100003630();
}
}
memcpy(v12, a2, v11);
goto LABEL_21;
}
}