//
// EditorUI::copyObjects from 0x6f3434 to 0x6f393c (1288 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::duplicateKeyframeAnimation @ 0x46ea6e
// > KeyframeGameObject::updateShadowObjects @ 0x4ec688
// > EditorUI::onDuplicate @ 0x6f3a06
// > EditorUI::doCopyObjects @ 0x6f3afe
// > EditorUI::onNewCustomItem @ 0x6f69f4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:57:37 +0000
//
EditorUI *__fastcall EditorUI::copyObjects(EditorUI *this, cocos2d::CCArray *a2, int a3, int a4, char a5)
{
_DWORD *v7; // r3
GameObject *v8; // r5
int v9; // r10
_DWORD *v10; // r6
int v11; // r7
unsigned int v12; // r5
int v14; // r3
char *v15; // r1
size_t v16; // r2
unsigned int MainColorMode; // r0
unsigned int v18; // r9
unsigned int v19; // r4
unsigned int v20; // r6
int v21; // r7
_DWORD *v22; // r2
_DWORD *j; // r8
unsigned int v24; // r0
int v25; // r1
_DWORD *v26; // r0
_DWORD *v27; // r8
float v28; // s15
bool v29; // r7
unsigned int v30; // r7
unsigned int v31; // r1
_DWORD *v32; // r3
unsigned int v33; // r0
int v34; // r1
unsigned int SecondaryColorMode; // r0
unsigned int v36; // r7
unsigned int v37; // r4
unsigned int v38; // r6
int v39; // r5
_DWORD *v40; // r2
_DWORD *i; // r9
unsigned int v42; // r0
int v43; // r1
_DWORD *v44; // r0
_DWORD *v45; // r6
float v46; // s15
bool v47; // r9
unsigned int v48; // r9
unsigned int v49; // r1
_DWORD *v50; // r3
unsigned int v51; // r0
int v52; // r1
GameObject **v53; // [sp+4h] [bp-240h]
ColorAction *ColorAction; // [sp+4h] [bp-240h]
GameObject **v57; // [sp+10h] [bp-234h]
int v58; // [sp+28h] [bp-21Ch] BYREF
unsigned int v59; // [sp+2Ch] [bp-218h]
_DWORD *v60; // [sp+30h] [bp-214h] BYREF
int v61; // [sp+34h] [bp-210h]
float v62; // [sp+38h] [bp-20Ch]
unsigned int v63; // [sp+3Ch] [bp-208h] BYREF
unsigned int v64; // [sp+40h] [bp-204h]
char *v65; // [sp+44h] [bp-200h]
_BYTE v66[500]; // [sp+48h] [bp-1FCh] BYREF
if ( !a5 )
qsort(*(void **)(*(_DWORD *)(a3 + 52) + 12), **(_DWORD **)(a3 + 52), 4u, mIDSort);
v62 = 1.0;
v58 = 0;
v59 = 0;
v60 = nullptr;
v61 = 0;
*(_DWORD *)this = 0;
*((_DWORD *)this + 1) = 0;
*((_DWORD *)this + 2) = 0;
std::string::__init((int *)this, &unk_B6B226, 0);
if ( a3 )
{
v7 = *(_DWORD **)(a3 + 52);
if ( *v7 )
{
v53 = (GameObject **)v7[3];
v57 = &v53[*v7] + 0x3FFFFFFF;
while ( 1 )
{
do
{
if ( v53 > v57 )
goto LABEL_4;
v8 = *v53++;
if ( !v8 )
goto LABEL_4;
v14 = *((_DWORD *)v8 + 223);
}
while ( v14 == 749 );
if ( v14 == 3032 )
++*((_DWORD *)v8 + 415);
(*(void (__fastcall **)(unsigned int *, GameObject *, _DWORD))(*(_DWORD *)v8 + 696))(
&v63,
v8,
*((_DWORD *)a2 + 236));
if ( (v63 & 1) != 0 )
{
v15 = v65;
v16 = v64;
}
else
{
v16 = (int)(unsigned __int8)v63 >> 1;
v15 = (char *)&v63 + 1;
}
std::string::append(this, v15, v16);
std::string::append(this, ";");
if ( *((_DWORD *)v8 + 223) == 3032 )
--*((_DWORD *)v8 + 415);
if ( a4 )
break;
LABEL_89:
std::string::~string((int)&v63);
}
MainColorMode = (unsigned int)GameObject::getMainColorMode(v8);
v18 = MainColorMode;
if ( MainColorMode - 1 > 0x3E6 )
{
LABEL_59:
SecondaryColorMode = (unsigned int)GameObject::getSecondaryColorMode(v8);
v36 = SecondaryColorMode;
if ( SecondaryColorMode - 1 > 0x3E6 )
goto LABEL_89;
v37 = v59;
if ( v59 )
{
v38 = v59 - 1;
if ( ((v59 - 1) & v59) != 0 )
v39 = SecondaryColorMode % v59;
else
v39 = SecondaryColorMode & v38;
v40 = *(_DWORD **)(v58 + 4 * v39);
if ( v40 )
{
for ( i = (_DWORD *)*v40; i; i = (_DWORD *)*i )
{
v42 = i[1];
v43 = ((v59 - 1) & v59) != 0 ? v42 % v59 : v38 & v42;
if ( v43 != v39 )
break;
if ( i[2] == v36 )
goto LABEL_89;
}
}
}
else
{
v39 = 0;
}
v44 = (_DWORD *)operator new(0xCu);
v44[2] = v36;
v44[1] = v36;
*v44 = 0;
v45 = v44;
v46 = (float)(unsigned int)(v61 + 1);
if ( v46 > (float)((float)v37 * v62) )
{
v47 = v37 > 2 && ((v37 - 1) & v37) == 0;
}
else
{
if ( v37 )
{
LABEL_81:
v50 = *(_DWORD **)(v58 + 4 * v39);
if ( v50 )
{
*v45 = *v50;
*v50 = v45;
}
else
{
*v45 = v60;
v60 = v45;
*(_DWORD *)(v58 + 4 * v39) = &v60;
if ( *v45 )
{
v51 = *(_DWORD *)(*v45 + 4);
if ( ((v37 - 1) & v37) != 0 )
v52 = v51 % v37;
else
v52 = (v37 - 1) & v51;
*(_DWORD *)(v58 + 4 * v52) = v45;
}
}
++v61;
goto LABEL_89;
}
v47 = 0;
}
v48 = 2 * v37 + !v47;
v49 = (unsigned int)ceilf(v46 / v62);
if ( v49 < v48 )
v49 = v48;
std::__hash_table,std::equal_to,std::allocator>::rehash((int)&v58, v49);
v37 = v59;
if ( ((v37 - 1) & v37) != 0 )
v39 = v36 % v59;
else
v39 = (v59 - 1) & v36;
goto LABEL_81;
}
v19 = v59;
if ( v59 )
{
v20 = v59 - 1;
if ( ((v59 - 1) & v59) != 0 )
v21 = MainColorMode % v59;
else
v21 = MainColorMode & v20;
v22 = *(_DWORD **)(v58 + 4 * v21);
if ( v22 )
{
for ( j = (_DWORD *)*v22; j; j = (_DWORD *)*j )
{
v24 = j[1];
v25 = ((v59 - 1) & v59) != 0 ? v24 % v59 : v20 & v24;
if ( v25 != v21 )
break;
if ( j[2] == v18 )
goto LABEL_59;
}
}
}
else
{
v21 = 0;
}
v26 = (_DWORD *)operator new(0xCu);
v26[2] = v18;
v26[1] = v18;
*v26 = 0;
v27 = v26;
v28 = (float)(unsigned int)(v61 + 1);
if ( v28 > (float)((float)v19 * v62) )
{
v29 = v19 > 2 && ((v19 - 1) & v19) == 0;
}
else
{
if ( v19 )
{
LABEL_51:
v32 = *(_DWORD **)(v58 + 4 * v21);
if ( v32 )
{
*v27 = *v32;
*v32 = v27;
}
else
{
*v27 = v60;
v60 = v27;
*(_DWORD *)(v58 + 4 * v21) = &v60;
if ( *v27 )
{
v33 = *(_DWORD *)(*v27 + 4);
if ( ((v19 - 1) & v19) != 0 )
v34 = v33 % v19;
else
v34 = (v19 - 1) & v33;
*(_DWORD *)(v58 + 4 * v34) = v27;
}
}
++v61;
goto LABEL_59;
}
v29 = 0;
}
v30 = 2 * v19 + !v29;
v31 = (unsigned int)ceilf(v28 / v62);
if ( v31 < v30 )
v31 = v30;
std::__hash_table,std::equal_to,std::allocator>::rehash((int)&v58, v31);
v19 = v59;
if ( ((v19 - 1) & v19) != 0 )
v21 = v18 % v59;
else
v21 = v18 & (v59 - 1);
goto LABEL_51;
}
}
LABEL_4:
if ( a4 && v61 )
{
v63 = 0;
v64 = 500;
v11 = 1;
v65 = v66;
v10 = v60;
while ( v10 )
{
v9 = v10[2];
ColorAction = GJEffectManager::getColorAction(
*(GJEffectManager **)(*(_DWORD *)(*((_DWORD *)a2 + 236) + 2084) + 264),
v9);
if ( !v11 )
fmt::BasicWriter::operator<<(&v63, "|", 0);
fmt::BasicWriter::FormatInt,char>>(&v63, v9);
fmt::BasicWriter::operator<<(&v63, ",", 0);
ColorAction::writeSaveString((int)ColorAction, &v63);
v10 = (_DWORD *)*v10;
v11 = 0;
}
std::string::append(this, "#");
v12 = v63;
if ( v63 + 1 > v64 )
fmt::internal::Array::grow((int)&v63, v63 + 1);
v65[v12] = 0;
std::string::append(this, v65);
if ( v65 != v66 && v65 )
operator delete[](v65);
}
std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v58);
return this;
}