//
// LevelEditorLayer::handleAction from 0x46eedc to 0x46f418 (1340 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::redoLastAction @ 0x46f452
// > LevelEditorLayer::undoLastAction @ 0x46f488
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:03 +0000
//
int __fastcall LevelEditorLayer::handleAction(EditorUI **this, int a2, cocos2d::CCArray *a3)
{
int result; // r0
int Object; // r5
cocos2d::CCArray *v7; // r0
GameObject *v8; // r6
cocos2d::CCObject *v9; // r1
EditorUI *v10; // r7
cocos2d::CCArray *v11; // r0
GameObject *v12; // r6
cocos2d::CCArray *v13; // r8
unsigned int v14; // r9
GameObject *v15; // r0
GameObject *v16; // r6
cocos2d::CCArray *v17; // r0
cocos2d::CCArray *v18; // r8
unsigned int v19; // r6
cocos2d::CCArray *v20; // r7
GameObject *v21; // r9
cocos2d::CCArray *v22; // r7
unsigned int v23; // r6
cocos2d::CCArray *v24; // r8
GameObject **v25; // r0
GameObject **v26; // r9
GameObject *v27; // r1
int *v28; // r0
UndoObject *v29; // r9
cocos2d::CCArray *SelectedObjects; // r7
int *TransformState; // r0
float *v32; // r7
int v33; // r8
const cocos2d::CCPoint *v34; // r0
const cocos2d::CCPoint *v35; // r6
int *v36; // r2
int v37; // r3
int *v38; // r2
_DWORD *v39; // r12
int *v40; // r3
int *v41; // r3
int v42; // r8
int v43; // t1
int v44; // r6
GJRotationControl *v45; // r0
int v46; // r0
float *v47; // r11
float v48; // r0
float v49; // s14
float v50; // s13
float v51; // s15
float v52; // s12
int v54; // [sp+14h] [bp-38h]
unsigned int v55; // [sp+18h] [bp-34h]
_DWORD *v56; // [sp+20h] [bp-2Ch]
int *v57; // [sp+24h] [bp-28h]
_BYTE v58[8]; // [sp+2Ch] [bp-20h] BYREF
_BYTE v59[8]; // [sp+34h] [bp-18h] BYREF
unsigned int v60[2]; // [sp+3Ch] [bp-10h] BYREF
result = cocos2d::CCArray::count(a3);
if ( result )
{
Object = cocos2d::CCArray::lastObject(a3);
cocos2d::CCObject::retain((cocos2d::CCObject *)Object);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::removeLastObject(a3, 1);
if ( a2 )
{
LABEL_4:
switch ( *(_DWORD *)(Object + 56) )
{
case 1:
goto LABEL_5;
case 2:
goto LABEL_8;
case 3:
goto LABEL_9;
case 4:
goto LABEL_12;
case 5:
v22 = *(cocos2d::CCArray **)(Object + 60);
if ( v22 )
{
v23 = 0;
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
while ( v23 < cocos2d::CCArray::count(v22) )
{
v25 = (GameObject **)cocos2d::CCArray::objectAtIndex(v22, v23++);
v26 = v25;
v28 = GameObjectCopy::create(v25[13], v27);
cocos2d::CCArray::addObject(v24, (cocos2d::CCObject *)v28);
GameObjectCopy::resetObject((GameObjectCopy *)v26);
GJBaseGameLayer::reorderObjectSection((GJBaseGameLayer *)this, v26[13]);
}
v29 = UndoObject::createWithArray(v24, 5);
}
else
{
v29 = UndoObject::create(*(GameObjectCopy **)(*(_DWORD *)(Object + 52) + 52), 5);
GameObjectCopy::resetObject(*(GameObjectCopy **)(Object + 52));
GJBaseGameLayer::reorderObjectSection(
(GJBaseGameLayer *)this,
*(GameObject **)(*(_DWORD *)(Object + 52) + 52));
}
if ( *(_BYTE *)(Object + 65)
&& (*(int (__fastcall **)(_DWORD))(**((_DWORD **)*(this + 2964) + 149) + 176))(*((_DWORD *)*(this + 2964)
+ 149)) )
{
TransformState = (int *)EditorUI::getTransformState(*(this + 2964));
GJTransformState::operator=((int)v29 + 68, TransformState);
*((_BYTE *)v29 + 65) = 1;
GJTransformState::operator=((int)*(this + 2964) + 364, (int *)(Object + 68));
GJTransformControl::loadFromState(*((_DWORD *)*(this + 2964) + 149), Object + 68);
v32 = (float *)*(this + 2964);
v33 = *(_DWORD *)(*((_DWORD *)v32 + 149) + 324);
if ( v33 )
{
v54 = (*(int (__fastcall **)(_DWORD))(*(_DWORD *)*(this + 609) + 84))(*(this + 609));
v34 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)*(this + 609) + 96))(*(this + 609));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, v34);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 609) + 80))(*(this + 609), 1065353216);
(*(void (__fastcall **)(_DWORD, float *))(*(_DWORD *)*(this + 609) + 92))(*(this + 609), &flt_D2B8B8);
v35 = *((const cocos2d::CCPoint **)*(this + 2964) + 150);
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD *))(*(_DWORD *)v35 + 92))(
v35,
(_DWORD *)v32 + 101);
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 64))(
v35,
*((_DWORD *)v32 + 91));
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 72))(
v35,
*((_DWORD *)v32 + 92));
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 188))(
v35,
*((_DWORD *)v32 + 93));
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 196))(
v35,
*((_DWORD *)v32 + 94));
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 132))(
v35,
*((_DWORD *)v32 + 95));
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD))(*(_DWORD *)v35 + 140))(
v35,
*((_DWORD *)v32 + 96));
v36 = *(int **)(v33 + 52);
v37 = *v36;
if ( *v36 )
{
v38 = (int *)v36[3];
v39 = this + 2964;
v55 = (unsigned int)&v38[v37 - 1];
v40 = v38;
while ( (unsigned int)v40 <= v55 )
{
v43 = *v40;
v41 = v40 + 1;
v42 = v43;
if ( !v43 )
break;
v46 = *v39 + 344;
v57 = v41;
v56 = v39;
v60[0] = *(_DWORD *)(v42 + 780);
v47 = (float *)std::unordered_map::operator[](v46, v60);
(*(void (__fastcall **)(int))(*(_DWORD *)v42 + 96))(v42);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v59, v35);
cocos2d::CCPoint::operator+(v60, v59, v32 + 101);
cocos2d::CCPoint::operator=(v47, v60);
v47[4] = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v42 + 192))(v42)) - v32[93];
v48 = (*(float (__fastcall **)(int))(*(_DWORD *)v42 + 200))(v42);
v39 = v56;
v40 = v57;
v47[5] = v48 - v32[94];
v49 = v32[91];
v50 = *(float *)(v42 + 1132);
v51 = v32[92];
v52 = *(float *)(v42 + 1136);
if ( v49 != 0.0 && v50 != 0.0 )
v47[2] = *(float *)(v42 + 1008) / (float)(v49 * v50);
if ( v51 != 0.0 && v52 != 0.0 )
v47[3] = *(float *)(v42 + 1012) / (float)(v51 * v52);
}
}
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 609) + 80))(*(this + 609), v54);
(*(void (__fastcall **)(_DWORD, _BYTE *))(*(_DWORD *)*(this + 609) + 92))(*(this + 609), v58);
}
v44 = 1;
GJTransformControl::refreshControl(*((GJTransformControl **)*(this + 2964) + 149));
}
else
{
v44 = 0;
}
if ( *(_BYTE *)(Object + 140) )
{
if ( (*(int (__fastcall **)(_DWORD))(**((_DWORD **)*(this + 2964) + 144) + 176))(*((_DWORD *)*(this + 2964)
+ 144)) )
{
v45 = *((GJRotationControl **)*(this + 2964) + 144);
*((_DWORD *)v29 + 36) = *((_DWORD *)v45 + 85);
*((_BYTE *)v29 + 140) = 1;
if ( *((_DWORD *)v45 + 86) == -1 )
GJRotationControl::setAngle(v45, *(float *)(Object + 144));
}
}
*((_BYTE *)v29 + 64) = *(_BYTE *)(Object + 64);
if ( !v44 )
goto LABEL_44;
break;
case 6:
SelectedObjects = (cocos2d::CCArray *)EditorUI::getSelectedObjects(*(this + 2964));
EditorUI::changeSelectedObjects(*(this + 2964), *(cocos2d::CCArray **)(Object + 60), 1);
UndoObject::setObjects((cocos2d::CCArray **)Object, SelectedObjects);
goto LABEL_43;
default:
goto LABEL_43;
}
}
else
{
switch ( *(_DWORD *)(Object + 56) )
{
case 1:
LABEL_8:
v12 = *(GameObject **)(*(_DWORD *)(Object + 52) + 52);
GJBaseGameLayer::removeObjectFromSection((GJBaseGameLayer *)this, v12);
LevelEditorLayer::removeSpecial((LevelEditorLayer *)this, v12);
*((_BYTE *)v12 + 988) = *((_BYTE *)v12 + 989);
EditorUI::deselectObject(*(this + 2964), v12);
(*(void (__fastcall **)(GameObject *, int))(*(_DWORD *)v12 + 656))(v12, 1);
break;
case 2:
LABEL_5:
v8 = *(GameObject **)(*(_DWORD *)(Object + 52) + 52);
(*((void (__fastcall **)(EditorUI **, GameObject *))*this + 168))(this, v8);
LevelEditorLayer::addSpecial((LevelEditorLayer *)this, v8);
if ( *((_BYTE *)v8 + 988) )
{
v10 = *(this + 2964);
v11 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v8, v9);
EditorUI::selectObjects(v10, v11, 1);
}
GameObject::assignUniqueID((int)v8);
break;
case 3:
LABEL_12:
v17 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v18 = *(cocos2d::CCArray **)(Object + 60);
v19 = 0;
v20 = v17;
while ( v19 < cocos2d::CCArray::count(v18) )
{
v21 = (GameObject *)cocos2d::CCArray::objectAtIndex(v18, v19);
(*((void (__fastcall **)(EditorUI **, GameObject *))*this + 168))(this, v21);
LevelEditorLayer::addSpecial((LevelEditorLayer *)this, v21);
if ( *((_BYTE *)v21 + 988) )
cocos2d::CCArray::addObject(v20, v21);
++v19;
GameObject::assignUniqueID((int)v21);
}
if ( cocos2d::CCArray::count(v20) )
EditorUI::selectObjects(*(this + 2964), v20, 1);
break;
case 4:
LABEL_9:
v13 = *(cocos2d::CCArray **)(Object + 60);
v14 = 0;
while ( v14 < cocos2d::CCArray::count(v13) )
{
v15 = (GameObject *)cocos2d::CCArray::objectAtIndex(v13, v14++);
v16 = v15;
GJBaseGameLayer::removeObjectFromSection((GJBaseGameLayer *)this, v15);
LevelEditorLayer::removeSpecial((LevelEditorLayer *)this, v16);
*((_BYTE *)v16 + 988) = *((_BYTE *)v16 + 989);
EditorUI::deselectObject(*(this + 2964), v16);
(*(void (__fastcall **)(GameObject *, int))(*(_DWORD *)v16 + 656))(v16, 1);
}
break;
default:
goto LABEL_4;
}
LABEL_43:
v29 = (UndoObject *)Object;
LABEL_44:
if ( (*(int (__fastcall **)(_DWORD))(**((_DWORD **)*(this + 2964) + 149) + 176))(*((_DWORD *)*(this + 2964) + 149)) )
{
EditorUI::deactivateTransformControl(*(this + 2964));
EditorUI::showTransformControl(*(this + 2964));
}
}
if ( a2 )
LevelEditorLayer::addToRedoList((LevelEditorLayer *)this, v29);
else
LevelEditorLayer::addToUndoList(this, v29, 1);
if ( cocos2d::CCArray::count(a3) )
{
if ( a2 )
{
if ( *(_BYTE *)(cocos2d::CCArray::lastObject(a3) + 64) )
LevelEditorLayer::undoLastAction((LevelEditorLayer *)this);
}
else if ( *(_BYTE *)(Object + 64) )
{
LevelEditorLayer::redoLastAction((LevelEditorLayer *)this);
}
}
return cocos2d::CCObject::release((cocos2d::CCObject *)Object);
}
return result;
}