//
// EditorUI::doPasteObjects from 0xbd9e30 to 0xbda078 (584 bytes)
//
// 4 xrefs:
// > EditorUI::handleEditorAction @ 0xbd762c
// > EditorUI::onPaste @ 0xbda0cc
// > EditorCommandsPopup::onCommand @ 0xcbc130
// > ??> @ 0x70138
//
// 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 __fastcall EditorUI::doPasteObjects(EditorUI *this, unsigned __int8 a2)
{
__int64 v4; // x2
__int64 v5; // x1
__int64 v7; // x1
GameManager *v8; // x0
int v9; // w22
unsigned __int64 v10; // x0
__int64 v11; // x0
__int64 v12; // x2
char v13; // w0
__int64 v14; // x0
__int64 v15; // x1
cocos2d::CCArray *v16; // x22
cocos2d::CCDirector *v17; // x0
cocos2d::CCDirector *v18; // x0
cocos2d::CCNode *v19; // x25
__int64 v20; // [xsp+50h] [xbp+50h] BYREF
__int64 v21; // [xsp+58h] [xbp+58h] BYREF
float v22; // [xsp+60h] [xbp+60h] BYREF
_BYTE v23[8]; // [xsp+68h] [xbp+68h] BYREF
__int64 v24; // [xsp+70h] [xbp+70h] BYREF
__int64 v25; // [xsp+78h] [xbp+78h]
void *v26; // [xsp+80h] [xbp+80h]
v4 = GameManager::sharedState(_stack_chk_guard) + 512;
v5 = *(_BYTE *)v4 >> 1;
if ( (*(_BYTE *)v4 & 1) != 0 )
v5 = *(_QWORD *)(v4 + 8);
if ( v5 )
{
v7 = *((_QWORD *)this + 180);
v8 = (GameManager *)*(unsigned int *)(v7 + 14272);
v9 = (_DWORD)v8 - *(_DWORD *)(v7 + 14276);
v10 = (unsigned int)(v9 + *(_DWORD *)(GameManager::sharedState(v8) + 536));
if ( (int)v10 <= 80000 )
{
if ( (int)v10 <= 40000 )
{
LABEL_9:
v12 = GameManager::sharedState((GameManager *)v10) + 512;
v13 = *(_BYTE *)v12;
v24 = 0;
v25 = 0;
v26 = nullptr;
if ( (v13 & 1) != 0 )
{
std::string::__init(&v24, *(void **)(v12 + 16), *(_QWORD *)(v12 + 8));
}
else
{
v14 = *(_QWORD *)v12;
v15 = *(_QWORD *)(v12 + 8);
v26 = *(void **)(v12 + 16);
v24 = v14;
v25 = v15;
}
v16 = EditorUI::pasteObjects((__int64)this, (__int64)&v24, a2, 0);
if ( (v24 & 1) != 0 )
operator delete(v26);
EditorBuildStats::noteAction(*((_QWORD *)this + 180) + 14704LL);
if ( v16 )
{
v17 = (cocos2d::CCDirector *)cocos2d::CCArray::count(v16);
if ( (_DWORD)v17 )
{
v18 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v17);
cocos2d::CCDirector::getWinSize(&v20, v18);
v19 = *(cocos2d::CCNode **)(*((_QWORD *)this + 180) + 3920LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v23,
*(float *)&v20 * 0.5,
(float)(*((float *)this + 214) * 0.5) + (float)(*((float *)&v20 + 1) * 0.5));
cocos2d::CCNode::convertToNodeSpace(&v21, v19, (const cocos2d::CCPoint *)v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, (const cocos2d::CCPoint *)&v21);
EditorUI::getGridSnappedPos((__int64)this, &v22, (__int64)v23);
cocos2d::CCPoint::operator=(&v21, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&v21);
EditorUI::repositionObjectsToCenter(this, v16, (__int64)v23, 0);
}
}
EditorUI::updateButtons(this);
EditorUI::updateObjectInfoLabel(this);
return _stack_chk_guard;
}
v11 = *((_QWORD *)this + 180);
}
else
{
v11 = *((_QWORD *)this + 180);
if ( !*(_BYTE *)(*(_QWORD *)(v11 + 1936) + 1201LL) )
{
EditorUI::showMaxError(this);
return _stack_chk_guard;
}
}
v10 = *(unsigned __int8 *)(*(_QWORD *)(v11 + 1936) + 1200LL);
if ( !(_DWORD)v10 )
{
EditorUI::showMaxBasicError(this);
return _stack_chk_guard;
}
goto LABEL_9;
}
return _stack_chk_guard;
}