//
// EditorUI::onDuplicate from 0xbda9d0 to 0xbdabd4 (516 bytes)
//
// 5 xrefs:
// > EditorUI::startFreeMoveTouch @ 0xbd5014
// > EditorUI::handleEditorAction @ 0xbd8440
// > ??> @ 0x85b10
// > EditorUI::init @ 0x7d01d4
// > ??> @ 0x15437e0
//
// 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:43 +0000
//
__int64 __fastcall EditorUI::onDuplicate(EditorUI *this, cocos2d::CCObject *a2)
{
EditorSFXManager *v3; // x0
EditorSFXManager *v4; // x0
int v5; // w19
int v6; // w0
cocos2d::CCArray *v7; // x0
cocos2d::CCArray *v8; // x22
char v9; // w1
__int64 v10; // x0
__int64 v12; // x0
__int64 v13; // [xsp+38h] [xbp+38h] BYREF
size_t v14; // [xsp+40h] [xbp+40h]
void *v15; // [xsp+48h] [xbp+48h]
__int64 v16; // [xsp+50h] [xbp+50h] BYREF
size_t v17; // [xsp+58h] [xbp+58h]
void *v18; // [xsp+60h] [xbp+60h]
v3 = *((EditorSFXManager **)this + 187);
if ( !v3 )
{
v3 = (EditorSFXManager *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112));
if ( !(_DWORD)v3 )
return _stack_chk_guard;
}
v4 = (EditorSFXManager *)EditorSFXManager::sharedState(v3);
EditorSFXManager::playAction(v4, 103);
v5 = *(_DWORD *)(*((_QWORD *)this + 180) + 14272LL) - *(_DWORD *)(*((_QWORD *)this + 180) + 14276LL);
v6 = cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112)) + v5;
if ( v6 > 80000 )
{
v12 = *((_QWORD *)this + 180);
if ( !*(_BYTE *)(*(_QWORD *)(v12 + 1936) + 1201LL) )
{
EditorUI::showMaxError(this);
return _stack_chk_guard;
}
goto LABEL_16;
}
if ( v6 > 40000 )
{
v12 = *((_QWORD *)this + 180);
LABEL_16:
if ( !*(_BYTE *)(*(_QWORD *)(v12 + 1936) + 1200LL) )
{
EditorUI::showMaxBasicError(this);
return _stack_chk_guard;
}
}
v7 = (cocos2d::CCArray *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112));
if ( (_DWORD)v7 )
{
v8 = *((cocos2d::CCArray **)this + 112);
}
else
{
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
cocos2d::CCArray::addObject(v8, *((cocos2d::CCObject **)this + 187));
}
EditorUI::copyObjects(&v13, this, v8, 0, 0);
v16 = 0;
v9 = v13;
v10 = *((_QWORD *)this + 180) + 12288LL;
v17 = 0;
v18 = nullptr;
*(_BYTE *)(v10 + 1864) = 1;
if ( (v9 & 1) != 0 )
{
std::string::__init(&v16, v15, v14);
}
else
{
v18 = v15;
v16 = v13;
v17 = v14;
}
EditorUI::pasteObjects((__int64)this, (__int64)&v16, 0, 0);
if ( (v16 & 1) != 0 )
operator delete(v18);
*(_BYTE *)(*((_QWORD *)this + 180) + 14152LL) = 0;
EditorBuildStats::noteAction(*((_QWORD *)this + 180) + 14704LL);
EditorUI::updateButtons(this);
EditorUI::updateObjectInfoLabel(this);
if ( (v13 & 1) != 0 )
operator delete(v15);
return _stack_chk_guard;
}