//
// ObjectManager::loadCopiedAnimations from 0x58bc88 to 0x58c094 (1036 bytes)
//
// 2 xrefs:
// > ObjectManager::init @ 0x58cf5c
// > ??> @ 0x61ba8
//
// 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 ObjectManager::loadCopiedAnimations(ObjectManager *a1)
{
cocos2d::CCString *v2; // x0
cocos2d::CCDictionary *m_objectDefinitions; // x20
char *CString; // x0
cocos2d::CCDictionary *v5; // x20
char *v6; // x0
cocos2d::CCDictionary *v7; // x25
char *v8; // x0
unsigned int v9; // w20
cocos2d::CCArray *v10; // x23
cocos2d::CCString *v11; // x26
char *v12; // x0
cocos2d::CCDictionary *v13; // x24
char *v14; // x0
cocos2d::CCString *v15; // x24
char *v16; // x0
const char *v17; // x0
cocos2d::CCDictionary *GlobalAnimCopy; // x24
char *v19; // x0
char *v20; // x0
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
cocos2d::CCArray *v31; // [xsp+70h] [xbp+70h]
unsigned int v32; // [xsp+7Ch] [xbp+7Ch]
std::string v33; // [xsp+90h] [xbp+90h] BYREF
v32 = 0;
v31 = cocos2d::CCDictionary::allKeys(a1->m_objectDefinitions);
if ( (unsigned int)cocos2d::CCArray::count(v31) )
{
do
{
v2 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v31, v32);
m_objectDefinitions = a1->m_objectDefinitions;
CString = (char *)cocos2d::CCString::getCString(v2);
sub_D153B8((int)&v33, CString);
v5 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_objectDefinitions, &v33);
v6 = (char *)v33.m_data.m_data - 24;
if ( (__int64 *)v33.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)((char *)v33.m_data.m_data - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v33.m_data.m_data - 2);
*((_DWORD *)v33.m_data.m_data - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v33, "animations");
v7 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v5, &v33);
v8 = (char *)v33.m_data.m_data - 24;
if ( (__int64 *)v33.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)((char *)v33.m_data.m_data - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v33.m_data.m_data - 2);
*((_DWORD *)v33.m_data.m_data - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v8);
}
if ( v7 )
{
v9 = 0;
v10 = cocos2d::CCDictionary::allKeys(v7);
if ( (unsigned int)cocos2d::CCArray::count(v10) )
{
do
{
v11 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v10, v9);
v12 = (char *)cocos2d::CCString::getCString(v11);
sub_D153B8((int)&v33, v12);
v13 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v7, &v33);
v14 = (char *)v33.m_data.m_data - 24;
if ( (__int64 *)v33.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)((char *)v33.m_data.m_data - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v33.m_data.m_data - 2);
*((_DWORD *)v33.m_data.m_data - 2) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v14);
}
sub_D153B8((int)&v33, "copy");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v13, &v33);
v16 = (char *)v33.m_data.m_data - 24;
if ( (__int64 *)v33.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)((char *)v33.m_data.m_data - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v33.m_data.m_data - 2);
*((_DWORD *)v33.m_data.m_data - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v16);
}
if ( !v15 )
goto LABEL_10;
v17 = cocos2d::CCString::getCString(v15);
GlobalAnimCopy = ObjectManager::getGlobalAnimCopy(a1, v17);
v19 = (char *)cocos2d::CCString::getCString(v11);
sub_D153B8((int)&v33, v19);
cocos2d::CCDictionary::setObject((int)v7, GlobalAnimCopy);
v20 = (char *)v33.m_data.m_data - 24;
if ( (__int64 *)v33.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_10;
if ( &pthread_create )
{
v23 = (unsigned int *)((char *)v33.m_data.m_data - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v33.m_data.m_data - 2);
*((_DWORD *)v33.m_data.m_data - 2) = v24 - 1;
}
if ( v24 > 0 )
{
LABEL_10:
++v9;
}
else
{
++v9;
operator delete(v20);
}
}
while ( v9 < (unsigned int)cocos2d::CCArray::count(v10) );
}
}
++v32;
}
while ( v32 < (unsigned int)cocos2d::CCArray::count(v31) );
}
}