//
// EditorUI::copyObjects from 0x1005b5f80 to 0x1005b65a6 (1574 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::duplicateKeyframeAnimation @ 0x1000c8498
// > KeyframeGameObject::updateShadowObjects @ 0x1001a725f
// > EditorUI::onDuplicate @ 0x1005b5e9d
// > EditorUI::doCopyObjects @ 0x1005b7dd2
// > EditorUI::onNewCustomItem @ 0x10063c79e
//
// This function is hookable on this platform (idp: pc, 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 12:32:41 +0000
//
std::string *__fastcall EditorUI::copyObjects(std::string *a1, __int64 a2, __int64 a3, char a4, int a5)
{
std::string *v7; // r12
__m128 v8; // xmm0
unsigned int *v9; // rax
__int64 v10; // rcx
_DWORD **v11; // rbx
unsigned __int64 v12; // r14
_DWORD *v13; // r12
int v14; // eax
const std::string::value_type *v15; // rsi
std::string::size_type v16; // rdx
__int64 **v17; // r15
int v18; // ebx
char *ColorAction; // r14
size_t v20; // r12
unsigned __int64 v21; // rbx
size_t v22; // rdi
void *v23; // rax
void *v24; // r13
_BYTE *v25; // r14
__int64 *i; // rbx
int v27; // r13d
size_t v28; // r15
unsigned __int64 v29; // r12
size_t v30; // rdi
void *v31; // rax
void *v32; // r14
_BYTE *v33; // rbx
size_t v34; // r15
unsigned __int64 v35; // r12
size_t v36; // rdi
void *v37; // rax
void *v38; // r14
__int64 *v39; // r13
_BYTE *v40; // rbx
size_t v41; // r14
size_t v42; // rdi
void *v43; // rax
void *v44; // r15
_BYTE *v45; // rbx
_QWORD *v46; // rdi
_QWORD *v47; // rbx
void *v48; // rdi
__int64 *v50; // [rsp+8h] [rbp-298h]
void *v51[2]; // [rsp+10h] [rbp-290h] BYREF
void *v52[2]; // [rsp+20h] [rbp-280h]
int v53; // [rsp+30h] [rbp-270h]
int MainColorMode; // [rsp+40h] [rbp-260h] BYREF
int SecondaryColorMode; // [rsp+44h] [rbp-25Ch] BYREF
__int64 v56; // [rsp+48h] [rbp-258h]
char *v57; // [rsp+50h] [rbp-250h]
std::string *v58; // [rsp+58h] [rbp-248h]
std::string::value_type __s[8]; // [rsp+60h] [rbp-240h] BYREF
unsigned __int64 v60; // [rsp+68h] [rbp-238h]
void *__p; // [rsp+70h] [rbp-230h]
_BYTE v62[504]; // [rsp+78h] [rbp-228h] BYREF
v56 = a2;
v7 = a1;
if ( a5 )
{
v8 = 0;
*(_OWORD *)v52 = 0;
*(_OWORD *)v51 = 0;
v53 = 1065353216;
*(_WORD *)&a1->__r_.__value_.__l.0 = 0;
if ( !a3 )
goto LABEL_67;
v9 = *(unsigned int **)(a3 + 56);
v10 = *v9;
if ( !*v9 )
goto LABEL_67;
}
else
{
qsort(*(void **)(*(_QWORD *)(a3 + 56) + 16LL), **(unsigned int **)(a3 + 56), 8u, sub_100603CB0);
v8 = 0;
*(_OWORD *)v52 = 0;
*(_OWORD *)v51 = 0;
v53 = 1065353216;
*(_WORD *)&a1->__r_.__value_.__l.0 = 0;
v9 = *(unsigned int **)(a3 + 56);
v10 = *v9;
if ( !*v9 )
goto LABEL_67;
}
v58 = a1;
v11 = *((_DWORD ***)v9 + 2);
v12 = (unsigned __int64)&v11[v10 - 1];
do
{
v13 = *v11;
if ( !*v11 )
break;
v14 = v13[257];
if ( v14 != 749 )
{
if ( v14 == 3032 )
++v13[465];
(*(void (__fastcall **)(std::string::value_type *, _DWORD *, _QWORD))(*(_QWORD *)v13 + 1392LL))(
__s,
v13,
*(_QWORD *)(v56 + 1440));
if ( (__s[0] & 1) != 0 )
{
v15 = (const std::string::value_type *)__p;
v16 = v60;
}
else
{
v16 = (unsigned __int8)__s[0] >> 1;
v15 = &__s[1];
}
std::string::append(a1, v15, v16);
std::string::append(a1, ";");
if ( v13[257] == 3032 )
--v13[465];
if ( a4 )
{
MainColorMode = GameObject::getMainColorMode(v13);
if ( (unsigned int)(MainColorMode - 1) <= 0x3E6 )
sub_10001B800((float *)v51, &MainColorMode, &MainColorMode, v8);
SecondaryColorMode = GameObject::getSecondaryColorMode(v13, *(double *)v8.i64);
if ( (unsigned int)(SecondaryColorMode - 1) <= 0x3E6 )
sub_10001B800((float *)v51, &SecondaryColorMode, &SecondaryColorMode, v8);
}
if ( (__s[0] & 1) != 0 )
operator delete(__p);
}
++v11;
}
while ( (unsigned __int64)v11 <= v12 );
v7 = v58;
if ( a4 && v52[1] )
{
*(_QWORD *)__s = 0;
v60 = 500;
__p = v62;
v17 = (__int64 **)v52[0];
if ( v52[0] )
{
v18 = *((_DWORD *)v52[0] + 4);
ColorAction = GJEffectManager::getColorAction(
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v56 + 1440) + 3272LL) + 320LL),
v18);
sub_100032CB0((__int64)__s, v18);
v20 = *(_QWORD *)__s;
v21 = *(_QWORD *)__s + 1LL;
if ( v60 >= *(_QWORD *)__s + 1LL )
{
v24 = __p;
}
else
{
v22 = v60 + (v60 >> 1);
if ( v22 <= v21 )
v22 = *(_QWORD *)__s + 1LL;
v60 = v22;
v23 = operator new[](v22);
v24 = v23;
v57 = ColorAction;
v25 = __p;
if ( v20 )
memmove(v23, __p, v20);
if ( v25 != v62 && v25 != nullptr )
operator delete[](v25);
__p = v24;
ColorAction = v57;
}
*(_QWORD *)__s = v21;
*((_BYTE *)v24 + v20) = 44;
sub_1002C46A0((__int64)ColorAction, (__int64)__s);
for ( i = *v17; i; i = (__int64 *)*i )
{
v27 = *((_DWORD *)i + 4);
v57 = GJEffectManager::getColorAction(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v56 + 1440) + 3272LL) + 320LL), v27);
v28 = *(_QWORD *)__s;
v29 = *(_QWORD *)__s + 1LL;
if ( v60 >= *(_QWORD *)__s + 1LL )
{
v32 = __p;
}
else
{
v30 = v60 + (v60 >> 1);
if ( v30 <= v29 )
v30 = *(_QWORD *)__s + 1LL;
v60 = v30;
v31 = operator new[](v30);
v32 = v31;
v50 = i;
v33 = __p;
if ( v28 )
memmove(v31, __p, v28);
if ( v33 != v62 && v33 != nullptr )
operator delete[](v33);
__p = v32;
i = v50;
}
*(_QWORD *)__s = v29;
*((_BYTE *)v32 + v28) = 124;
sub_100032CB0((__int64)__s, v27);
v34 = *(_QWORD *)__s;
v35 = *(_QWORD *)__s + 1LL;
if ( v60 >= *(_QWORD *)__s + 1LL )
{
v38 = __p;
}
else
{
v36 = v60 + (v60 >> 1);
if ( v36 <= v35 )
v36 = *(_QWORD *)__s + 1LL;
v60 = v36;
v37 = operator new[](v36);
v38 = v37;
v39 = i;
v40 = __p;
if ( v34 )
memmove(v37, __p, v34);
if ( v40 != v62 && v40 != nullptr )
operator delete[](v40);
__p = v38;
i = v39;
}
*(_QWORD *)__s = v35;
*((_BYTE *)v38 + v34) = 44;
sub_1002C46A0((__int64)v57, (__int64)__s);
}
}
v7 = v58;
std::string::append(v58, "#");
v41 = *(_QWORD *)__s;
if ( v60 >= *(_QWORD *)__s + 1LL )
{
v44 = __p;
}
else
{
v42 = v60 + (v60 >> 1);
if ( v42 <= *(_QWORD *)__s + 1LL )
v42 = *(_QWORD *)__s + 1LL;
v60 = v42;
v43 = operator new[](v42);
v44 = v43;
v45 = __p;
if ( v41 )
memmove(v43, __p, v41);
if ( v45 != v62 && v45 != nullptr )
operator delete[](v45);
__p = v44;
}
*((_BYTE *)v44 + v41) = 0;
std::string::append(v7, (const std::string::value_type *)__p);
if ( __p != v62 && __p != nullptr )
operator delete[](__p);
}
LABEL_67:
v46 = v52[0];
if ( v52[0] )
{
do
{
v47 = (_QWORD *)*v46;
operator delete(v46);
v46 = v47;
}
while ( v47 );
}
v48 = v51[0];
v51[0] = nullptr;
if ( v48 )
operator delete(v48);
return v7;
}