//
// EditorUI::onDelete from 0x7d17b0 to 0x7d1b84 (980 bytes)
//
// 2 xrefs:
// > EditorUI::clickOnPosition @ 0x7d1c38
// > ??> @ 0x9f1c0
//
// 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 12:54:16 +0000
//
__int64 __fastcall EditorUI::onDelete(EditorUI *this, cocos2d::CCObject *a2)
{
__int64 v3; // x21
cocos2d::CCArray *v4; // x22
int v5; // w19
int v6; // w23
cocos2d::CCObject *CycledObject; // x21
_BOOL4 v8; // w23
cocos2d::CCDictionary *v9; // x25
__int64 v10; // x0
unsigned int *v11; // x1
cocos2d::CCObject **v12; // x19
__int64 v13; // x0
char *v14; // x22
cocos2d::CCObject *v15; // x21
int v16; // w1
cocos2d::CCDictionary *v17; // x0
unsigned int v18; // w25
cocos2d::CCArray *v19; // x26
unsigned int v20; // w19
__int64 v21; // x0
cocos2d::CCArray *StickyGroup; // x0
cocos2d::CCArray *v23; // x21
cocos2d::CCObject *v24; // x22
EditorSFXManager *v25; // x0
cocos2d::CCArray *v26; // x0
unsigned int *v27; // x2
GameObject **v28; // x19
GameObject **v29; // x21
GameObject *v30; // x1
UndoObject *v31; // x0
EditorSFXManager *v33; // x0
__int64 v34; // x0
unsigned int v35; // w19
int v36; // w25
cocos2d::CCObject *v37; // x21
float v38; // [xsp+50h] [xbp+50h] BYREF
v3 = *((_QWORD *)this + 180);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, (EditorUI *)((char *)this + 1488));
v4 = LevelEditorLayer::objectsAtPosition(v3, &v38);
if ( !*((_BYTE *)this + 860)
|| (v34 = cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)*((unsigned __int8 *)this + 860)),
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v34 + 192LL))(v34) + 128)) )
{
v5 = 0;
v6 = cocos2d::CCArray::count(v4);
if ( v6 > 0 )
{
do
{
CycledObject = (cocos2d::CCObject *)EditorUI::getCycledObject(this, v4, 1u);
if ( !CycledObject )
break;
if ( EditorUI::shouldDeleteObject(this, CycledObject) )
{
if ( *((_DWORD *)CycledObject + 257) == 747 )
EditorUI::deselectTargetPortals(this);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 171), CycledObject);
v8 = *((_DWORD *)CycledObject + 218) > 0;
goto LABEL_8;
}
++v5;
}
while ( v6 != v5 );
}
v8 = 0;
}
else
{
v35 = 0;
v36 = 0;
v8 = 0;
while ( v35 < (unsigned int)cocos2d::CCArray::count(v4) )
{
v37 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v4, v35);
if ( EditorUI::shouldDeleteObject(this, v37) )
{
if ( !v36 && *((_DWORD *)v37 + 257) == 747 )
{
v36 = 1;
EditorUI::deselectTargetPortals(this);
}
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 171), v37);
if ( !v8 )
v8 = *((_DWORD *)v37 + 218) > 0;
}
++v35;
}
}
LABEL_8:
if ( !*((_BYTE *)this + 867) || *((_BYTE *)this + 868) )
{
v8 = 0;
v25 = (EditorSFXManager *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 171));
if ( !(_DWORD)v25 )
goto LABEL_27;
goto LABEL_38;
}
if ( v8 )
{
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create((cocos2d::CCDictionary *)*((unsigned __int8 *)this + 868));
v10 = *((_QWORD *)this + 171);
if ( v10 )
{
v11 = *(unsigned int **)(v10 + 56);
if ( *v11 )
{
v12 = *((cocos2d::CCObject ***)v11 + 2);
v13 = 8LL * *v11 - 8;
v14 = (char *)v12 + v13;
if ( v12 <= (cocos2d::CCObject **)((char *)v12 + v13) )
{
do
{
v15 = *v12;
if ( !*v12 )
break;
v16 = *((_DWORD *)v15 + 218);
if ( v16 > 0 && !cocos2d::CCDictionary::objectForKey(v9, v16) )
cocos2d::CCDictionary::setObject(v9, v15, *((int *)v15 + 218));
++v12;
}
while ( v14 >= (char *)v12 );
}
}
}
v17 = v9;
v18 = 0;
v19 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v17);
if ( (unsigned int)cocos2d::CCArray::count(v19) )
{
do
{
v20 = 0;
v21 = cocos2d::CCArray::objectAtIndex(v19, v18);
StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(
*((GJBaseGameLayer **)this + 180),
*(_DWORD *)(v21 + 56));
v23 = StickyGroup;
if ( StickyGroup && (unsigned int)cocos2d::CCArray::count(StickyGroup) )
{
do
{
v24 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v23, v20++);
if ( !(unsigned __int8)cocos2d::CCArray::containsObject(*((cocos2d::CCArray **)this + 171), v24) )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 171), v24);
}
while ( v20 < (unsigned int)cocos2d::CCArray::count(v23) );
}
++v18;
}
while ( v18 < (unsigned int)cocos2d::CCArray::count(v19) );
}
}
v25 = (EditorSFXManager *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 171));
if ( (_DWORD)v25 )
{
LABEL_38:
v33 = (EditorSFXManager *)EditorSFXManager::sharedState(v25);
EditorSFXManager::playAction(v33, 101);
if ( !*((_BYTE *)this + 708) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_QWORD *)this + 180) + 14704LL));
*((_BYTE *)this + 708) = 1;
}
LABEL_27:
v26 = *((cocos2d::CCArray **)this + 171);
if ( v26 )
{
v27 = *((unsigned int **)v26 + 7);
if ( *v27 )
{
v28 = *((GameObject ***)v27 + 2);
v29 = &v28[*v27 - 1];
if ( v28 <= v29 )
{
v30 = *v28;
if ( *v28 )
{
do
{
++v28;
EditorUI::deleteObject(this, v30, v8);
if ( v29 < v28 )
break;
v30 = *v28;
}
while ( *v28 );
v26 = *((cocos2d::CCArray **)this + 171);
}
}
}
}
if ( v8 )
{
*(_DWORD *)(*((_QWORD *)this + 180) + 14712LL) += cocos2d::CCArray::count(v26);
v31 = (UndoObject *)UndoObject::createWithArray(*((cocos2d::CCArray **)this + 171), 4);
LevelEditorLayer::addToUndoList(*((cocos2d::CCArray ***)this + 180), v31, 0);
v26 = *((cocos2d::CCArray **)this + 171);
}
cocos2d::CCArray::removeAllObjects(v26);
EditorUI::updateSpecialUIElements((cocos2d::CCArray **)this);
return _stack_chk_guard;
}