//
// EditorUI::onDuplicate from 0x1005b5da0 to 0x1005b5f3a (410 bytes)
//
// 3 xrefs:
// > EditorUI::startFreeMoveTouch @ 0x10060998e
// > EditorUI::handleEditorAction @ 0x10060c6a2
// > EditorUI::init @ 0x100006a9e
//
// 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
//
void __fastcall EditorUI::onDuplicate(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 v2; // rax
int v3; // r14d
int v4; // eax
__int64 v5; // rax
__int64 v6; // rdi
__int64 v7; // r14
__int64 v8; // rdi
__int64 v9; // rdx
__int128 v10; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
__int128 v12; // [rsp+18h] [rbp-28h] BYREF
void *v13; // [rsp+28h] [rbp-18h]
v1 = a1;
if ( !a1[187] )
{
a1 = (_QWORD *)a1[112];
if ( !(unsigned int)sub_1007FEF90(a1) )
return;
}
v2 = EditorSFXManager::sharedState(a1);
EditorSFXManager::playAction_1(v2, 103);
v3 = *(_DWORD *)(v1[180] + 14272LL) - *(_DWORD *)(v1[180] + 14276LL);
v4 = v3 + sub_1007FEF90(v1[112]);
if ( v4 >= 80001 )
{
v5 = *(_QWORD *)(v1[180] + 1936LL);
if ( !*(_BYTE *)(v5 + 1201) )
{
EditorUI::showMaxError((__int64)v1);
return;
}
LABEL_8:
if ( !*(_BYTE *)(v5 + 1200) )
{
EditorUI::showMaxBasicError((__int64)v1);
return;
}
goto LABEL_9;
}
if ( v4 >= 40001 )
{
v5 = *(_QWORD *)(v1[180] + 1936LL);
goto LABEL_8;
}
LABEL_9:
v6 = v1[112];
if ( (unsigned int)sub_1007FEF90(v6) )
{
v7 = v1[112];
}
else
{
v7 = sub_1007FE900(v6);
sub_1007FEBF0(v7, v1[187]);
}
EditorUI::copyObjects(&v12, v1, v7, 0, 0);
*(_BYTE *)(v1[180] + 14152LL) = 1;
if ( (v12 & 1) != 0 )
{
sub_10001AD30(&v10, v13, *((unsigned __int64 *)&v12 + 1));
}
else
{
__p = v13;
v10 = v12;
}
EditorUI::pasteObjects(v1, &v10, 0, 0);
if ( (v10 & 1) != 0 )
operator delete(__p);
v8 = v1[180];
*(_BYTE *)(v8 + 14152) = 0;
EditorBuildStats::noteAction(v8 + 14704);
EditorUI::updateButtons((__int64)v1);
EditorUI::updateObjectInfoLabel((__int64)v1, (__int64)&v10, v9);
if ( (v12 & 1) != 0 )
operator delete(v13);
}