//
// ObjectManager::loadCopiedSets from 0x58cb00 to 0x58cf34 (1076 bytes)
//
// 2 xrefs:
// > ObjectManager::init @ 0x58cf64
// > ??> @ 0x6bfe8
//
// 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::loadCopiedSets(ObjectManager *a1)
{
cocos2d::CCArray *v2; // x27
unsigned int v3; // w23
cocos2d::CCString *v4; // x0
cocos2d::CCDictionary *m_objectDefinitions; // x22
cocos2d::CCString *v6; // x28
char *CString; // x0
cocos2d::CCDictionary *v8; // x22
char *v9; // x0
cocos2d::CCString *v10; // x26
char *v11; // x0
cocos2d::CCString *v12; // x24
char *v13; // x0
cocos2d::CCDictionary *v14; // x22
char *v15; // x0
char *v16; // x0
const std::string *v17; // x1
cocos2d::CCString *v18; // x0
cocos2d::CCDictionary *v19; // x22
char *v20; // x0
cocos2d::CCDictionary *v21; // x24
char *v22; // x0
char *v23; // x0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
std::string v36; // [xsp+80h] [xbp+80h] BYREF
v2 = cocos2d::CCDictionary::allKeys(a1->m_objectDefinitions);
v3 = 0;
while ( v3 < (unsigned int)cocos2d::CCArray::count(v2) )
{
v4 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v2, v3);
m_objectDefinitions = a1->m_objectDefinitions;
v6 = v4;
CString = (char *)cocos2d::CCString::getCString(v4);
sub_D153B8((int)&v36, CString);
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_objectDefinitions, &v36);
v9 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v36, "copy");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v8, &v36);
v11 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v11);
}
sub_D153B8((int)&v36, "replaceTag");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v8, &v36);
v13 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v13);
}
if ( !v12 )
goto LABEL_10;
if ( v10 )
{
v14 = a1->m_objectDefinitions;
v15 = (char *)cocos2d::CCString::getCString(v10);
sub_D153B8((int)&v36, v15);
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v14, &v36);
v16 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v16);
}
}
sub_D153B8((int)&v36, "xyz");
v18 = (cocos2d::CCString *)cocos2d::CCString::create((cocos2d::CCString *)&v36, v17);
v19 = ObjectManager::replaceAllOccurencesOfString(v18, v12, v8);
v20 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v20);
}
v21 = a1->m_objectDefinitions;
v22 = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((int)&v36, v22);
cocos2d::CCDictionary::setObject((int)v21, v19);
v23 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_10;
if ( &pthread_create )
{
v26 = (unsigned int *)((char *)v36.m_data.m_data - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v36.m_data.m_data - 2);
*((_DWORD *)v36.m_data.m_data - 2) = v27 - 1;
}
if ( v27 > 0 )
{
LABEL_10:
++v3;
}
else
{
++v3;
operator delete(v23);
}
}
}