//
// EditorUI::copyObjects from 0xbda218 to 0xbda9d0 (1976 bytes)
//
// 6 xrefs:
// > LevelEditorLayer::duplicateKeyframeAnimation @ 0x7a12d8
// > KeyframeGameObject::updateShadowObjects @ 0x888d98
// > EditorUI::onDuplicate @ 0xbdaa6c
// > EditorUI::doCopyObjects @ 0xbdac44
// > EditorUI::onNewCustomItem @ 0xbe00dc
// > ??> @ 0x90e08
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:03:42 +0000
//
__int64 *__usercall EditorUI::copyObjects@(
__int64 *__return_ptr a1@,
EditorUI *this@,
cocos2d::CCArray *a3@,
unsigned __int8 a4@,
char a5@)
{
int v8; // w28
unsigned int *v9; // x1
GameObject **v10; // x20
GameObject *v11; // x19
int v12; // w0
char *v13; // x1
size_t v14; // x2
_QWORD *v15; // x0
_QWORD *v16; // x19
void *v17; // x0
_QWORD *v19; // x20
int v20; // w26
unsigned int v21; // w21
ColorAction *ColorAction; // x23
size_t v23; // x26
size_t v24; // x26
size_t v25; // x21
size_t v26; // x20
size_t v27; // x0
int MainColorMode; // w23
unsigned __int64 v29; // x22
unsigned __int64 v30; // x26
__int64 *v31; // x0
unsigned __int64 v32; // x1
unsigned __int64 v33; // x1
__int64 v34; // x0
float v35; // s0
_BOOL8 v36; // x2
__int64 v37; // x0
unsigned __int64 v38; // x2
unsigned __int64 v39; // x1
_QWORD *v40; // x0
int SecondaryColorMode; // w22
unsigned __int64 v42; // x19
unsigned __int64 v43; // x23
__int64 *v44; // x0
unsigned __int64 v45; // x1
unsigned __int64 v46; // x1
__int64 v47; // x26
float v48; // s0
_BOOL8 v49; // x2
__int64 v50; // x0
unsigned __int64 v51; // x2
unsigned __int64 v52; // x1
__int64 *v53; // x0
unsigned __int64 v54; // x1
unsigned __int64 v55; // x0
unsigned __int64 v56; // x1
unsigned __int64 v57; // x0
_QWORD *v58; // [xsp+70h] [xbp+70h]
GameObject **v59; // [xsp+88h] [xbp+88h]
_BYTE *v60; // [xsp+88h] [xbp+88h]
char *v61; // [xsp+88h] [xbp+88h]
_QWORD *v62; // [xsp+A0h] [xbp+A0h] BYREF
unsigned __int64 v63; // [xsp+A8h] [xbp+A8h]
_QWORD *v64; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v65; // [xsp+B8h] [xbp+B8h]
float v66; // [xsp+C0h] [xbp+C0h]
size_t v67; // [xsp+C8h] [xbp+C8h] BYREF
unsigned __int64 v68; // [xsp+D0h] [xbp+D0h]
char *i; // [xsp+D8h] [xbp+D8h]
_BYTE v70[504]; // [xsp+E0h] [xbp+E0h] BYREF
v8 = a4;
if ( !a5 )
qsort(
*(void **)(*((_QWORD *)a3 + 7) + 16LL),
**((unsigned int **)a3 + 7),
8u,
(int (*)(const void *, const void *))mIDSort);
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
v62 = nullptr;
v63 = 0;
v64 = nullptr;
v65 = 0;
v66 = 1.0;
std::string::__init(a1, &byte_11B8890, 0);
if ( a3 )
{
v9 = *((unsigned int **)a3 + 7);
if ( *v9 )
{
v10 = *((GameObject ***)v9 + 2);
v59 = &v10[*v9 - 1];
if ( v10 <= v59 )
{
v11 = *v10;
if ( *v10 )
{
while ( 1 )
{
v12 = *((_DWORD *)v11 + 257);
if ( v12 == 749 )
goto LABEL_15;
if ( v12 == 3032 )
++*((_DWORD *)v11 + 465);
(*(void (__fastcall **)(GameObject *, _QWORD))(*(_QWORD *)v11 + 1392LL))(v11, *((_QWORD *)this + 180));
if ( (v67 & 1) != 0 )
{
v13 = i;
v14 = v68;
}
else
{
v14 = (unsigned __int8)v67 >> 1;
v13 = (char *)&v67 + 1;
}
std::string::append((__int64)a1, v13, v14);
std::string::append((__int64)a1, ";", 1u);
if ( *((_DWORD *)v11 + 257) == 3032 )
{
--*((_DWORD *)v11 + 465);
if ( !v8 )
goto LABEL_14;
}
else if ( !v8 )
{
goto LABEL_14;
}
MainColorMode = GameObject::getMainColorMode(v11);
if ( (unsigned int)(MainColorMode - 1) <= 0x3E6 )
break;
LABEL_58:
SecondaryColorMode = GameObject::getSecondaryColorMode(v11);
if ( (unsigned int)(SecondaryColorMode - 1) <= 0x3E6 )
{
v42 = v63;
if ( v63 )
{
v43 = SecondaryColorMode & (v63 - 1);
if ( ((v63 - 1) & v63) != 0 )
v43 = SecondaryColorMode % v63;
v44 = (__int64 *)v62[v43];
if ( v44 )
{
while ( 1 )
{
v44 = (__int64 *)*v44;
if ( !v44 )
break;
v45 = v44[1];
v46 = ((v63 - 1) & v63) != 0 ? v45 % v63 : (v63 - 1) & v45;
if ( v43 != v46 )
break;
if ( SecondaryColorMode == *((_DWORD *)v44 + 4) )
goto LABEL_14;
}
}
}
else
{
v43 = 0;
}
v47 = operator new(0x18u);
*(_DWORD *)(v47 + 16) = SecondaryColorMode;
*(_QWORD *)(v47 + 8) = SecondaryColorMode;
*(_QWORD *)v47 = 0;
v48 = (float)(unsigned __int64)(v65 + 1);
if ( v48 > (float)((float)v42 * v66) )
{
v49 = 1;
v50 = 2 * v42;
if ( v42 > 2 )
v49 = ((v42 - 1) & v42) != 0;
LABEL_70:
v51 = v49 + v50;
v52 = vcvtps_u32_f32(v48 / v66);
if ( v52 < v51 )
v52 = v51;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(unsigned __int64)&v62,
v52);
v42 = v63;
if ( ((v42 - 1) & v42) == 0 )
{
v43 = SecondaryColorMode & (v63 - 1);
goto LABEL_74;
}
v43 = SecondaryColorMode % v63;
v53 = (__int64 *)v62[v43];
if ( !v53 )
goto LABEL_97;
LABEL_75:
*(_QWORD *)v47 = *v53;
*v53 = v47;
}
else
{
if ( !v42 )
{
v49 = 1;
v50 = 0;
goto LABEL_70;
}
LABEL_74:
v53 = (__int64 *)v62[v43];
if ( v53 )
goto LABEL_75;
LABEL_97:
*(_QWORD *)v47 = v64;
v64 = (_QWORD *)v47;
v62[v43] = &v64;
if ( *(_QWORD *)v47 )
{
v56 = *(_QWORD *)(*(_QWORD *)v47 + 8LL);
if ( ((v42 - 1) & v42) != 0 )
v57 = v56 % v42;
else
v57 = (v42 - 1) & v56;
v62[v57] = v47;
}
}
++v65;
if ( (v67 & 1) == 0 )
goto LABEL_15;
goto LABEL_77;
}
LABEL_14:
if ( (v67 & 1) == 0 )
goto LABEL_15;
LABEL_77:
operator delete(i);
LABEL_15:
if ( v59 >= ++v10 )
{
v11 = *v10;
if ( *v10 )
continue;
}
goto LABEL_17;
}
v29 = v63;
if ( v63 )
{
v30 = MainColorMode & (v63 - 1);
if ( ((v63 - 1) & v63) != 0 )
v30 = MainColorMode % v63;
v31 = (__int64 *)v62[v30];
if ( v31 )
{
while ( 1 )
{
v31 = (__int64 *)*v31;
if ( !v31 )
break;
v32 = v31[1];
v33 = ((v63 - 1) & v63) != 0 ? v32 % v63 : (v63 - 1) & v32;
if ( v30 != v33 )
break;
if ( MainColorMode == *((_DWORD *)v31 + 4) )
goto LABEL_58;
}
}
}
else
{
v30 = 0;
}
v34 = operator new(0x18u);
*(_DWORD *)(v34 + 16) = MainColorMode;
*(_QWORD *)(v34 + 8) = MainColorMode;
*(_QWORD *)v34 = 0;
v58 = (_QWORD *)v34;
v35 = (float)(unsigned __int64)(v65 + 1);
if ( v35 > (float)((float)v29 * v66) )
{
v36 = 1;
v37 = 2 * v29;
if ( v29 > 2 )
v36 = ((v29 - 1) & v29) != 0;
}
else
{
if ( v29 )
goto LABEL_55;
v36 = 1;
v37 = 0;
}
v38 = v36 + v37;
v39 = vcvtps_u32_f32(v35 / v66);
if ( v39 < v38 )
v39 = v38;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(unsigned __int64)&v62,
v39);
v29 = v63;
if ( ((v29 - 1) & v29) != 0 )
{
v30 = MainColorMode % v63;
v40 = (_QWORD *)v62[v30];
if ( v40 )
goto LABEL_56;
goto LABEL_92;
}
v30 = MainColorMode & (v63 - 1);
LABEL_55:
v40 = (_QWORD *)v62[v30];
if ( v40 )
{
LABEL_56:
*v58 = *v40;
*v40 = v58;
LABEL_57:
++v65;
goto LABEL_58;
}
LABEL_92:
*v58 = v64;
v64 = v58;
v62[v30] = &v64;
if ( *v58 )
{
v54 = *(_QWORD *)(*v58 + 8LL);
if ( ((v29 - 1) & v29) != 0 )
v55 = v54 % v29;
else
v55 = (v29 - 1) & v54;
v62[v55] = v58;
}
goto LABEL_57;
}
}
}
}
LABEL_17:
if ( v8 && v65 )
{
v19 = v64;
v67 = 0;
v20 = 1;
v68 = 500;
for ( i = v70; v19; v20 = 0 )
{
v21 = *((_DWORD *)v19 + 4);
ColorAction = GJEffectManager::getColorAction(
*(GJEffectManager **)(*(_QWORD *)(*((_QWORD *)this + 180) + 3272LL) + 320LL),
v21);
if ( !v20 )
{
v60 = (_BYTE *)v67;
v23 = v67 + 1;
if ( v67 + 1 > v68 )
fmt::internal::Array::grow(&v67, v67 + 1);
v67 = v23;
v60[(_QWORD)i] = asc_111D680[0];
}
fmt::BasicWriter::FormatInt,char>>(&v67, v21);
v24 = v67;
v25 = v67 + 1;
if ( v67 + 1 > v68 )
fmt::internal::Array::grow(&v67, v67 + 1);
v67 = v25;
i[v24] = 44;
ColorAction::writeSaveString((__int64)ColorAction, &v67);
v19 = (_QWORD *)*v19;
}
std::string::append((__int64)a1, "#", 1u);
v26 = v67;
if ( v67 + 1 > v68 )
fmt::internal::Array::grow(&v67, v67 + 1);
i[v26] = 0;
v61 = i;
v27 = strlen(i);
std::string::append((__int64)a1, v61, v27);
if ( i != v70 && i )
operator delete[](i);
}
v15 = v64;
if ( v64 )
{
do
{
v16 = (_QWORD *)*v15;
operator delete(v15);
v15 = v16;
}
while ( v16 );
}
v17 = v62;
v62 = nullptr;
if ( v17 )
operator delete(v17);
return a1;
}