//
// CCAnimateFrameCache::addCustomSpriteFramesWithFile from 0x573770 to 0x574058 (2280 bytes)
//
// 1 xrefs:
// > ??> @ 0xb0550
//
// 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
//
void CCAnimateFrameCache::addCustomSpriteFramesWithFile(CCAnimateFrameCache *a1, const char *a2)
{
cocos2d::CCDictionary *m_animateDescriptions; // x19
__int64 v3; // x19
char *v4; // x0
unsigned int *v5; // x1
int v6; // w2
cocos2d::CCDictionary *v7; // x21
cocos2d::CCNode *v8; // x19
char *v9; // x0
DS_Dictionary *v10; // x19
cocos2d::CCString *v11; // x19
char *v12; // x0
char *CString; // x0
cocos2d::CCArray *v14; // x0
cocos2d::CCArray *v15; // x25
__int64 v16; // x24
__int64 v17; // x3
unsigned __int64 v18; // x19
__int64 v19; // x26
const std::string *v20; // x1
cocos2d::CCObject *v21; // x0
char *v22; // x0
char *v23; // x0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
char *v28; // x0
char *v29; // x0
unsigned int v30; // w24
cocos2d::CCString *v31; // x27
char *v32; // x19
__int64 v33; // x19
char *v34; // x0
char *v35; // x0
char *v36; // x0
const std::string *v37; // x1
cocos2d::CCString *v38; // x0
cocos2d::CCDictionary *v39; // x19
char *v40; // x0
char *v41; // x0
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x3
int v53; // w1
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x3
int v59; // w1
cocos2d::CCDictionary *DictForKey; // [xsp+68h] [xbp+68h]
char *v63; // [xsp+A0h] [xbp+A0h] BYREF
char *v64; // [xsp+A8h] [xbp+A8h] BYREF
std::string v65; // [xsp+B0h] [xbp+B0h] BYREF
m_animateDescriptions = a1->m_animateDescriptions;
sub_D153B8((int)&v65, (char *)a2);
v3 = cocos2d::CCDictionary::objectForKey(m_animateDescriptions, &v65);
v4 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v5 = (unsigned int *)((char *)v65.m_data.m_data - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v6 - 1;
}
if ( v6 > 0 )
{
LABEL_2:
if ( v3 )
return;
}
else
{
operator delete(v4);
if ( v3 )
return;
}
v7 = a1->m_animateDescriptions;
v8 = cocos2d::CCNode::create();
sub_D153B8((int)&v65, (char *)a2);
cocos2d::CCDictionary::setObject((int)v7, v8);
v9 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 != &qword_124B6B0 )
{
v58 = (unsigned int *)((char *)v65.m_data.m_data - 8);
if ( &pthread_create )
{
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v9);
}
v10 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v10);
DS_Dictionary::loadRootSubDictFromFile(v10, a2);
DictForKey = DS_Dictionary::getDictForKey(v10, nullptr, 0);
sub_D153B8((int)&v65, "copies");
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(DictForKey, &v65);
v12 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 != &qword_124B6B0 )
{
v52 = (unsigned int *)((char *)v65.m_data.m_data - 8);
if ( &pthread_create )
{
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v12);
}
if ( v11 )
{
CString = (char *)cocos2d::CCString::getCString(v11);
v14 = (cocos2d::CCArray *)sub_D153B8((int)&v63, CString);
v15 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
v16 = sub_D168E0((int)&v63, " ", 0, 1u);
v17 = v16;
v18 = 0;
v19 = *((_QWORD *)v63 - 3);
while ( 1 )
{
sub_D14F84(&v64, &v63, v18, v17);
if ( v19 != v18 || *((_QWORD *)v64 - 3) )
{
sub_D153B8((int)&v65, v64);
v21 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v65, v20);
cocos2d::CCArray::addObject(v15, v21);
v22 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)((char *)v65.m_data.m_data - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v22);
}
}
if ( v16 == -1 )
break;
v18 = v16 + 1;
v16 = sub_D168E0((int)&v63, " ", (int)v16 + 1, 1u);
v23 = v64 - 24;
if ( v64 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v64 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v64 - 2);
*((_DWORD *)v64 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v23);
}
v17 = v16 - v18;
if ( *((_QWORD *)v63 - 3) < v18 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v18,
*((_QWORD *)v63 - 3));
}
v28 = v64 - 24;
if ( v64 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v64 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v64 - 2);
*((_DWORD *)v64 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v28);
}
v29 = v63 - 24;
if ( v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v63 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v29);
}
v30 = 0;
while ( v30 < (unsigned int)cocos2d::CCArray::count(v15) )
{
v31 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, v30);
v32 = (char *)cocos2d::CCString::getCString(v31);
sub_D153B8((int)&v63, (char *)a2);
sub_D153B8((int)&v64, "xyz");
sub_D153B8((int)&v65, v32);
while ( 1 )
{
v33 = sub_D1641C((int)&v63, v64);
if ( v33 == -1 )
break;
sub_D1861C(&v63, v33, *((_QWORD *)v64 - 3), v65.m_data.m_data, *((_QWORD *)v65.m_data.m_data - 3));
}
v34 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)((char *)v65.m_data.m_data - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v34);
}
v35 = v64 - 24;
if ( v64 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v64 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *((_DWORD *)v64 - 2);
*((_DWORD *)v64 - 2) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v35);
}
sub_D153B8((int)&v64, v63);
v36 = v63 - 24;
if ( v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v63 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v36);
}
sub_D153B8((int)&v65, "xyz");
v38 = (cocos2d::CCString *)cocos2d::CCString::create((cocos2d::CCString *)&v65, v37);
v39 = ObjectManager::replaceAllOccurencesOfString(v38, v31, DictForKey);
v40 = (char *)v65.m_data.m_data - 24;
if ( (__int64 *)v65.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)((char *)v65.m_data.m_data - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v65.m_data.m_data - 2);
*((_DWORD *)v65.m_data.m_data - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v40);
}
CCAnimateFrameCache::addDict(a1, (DS_Dictionary *)v39, v64);
v41 = v64 - 24;
if ( v64 - 24 == (char *)&qword_124B6B0 )
goto LABEL_42;
if ( &pthread_create )
{
v42 = (unsigned int *)(v64 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v64 - 2);
*((_DWORD *)v64 - 2) = v43 - 1;
}
if ( v43 > 0 )
{
LABEL_42:
++v30;
}
else
{
++v30;
operator delete(v41);
}
}
}
}