//
// EditorUI::onDeleteSelected from 0x1401b0990 to 0x1401b0e52 (1218 bytes)
//
// 4 xrefs:
// > EditorUI::handleEditorAction @ 0x1401c2582
// > EditorUI::init @ 0x1401aaa2a
// > EditorUI::setupDeleteMenu @ 0x1401f43ef
// > ??> @ 0x140919ee0
//
// 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 11:27:55 +0000
//
// Hidden C++ exception states: #wind=6
__int64 __fastcall EditorUI::onDeleteSelected(__int64 a1)
{
__int64 v2; // rcx
__int64 v3; // rax
__int64 v4; // r8
__int64 v5; // rcx
int v6; // eax
char v7; // r15
cocos2d::CCArray *v8; // rbp
unsigned int i; // edi
struct cocos2d::CCObject *v10; // rsi
__int64 v11; // rcx
unsigned int j; // r12d
struct cocos2d::CCObject *v13; // rax
struct cocos2d::CCObject *v14; // rsi
__int64 v15; // rdi
cocos2d::CCObject **v16; // rdi
__int64 v17; // rcx
cocos2d::CCArray *v18; // rax
__int64 v19; // rsi
unsigned int v20; // r14d
_BYTE **v21; // rdi
_DWORD *v22; // rdx
__int64 v23; // rdx
int v24; // ecx
int v25; // eax
int v26; // ecx
_BYTE *v27; // rsi
__int64 v28; // rbp
cocos2d::CCObject *v29; // r15
cocos2d::CCObject *v30; // rax
unsigned int v31; // r14d
__int64 v32; // rdx
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
v3 = EditorSFXManager::sharedState();
EditorSFXManager::playAction(v3, 102);
v4 = *(_QWORD *)(a1 + 1512) + 15408LL;
v5 = *(unsigned int *)(*(_QWORD *)(a1 + 1512) + 15504LL);
if ( (int)v5 >= 0 )
{
v6 = *(_DWORD *)(*(_QWORD *)(a1 + 1512) + 15440LL) - v5;
v5 = 0;
if ( v6 > 1 )
{
do
{
if ( (int)v5 >= 7 )
break;
v6 = (unsigned int)v6 >> 1;
v5 = (unsigned int)(v5 + 1);
}
while ( (unsigned int)v6 > 1 );
}
++*(_DWORD *)(v4 + 4LL * (int)v5 + 64);
}
*(_DWORD *)(v4 + 96) = *(_DWORD *)(v4 + 32);
v7 = 0;
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)); ++i )
{
v10 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 944), i);
if ( EditorUI::shouldDeleteObject(v11, v10) )
cocos2d::CCArray::addObject(v8, v10);
}
for ( j = 0; j < cocos2d::CCArray::count(v8); ++j )
{
v13 = cocos2d::CCArray::objectAtIndex(v8, j);
v14 = v13;
if ( *((_DWORD *)v13 + 259) == 747 )
v7 = 1;
*((_BYTE *)v13 + 1140) = *((_BYTE *)v13 + 1141);
EditorUI::deselectObject(a1, v13);
v15 = *(_QWORD *)(a1 + 1512);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v14 + 1160LL))(v14, 1);
GJBaseGameLayer::removeObjectFromSection(v15, v14);
LevelEditorLayer::removeSpecial(v15, v14);
*(_BYTE *)(v15 + 15666) = 1;
EditorUI::deactivateRotationControl(a1);
EditorUI::deactivateScaleControl(a1);
EditorUI::deactivateTransformControl(a1);
}
*(_DWORD *)(*(_QWORD *)(a1 + 1512) + 15416LL) += cocos2d::CCArray::count(v8);
v16 = (cocos2d::CCObject **)operator new(0xA0u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v16);
*v16 = (cocos2d::CCObject *)&UndoObject::`vftable';
v16[7] = nullptr;
*((_DWORD *)v16 + 16) = 0;
v16[9] = nullptr;
*((_WORD *)v16 + 40) = 0;
GJTransformState::GJTransformState((__int64)v16 + 84);
if ( v8 )
{
v18 = (cocos2d::CCArray *)cocos2d::CCArray::create(v17);
v16[9] = v18;
cocos2d::CCArray::addObjectsFromArray(v18, v8);
cocos2d::CCObject::retain(v16[9]);
}
*((_DWORD *)v16 + 16) = 4;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v16);
v19 = *(_QWORD *)(a1 + 1512);
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v19 + 14920));
v20 = 1000;
if ( !*(_BYTE *)(v19 + 14663) )
v20 = 200;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v19 + 14912)) >= v20 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(v19 + 14912), 0, 1);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v19 + 14912), (struct cocos2d::CCObject *)v16);
if ( v7 )
EditorUI::deselectTargetPortals(a1);
v21 = (_BYTE **)(a1 + 1568);
}
else
{
v21 = (_BYTE **)(a1 + 1568);
v22 = *(_DWORD **)(a1 + 1568);
if ( v22 && EditorUI::shouldDeleteObject(v2, v22) )
{
v23 = *(_QWORD *)(a1 + 1512) + 15408LL;
v24 = *(_DWORD *)(*(_QWORD *)(a1 + 1512) + 15504LL);
if ( v24 >= 0 )
{
v25 = *(_DWORD *)(*(_QWORD *)(a1 + 1512) + 15440LL) - v24;
v26 = 0;
if ( v25 > 1 )
{
do
{
if ( v26 >= 7 )
break;
v25 = (unsigned int)v25 >> 1;
++v26;
}
while ( (unsigned int)v25 > 1 );
}
++*(_DWORD *)(v23 + 4LL * v26 + 64);
v21 = (_BYTE **)(a1 + 1568);
}
*(_DWORD *)(v23 + 96) = *(_DWORD *)(v23 + 32);
v27 = *v21;
if ( *v21 )
{
v27[1140] = v27[1141];
EditorUI::deselectObject(a1, v27);
v28 = *(_QWORD *)(a1 + 1512);
++*(_DWORD *)(v28 + 15416);
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v28 + 14920));
v29 = (cocos2d::CCObject *)operator new(0xA0u);
cocos2d::CCObject::CCObject(v29);
*(_QWORD *)v29 = &UndoObject::`vftable';
*((_QWORD *)v29 + 7) = 0;
*((_DWORD *)v29 + 16) = 0;
*((_QWORD *)v29 + 9) = 0;
*((_WORD *)v29 + 40) = 0;
GJTransformState::GJTransformState((__int64)v29 + 84);
v30 = (cocos2d::CCObject *)GameObjectCopy::create(v27);
*((_QWORD *)v29 + 7) = v30;
cocos2d::CCObject::retain(v30);
*((_DWORD *)v29 + 16) = 1;
cocos2d::CCObject::autorelease(v29);
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v28 + 14920));
v31 = 1000;
if ( !*(_BYTE *)(v28 + 14663) )
v31 = 200;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v28 + 14912)) >= v31 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(v28 + 14912), 0, 1);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v28 + 14912), v29);
LOBYTE(v32) = 1;
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v27 + 1160LL))(v27, v32);
GJBaseGameLayer::removeObjectFromSection(v28, v27);
LevelEditorLayer::removeSpecial(v28, v27);
*(_BYTE *)(v28 + 15666) = 1;
EditorUI::deactivateRotationControl(a1);
EditorUI::deactivateScaleControl(a1);
EditorUI::deactivateTransformControl(a1);
}
}
}
if ( !*v21 && !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
EditorUI::deactivateRotationControl(a1);
EditorUI::deactivateScaleControl(a1);
EditorUI::deactivateTransformControl(a1);
}
EditorUI::updateObjectInfoLabel(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a1 + 432) + 40LL))(a1 + 432);
return EditorUI::updateButtons(a1);
}