//
// LevelEditorLayer::handleAction from 0x7a1b34 to 0x7a23b0 (2172 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::redoLastAction @ 0x7a2408
// > LevelEditorLayer::undoLastAction @ 0x7a2464
// > ??> @ 0x44db8
//
// 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:53:40 +0000
//
__int64 __fastcall LevelEditorLayer::handleAction(EditorUI **this, unsigned __int8 a2, cocos2d::CCArray *a3)
{
int v4; // w23
__int64 Object; // x22
cocos2d::CCArray *v8; // x0
__int64 v9; // x28
cocos2d::CCArray *v10; // x26
unsigned int v11; // w24
cocos2d::CCArray *v12; // x27
unsigned int v13; // w1
GameObjectCopy **v14; // x25
GameObject *v15; // x1
cocos2d::CCObject *v16; // x0
int v17; // w24
cocos2d::CCArray *SelectedObjects; // x24
unsigned int v19; // w25
cocos2d::CCArray *v20; // x27
cocos2d::CCArray *v21; // x26
GameObject *v22; // x24
GameObject *v23; // x24
cocos2d::CCObject *v24; // x1
GameObject *v25; // x24
cocos2d::CCArray *v26; // x26
unsigned int v27; // w25
unsigned int v28; // w1
GameObject *v29; // x24
__int64 TransformState; // x24
__int64 v31; // x26
long double v32; // q0
__int64 v33; // x24
GJTransformControl *v34; // x0
__int64 v35; // x27
float *v36; // x26
float v37; // s8
const cocos2d::CCPoint *v38; // x0
cocos2d::CCNode *v39; // x25
unsigned int *v40; // x1
_QWORD *v41; // x5
__int64 i; // x27
__int64 v43; // x0
float *v44; // x24
const cocos2d::CCPoint *v45; // x0
long double v46; // q0
float v47; // s3
float v48; // s1
float v49; // s0
float v50; // s2
EditorUI *v51; // x25
cocos2d::CCArray *v52; // x0
GJRotationControl *v53; // x0
int v54; // w1
unsigned __int64 v55; // [xsp+78h] [xbp+78h]
_QWORD *v56; // [xsp+88h] [xbp+88h]
_BYTE v57[8]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v58; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v59; // [xsp+B0h] [xbp+B0h] BYREF
v4 = a2;
if ( (unsigned int)cocos2d::CCArray::count(a3) )
{
Object = cocos2d::CCArray::lastObject(a3);
cocos2d::CCObject::retain((cocos2d::CCObject *)Object);
cocos2d::CCArray::removeLastObject(a3, 1);
v8 = (cocos2d::CCArray *)(unsigned int)(*(_DWORD *)(Object + 64) - 1);
if ( v4 )
{
LABEL_17:
switch ( *(_DWORD *)(Object + 64) )
{
case 1:
goto LABEL_34;
case 2:
goto LABEL_37;
case 3:
goto LABEL_38;
case 4:
goto LABEL_29;
case 5:
v10 = *(cocos2d::CCArray **)(Object + 72);
if ( v10 )
{
v11 = 0;
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
while ( v11 < (unsigned int)cocos2d::CCArray::count(v10) )
{
v13 = v11++;
v14 = (GameObjectCopy **)cocos2d::CCArray::objectAtIndex(v10, v13);
v16 = (cocos2d::CCObject *)GameObjectCopy::create(v14[7], v15);
cocos2d::CCArray::addObject(v12, v16);
GameObjectCopy::resetObject((GameObjectCopy *)v14);
GJBaseGameLayer::reorderObjectSection((GJBaseGameLayer *)this, v14[7]);
}
v9 = UndoObject::createWithArray(v12, 5);
}
else
{
v9 = UndoObject::create(*(GameObjectCopy **)(*(_QWORD *)(Object + 56) + 56LL), 5);
GameObjectCopy::resetObject(*(GameObjectCopy **)(Object + 56));
GJBaseGameLayer::reorderObjectSection(
(GJBaseGameLayer *)this,
*(GameObject **)(*(_QWORD *)(Object + 56) + 56LL));
}
if ( *(_BYTE *)(Object + 81)
&& (*(unsigned __int8 (__fastcall **)(_QWORD))(**((_QWORD **)*(this + 1781) + 99) + 352LL))(*((_QWORD *)*(this + 1781) + 99)) )
{
TransformState = EditorUI::getTransformState(*(this + 1781));
*(_DWORD *)(v9 + 84) = *(_DWORD *)TransformState;
*(_DWORD *)(v9 + 88) = *(_DWORD *)(TransformState + 4);
*(_DWORD *)(v9 + 92) = *(_DWORD *)(TransformState + 8);
*(_DWORD *)(v9 + 96) = *(_DWORD *)(TransformState + 12);
*(_DWORD *)(v9 + 100) = *(_DWORD *)(TransformState + 16);
*(_DWORD *)(v9 + 104) = *(_DWORD *)(TransformState + 20);
*(_DWORD *)(v9 + 108) = *(_DWORD *)(TransformState + 24);
*(_BYTE *)(v9 + 112) = *(_BYTE *)(TransformState + 28);
*(_DWORD *)(v9 + 116) = *(_DWORD *)(TransformState + 32);
*(_DWORD *)(v9 + 120) = *(_DWORD *)(TransformState + 36);
cocos2d::CCPoint::operator=(v9 + 124, TransformState + 40);
cocos2d::CCPoint::operator=(v9 + 132, TransformState + 48);
cocos2d::CCPoint::operator=(v9 + 140, TransformState + 56);
*(_DWORD *)(v9 + 148) = *(_DWORD *)(TransformState + 64);
*(_DWORD *)(v9 + 152) = *(_DWORD *)(TransformState + 68);
*(_BYTE *)(v9 + 81) = 1;
v31 = (__int64)*(this + 1781);
*(_DWORD *)(v31 + 504) = *(_DWORD *)(Object + 84);
*(_DWORD *)(v31 + 508) = *(_DWORD *)(Object + 88);
*(_DWORD *)(v31 + 512) = *(_DWORD *)(Object + 92);
*(_DWORD *)(v31 + 516) = *(_DWORD *)(Object + 96);
*(_DWORD *)(v31 + 520) = *(_DWORD *)(Object + 100);
*(_DWORD *)(v31 + 524) = *(_DWORD *)(Object + 104);
*(_DWORD *)(v31 + 528) = *(_DWORD *)(Object + 108);
*(_BYTE *)(v31 + 532) = *(_BYTE *)(Object + 112);
*(_DWORD *)(v31 + 536) = *(_DWORD *)(Object + 116);
*(_DWORD *)(v31 + 540) = *(_DWORD *)(Object + 120);
cocos2d::CCPoint::operator=(v31 + 544, Object + 124);
cocos2d::CCPoint::operator=(v31 + 552, Object + 132);
*(__n128 *)&v32 = cocos2d::CCPoint::operator=(v31 + 560, Object + 140);
*(_DWORD *)(v31 + 568) = *(_DWORD *)(Object + 148);
*(_DWORD *)(v31 + 572) = *(_DWORD *)(Object + 152);
GJTransformControl::loadFromState(*((_QWORD *)*(this + 1781) + 99), Object + 84, v32);
v33 = (__int64)*(this + 1781);
v34 = *(GJTransformControl **)(v33 + 792);
v35 = *((_QWORD *)v34 + 53);
if ( v35 )
{
v36 = (float *)(v33 + 504);
v37 = (*(float (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 490) + 168LL))(*(this + 490));
v38 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 490) + 192LL))(*(this + 490));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, v38);
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)*(this + 490) + 160LL))(*(this + 490), 1.0);
(*(void (__fastcall **)(_QWORD, int *))(*(_QWORD *)*(this + 490) + 184LL))(*(this + 490), &dword_155C6A8);
v39 = *((cocos2d::CCNode **)*(this + 1781) + 100);
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v39 + 184LL))(v39, v33 + 544);
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 128LL))(v39, *(float *)(v33 + 504));
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 144LL))(v39, *(float *)(v33 + 508));
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 376LL))(v39, *(float *)(v33 + 512));
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 392LL))(v39, *(float *)(v33 + 516));
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 264LL))(v39, *(float *)(v33 + 520));
(*(void (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v39 + 280LL))(v39, *(float *)(v33 + 524));
v40 = *(unsigned int **)(v35 + 56);
if ( *v40 )
{
v41 = *((_QWORD **)v40 + 2);
v55 = (unsigned __int64)&v41[*v40 - 1];
if ( (unsigned __int64)v41 <= v55 )
{
for ( i = *v41; *v41; i = *v41 )
{
v43 = (__int64)*(this + 1781) + 464;
v56 = v41;
LODWORD(v59) = *(_DWORD *)(i + 916);
v44 = (float *)std::unordered_map::operator[](v43, (int *)&v59);
v45 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)i + 192LL))(i);
cocos2d::CCNode::convertToNodeSpace(&v58, v39, v45);
cocos2d::CCPoint::operator+(&v59, &v58);
*(__n128 *)&v46 = cocos2d::CCPoint::operator=(v44, &v59);
v44[4] = (*(float (__fastcall **)(__int64, long double))(*(_QWORD *)i + 384LL))(i, v46) - v36[2];
v44[5] = (*(float (__fastcall **)(__int64))(*(_QWORD *)i + 400LL))(i) - v36[3];
v47 = *(float *)(i + 1312);
v48 = *v36;
v49 = v36[1];
v50 = *(float *)(i + 1316);
if ( v47 != 0.0 && v48 != 0.0 )
v44[2] = *(float *)(i + 1152) / (float)(v48 * v47);
if ( v50 != 0.0 && v49 != 0.0 )
v44[3] = *(float *)(i + 1156) / (float)(v49 * v50);
v41 = v56 + 1;
if ( v55 < (unsigned __int64)(v56 + 1) )
break;
}
}
}
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)*(this + 490) + 160LL))(*(this + 490), v37);
(*(void (__fastcall **)(_QWORD, _BYTE *))(*(_QWORD *)*(this + 490) + 184LL))(*(this + 490), v57);
v34 = *((GJTransformControl **)*(this + 1781) + 99);
}
v17 = 1;
GJTransformControl::refreshControl(v34);
}
else
{
v17 = 0;
}
if ( *(_BYTE *)(Object + 156) )
{
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**((_QWORD **)*(this + 1781) + 95) + 352LL))(*((_QWORD *)*(this + 1781) + 95)) )
{
v53 = *((GJRotationControl **)*(this + 1781) + 95);
v54 = *((_DWORD *)v53 + 109);
*(_BYTE *)(v9 + 156) = 1;
*(_DWORD *)(v9 + 160) = v54;
if ( *((_DWORD *)v53 + 110) == -1 )
GJRotationControl::setAngle(v53, *(float *)(Object + 160));
}
}
*(_BYTE *)(v9 + 80) = *(_BYTE *)(Object + 80);
if ( !v17 )
goto LABEL_7;
break;
case 6:
SelectedObjects = (cocos2d::CCArray *)EditorUI::getSelectedObjects(*(this + 1781));
EditorUI::changeSelectedObjects(*(this + 1781), *(cocos2d::CCArray **)(Object + 72), 1);
UndoObject::setObjects(Object, SelectedObjects);
goto LABEL_6;
default:
goto LABEL_6;
}
}
else
{
switch ( *(_DWORD *)(Object + 64) )
{
case 1:
LABEL_37:
v25 = *(GameObject **)(*(_QWORD *)(Object + 56) + 56LL);
GJBaseGameLayer::removeObjectFromSection((GJBaseGameLayer *)this, v25);
LevelEditorLayer::removeSpecial((LevelEditorLayer *)this, v25);
*((_BYTE *)v25 + 1132) = *((_BYTE *)v25 + 1133);
EditorUI::deselectObject(*(this + 1781), v25);
(*(void (__fastcall **)(GameObject *, __int64))(*(_QWORD *)v25 + 1312LL))(v25, 1);
break;
case 2:
LABEL_34:
v23 = *(GameObject **)(*(_QWORD *)(Object + 56) + 56LL);
(*((void (__fastcall **)(EditorUI **, GameObject *))*this + 168))(this, v23);
LevelEditorLayer::addSpecial((LevelEditorLayer *)this, v23);
if ( *((_BYTE *)v23 + 1132) )
{
v51 = *(this + 1781);
v52 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v23, v24);
EditorUI::selectObjects(v51, v52, 1);
}
GameObject::assignUniqueID((__int64)v23);
break;
case 3:
LABEL_29:
v19 = 0;
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
v21 = *(cocos2d::CCArray **)(Object + 72);
while ( v19 < (unsigned int)cocos2d::CCArray::count(v21) )
{
v22 = (GameObject *)cocos2d::CCArray::objectAtIndex(v21, v19);
(*((void (__fastcall **)(EditorUI **, GameObject *))*this + 168))(this, v22);
LevelEditorLayer::addSpecial((LevelEditorLayer *)this, v22);
if ( *((_BYTE *)v22 + 1132) )
cocos2d::CCArray::addObject(v20, v22);
++v19;
GameObject::assignUniqueID((__int64)v22);
}
if ( (unsigned int)cocos2d::CCArray::count(v20) )
EditorUI::selectObjects(*(this + 1781), v20, 1);
break;
case 4:
LABEL_38:
v26 = *(cocos2d::CCArray **)(Object + 72);
v27 = 0;
while ( v27 < (unsigned int)cocos2d::CCArray::count(v26) )
{
v28 = v27++;
v29 = (GameObject *)cocos2d::CCArray::objectAtIndex(v26, v28);
GJBaseGameLayer::removeObjectFromSection((GJBaseGameLayer *)this, v29);
LevelEditorLayer::removeSpecial((LevelEditorLayer *)this, v29);
*((_BYTE *)v29 + 1132) = *((_BYTE *)v29 + 1133);
EditorUI::deselectObject(*(this + 1781), v29);
(*(void (__fastcall **)(GameObject *, __int64))(*(_QWORD *)v29 + 1312LL))(v29, 1);
}
break;
default:
goto LABEL_17;
}
LABEL_6:
v9 = Object;
LABEL_7:
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**((_QWORD **)*(this + 1781) + 99) + 352LL))(*((_QWORD *)*(this + 1781) + 99)) )
{
EditorUI::deactivateTransformControl(*(this + 1781));
EditorUI::showTransformControl(*(this + 1781));
}
}
if ( v4 )
{
LevelEditorLayer::addToRedoList((LevelEditorLayer *)this, (UndoObject *)v9);
if ( (unsigned int)cocos2d::CCArray::count(a3) && *(_BYTE *)(cocos2d::CCArray::lastObject(a3) + 80) )
LevelEditorLayer::undoLastAction((LevelEditorLayer *)this);
}
else
{
LevelEditorLayer::addToUndoList(this, (UndoObject *)v9, 1);
if ( (unsigned int)cocos2d::CCArray::count(a3) && *(_BYTE *)(Object + 80) )
LevelEditorLayer::redoLastAction((LevelEditorLayer *)this);
}
cocos2d::CCObject::release((cocos2d::CCObject *)Object);
}
return _stack_chk_guard;
}