//
// EditorUI::doPasteObjects from 0x10018aac4 to 0x10018acb4 (496 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0x100162c5c
// > EditorUI::onPaste @ 0x10018aaac
// > EditorCommandsPopup::onCommand @ 0x1004c5b9c
//
// 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 10:59:52 +0000
//
__int64 __fastcall EditorUI::doPasteObjects(__int64 a1, int a2)
{
__int64 result; // x0
int v5; // w21
__int64 v6; // x0
int v7; // w8
__int64 v8; // x8
__int64 v9; // x0
__int64 v10; // x20
__int64 v11; // x0
__int64 v12; // x0
__int64 v13; // x21
__n128 v14; // q0
double v15; // d0
double v16; // d0
__int64 v17; // [xsp+0h] [xbp-60h] BYREF
__int64 v18; // [xsp+8h] [xbp-58h] BYREF
__int64 v19; // [xsp+10h] [xbp-50h] BYREF
__int64 v20; // [xsp+18h] [xbp-48h] BYREF
void *__p[2]; // [xsp+20h] [xbp-40h] BYREF
__int64 v22; // [xsp+30h] [xbp-30h]
result = GameManager::sharedState(a1);
if ( (*(char *)(result + 535) & 0x8000000000000000LL) != 0 )
{
if ( !*(_QWORD *)(result + 520) )
return result;
}
else if ( !*(_BYTE *)(result + 535) )
{
return result;
}
v5 = *(_DWORD *)(*(_QWORD *)(a1 + 1440) + 14272LL) - *(_DWORD *)(*(_QWORD *)(a1 + 1440) + 14276LL);
v6 = GameManager::sharedState(result);
v7 = *(_DWORD *)(v6 + 536) + v5;
if ( v7 >= 80001 )
{
v8 = *(_QWORD *)(*(_QWORD *)(a1 + 1440) + 1936LL);
if ( (*(_BYTE *)(v8 + 1201) & 1) == 0 )
return EditorUI::showMaxError(a1);
LABEL_10:
if ( (*(_BYTE *)(v8 + 1200) & 1) == 0 )
return EditorUI::showMaxBasicError(a1);
goto LABEL_11;
}
if ( v7 >= 40001 )
{
v8 = *(_QWORD *)(*(_QWORD *)(a1 + 1440) + 1936LL);
goto LABEL_10;
}
LABEL_11:
v9 = GameManager::sharedState(v6);
if ( *(char *)(v9 + 535) < 0 )
{
sub_1000097D0(__p, *(void **)(v9 + 512), *(_QWORD *)(v9 + 520));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v9 + 512);
v22 = *(_QWORD *)(v9 + 528);
}
v10 = EditorUI::pasteObjects((_QWORD *)a1, (char *)__p, a2, 0);
if ( SHIBYTE(v22) < 0 )
operator delete(__p[0]);
EditorBuildStats::noteAction(*(_QWORD *)(a1 + 1440) + 14704LL);
if ( v10 )
{
v11 = sub_1002E757C(v10);
if ( (_DWORD)v11 )
{
v12 = cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize(&v20, v12);
v13 = *(_QWORD *)(*(_QWORD *)(a1 + 1440) + 3920LL);
sub_1000262BC(
(float *)&v18,
*(float *)&v20 * 0.5,
(float)(*((float *)&v20 + 1) * 0.5) + (float)(*(float *)(a1 + 856) * 0.5));
cocos2d::CCNode::convertToNodeSpace(&v19, v13, &v18, v14);
v15 = sub_1000262F4(&v17, (double *)&v19);
EditorUI::getGridSnappedPos(&v18, a1, &v17, v15);
sub_10002630C(&v19, (double *)&v18);
v16 = sub_1000262F4(&v18, (double *)&v19);
EditorUI::repositionObjectsToCenter(a1, v10, &v18, 0, v16);
}
}
EditorUI::updateButtons(a1);
return EditorUI::updateObjectInfoLabel(a1);
}