//
// EditorUI::copyObjects from 0x6c4318 to 0x6c47f0 (1240 bytes)
//
// 6 xrefs:
// > LevelEditorLayer::duplicateKeyframeAnimation @ 0x671ccc
// > EditorUI::onNewCustomItem @ 0x6c4948
// > EditorUI::doCopyObjects @ 0x6c4cb0
// > EditorUI::onDuplicate @ 0x6c4e5c
// > KeyframeGameObject::updateShadowObjects @ 0x763b78
// > ??> @ 0x6b250
//
// 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
//
__int64 *__usercall EditorUI::copyObjects@(
__int64 *__return_ptr a1@,
EditorUI *this@,
cocos2d::CCArray *a3@,
unsigned __int8 a4@,
char a5@)
{
int v7; // w22
unsigned __int64 v8; // x0
__int64 *v9; // x3
cocos2d::ccArray *data; // x1
GameObject **arr; // x20
__int64 v12; // x0
char *v13; // x23
GameObject *v14; // x19
int m_objectID; // w0
__int64 v16; // x1
void *v17; // x0
int v18; // w24
__int64 *v19; // x20
int v20; // w2
unsigned int v21; // w21
int ColorAction; // w23
size_t v23; // x25
size_t v24; // x24
int v25; // w4
int v26; // w5
int v27; // w6
int v28; // w7
size_t v29; // x24
size_t v30; // x21
size_t v31; // x20
size_t v32; // x0
unsigned int *v34; // x1
int v35; // w2
char v36; // [xsp+0h] [xbp+0h]
void *v37; // [xsp+68h] [xbp+68h]
int MainColorMode; // [xsp+80h] [xbp+80h] BYREF
__int64 v40; // [xsp+88h] [xbp+88h] BYREF
_QWORD v41[2]; // [xsp+90h] [xbp+90h] BYREF
_QWORD v42[2]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 *v43; // [xsp+B0h] [xbp+B0h]
__int64 v44; // [xsp+B8h] [xbp+B8h]
float v45; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v46; // [xsp+C8h] [xbp+C8h]
__int64 v47; // [xsp+D0h] [xbp+D0h] BYREF
size_t v48; // [xsp+D8h] [xbp+D8h] BYREF
unsigned __int64 v49; // [xsp+E0h] [xbp+E0h]
_BYTE *i; // [xsp+E8h] [xbp+E8h]
_BYTE v51[504]; // [xsp+F0h] [xbp+F0h] BYREF
v7 = a4;
if ( !a5 )
qsort(a3->data->arr, a3->data->num, 8u, (int (*)(const void *, const void *))mIDSort);
v43 = nullptr;
v44 = 0;
v46 = 0;
v45 = 1.0;
v8 = sub_D146DC(&v45, 10);
v42[1] = v8;
if ( v8 == 1 )
{
v47 = 0;
v9 = &v47;
}
else
{
v9 = (__int64 *)sub_686A44(v8);
}
v42[0] = v9;
sub_D153B8((int)a1, &byte_F288A0);
if ( a3 )
{
data = a3->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v12 = 8LL * data->num - 8;
v13 = (char *)arr + v12;
if ( arr <= (GameObject **)((char *)arr + v12) )
{
v14 = *arr;
if ( *arr )
{
while ( 1 )
{
m_objectID = v14->m_objectID;
if ( m_objectID == 749 )
goto LABEL_15;
if ( m_objectID == 3032 )
++LODWORD(v14[1].m_sQuad.tr.vertices.x);
((void (__fastcall *)(__int64 *__return_ptr, GameObject *, LevelEditorLayer *))v14->getSaveString)(
&v40,
v14,
this->m_editorLayer);
sub_D15E14(a1, &v40);
sub_D15FD4(a1, ";", 1);
if ( v14->m_objectID == 3032 )
{
--LODWORD(v14[1].m_sQuad.tr.vertices.x);
if ( !v7 )
goto LABEL_14;
}
else if ( !v7 )
{
goto LABEL_14;
}
MainColorMode = GameObject::getMainColorMode(v14);
if ( (unsigned int)(MainColorMode - 1) <= 0x3E6 )
{
v41[0] = v42;
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert>>>(
v42,
&MainColorMode);
}
LODWORD(v41[0]) = GameObject::getSecondaryColorMode(v14);
if ( (unsigned int)(LODWORD(v41[0]) - 1) > 0x3E6 )
{
LABEL_14:
v16 = v40;
v17 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
goto LABEL_39;
goto LABEL_15;
}
v41[1] = v42;
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert>>>(
v42,
(int *)v41);
v16 = v40;
v17 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
LABEL_39:
if ( &pthread_create )
{
v34 = (unsigned int *)(v16 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v17);
}
LABEL_15:
if ( v13 >= (char *)++arr )
{
v14 = *arr;
if ( *arr )
continue;
}
break;
}
}
}
}
}
if ( v7 && v44 )
{
v48 = 0;
v18 = 1;
v19 = v43;
v49 = 500;
for ( i = v51; v19; v18 = 0 )
{
v21 = *((_DWORD *)v19 + 2);
ColorAction = (unsigned int)GJEffectManager::getColorAction(
this->m_editorLayer->m_levelSettings->m_effectManager,
v21);
if ( !v18 )
{
v23 = v48;
v24 = v48 + 1;
if ( v48 + 1 > v49 )
fmt::internal::Array::grow(&v48, v48 + 1);
v48 = v24;
i[v23] = asc_EA06B0[0];
}
LODWORD(v40) = v21;
fmt::BasicWriter::FormatInt,char>>(&v48, v21);
v29 = v48;
v30 = v48 + 1;
if ( v48 + 1 > v49 )
fmt::internal::Array::grow(&v48, v48 + 1);
v20 = (int)i;
v48 = v30;
i[v29] = 44;
ColorAction::writeSaveString(ColorAction, (int)&v48, v20, 44, v25, v26, v27, v28, v36);
v19 = (__int64 *)*v19;
}
sub_D15FD4(a1, "#", 1);
v31 = v48;
if ( v48 + 1 > v49 )
fmt::internal::Array::grow(&v48, v48 + 1);
i[v31] = 0;
v37 = i;
v32 = strlen(i);
sub_D15FD4(a1, v37, v32);
if ( i != v51 && i )
operator delete[](i);
}
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((__int64)v42);
return a1;
}