//
// LevelEditorLayer::handleAction from 0x1003fbc54 to 0x1003fc41c (1992 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::redoLastAction @ 0x1003fc5f8
// > LevelEditorLayer::undoLastAction @ 0x1003fc650
//
// 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 11:04:36 +0000
//
_DWORD *__fastcall LevelEditorLayer::handleAction(__int64 a1, int a2, __int64 a3)
{
_DWORD *result; // x0
__int64 v7; // x20
__n128 v8; // q0
int v9; // w8
char *v10; // x23
_QWORD *v11; // x24
__int64 v12; // x23
unsigned int v13; // w25
__int64 v14; // x26
__int64 SelectedObjects; // x23
double v16; // d0
__int64 v17; // x24
unsigned int v18; // w23
_BYTE *v19; // x25
__n128 v20; // q0
_BYTE *v21; // x23
__n128 v22; // q0
__int64 v23; // x23
__int64 v24; // x24
void *v25; // x0
__int64 v26; // x23
_QWORD *v27; // x24
unsigned int v28; // w25
__int64 v29; // x26
__int64 v30; // x24
__int64 v31; // x8
__int128 v32; // q0
__int64 v33; // x24
__int128 v34; // q0
__int128 v35; // q1
float32x2_t *v36; // x28
_QWORD *v37; // x0
__int64 v38; // x25
float v39; // s8
double *v40; // x0
__int64 v41; // x24
unsigned int *v42; // x9
__int64 v43; // x8
__int64 *v44; // x25
__int64 v45; // x26
__int64 v46; // x8
__int64 *v47; // x27
__int64 v48; // x0
double v49; // d0
float v50; // s2
float v51; // s0
float v52; // s1
float v53; // s3
char v54; // w24
__int64 v55; // x0
unsigned __int64 v56; // [xsp+8h] [xbp-88h]
float32x2_t v57; // [xsp+14h] [xbp-7Ch] BYREF
__int64 v58; // [xsp+1Ch] [xbp-74h] BYREF
float32x2_t *v59; // [xsp+28h] [xbp-68h] BYREF
result = (_DWORD *)sub_1002E757C(a3);
if ( !(_DWORD)result )
return result;
v7 = sub_1002E75B0(a3);
cocos2d::CCObject::retain(v7);
sub_1002E7648(a3, 1);
v9 = *(_DWORD *)(v7 + 64);
if ( (a2 & 1) != 0 )
{
if ( v9 <= 3 )
{
if ( v9 != 1 )
{
if ( v9 != 2 )
{
v10 = (char *)v7;
if ( v9 != 3 )
goto LABEL_34;
goto LABEL_25;
}
goto LABEL_29;
}
goto LABEL_30;
}
if ( v9 == 4 )
goto LABEL_14;
goto LABEL_22;
}
if ( v9 > 3 )
{
if ( v9 == 4 )
{
LABEL_25:
v17 = *(_QWORD *)(v7 + 72);
v10 = (char *)v7;
if ( !(unsigned int)sub_1002E757C(v17) )
goto LABEL_34;
v18 = 0;
do
{
v19 = (_BYTE *)sub_1002E75A0(v17, v18);
GJBaseGameLayer::removeObjectFromSection(a1, (__int64)v19);
LevelEditorLayer::removeSpecial(a1, (__int64)v19);
v19[1132] = v19[1133];
EditorUI::deselectObject(*(_QWORD *)(a1 + 14248), (__int64)v19, v20);
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v19 + 1312LL))(v19, 1);
++v18;
}
while ( v18 < (unsigned int)sub_1002E757C(v17) );
goto LABEL_33;
}
LABEL_22:
if ( v9 == 5 )
{
v26 = *(_QWORD *)(v7 + 72);
if ( v26 )
{
v27 = sub_1002E736C();
if ( (unsigned int)sub_1002E757C(v26) )
{
v28 = 0;
do
{
v29 = sub_1002E75A0(v26, v28);
sub_1003FC41C(*(_QWORD *)(v29 + 56));
sub_1002E74E0((__int64)v27);
sub_1003FC4A8(v29);
GJBaseGameLayer::reorderObjectSection(a1, *(_QWORD *)(v29 + 56));
++v28;
}
while ( v28 < (unsigned int)sub_1002E757C(v26) );
}
v10 = (char *)UndoObject::createWithArray((__int64)v27, 5);
}
else
{
v10 = (char *)UndoObject::create(*(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL), 5);
sub_1003FC4A8(*(_QWORD *)(v7 + 56));
GJBaseGameLayer::reorderObjectSection(a1, *(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL));
}
if ( *(_BYTE *)(v7 + 81) == 1
&& (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14248) + 792LL) + 352LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL)) )
{
v30 = sub_100160860(*(_QWORD *)(a1 + 14248));
v31 = *(_QWORD *)(v30 + 32);
v32 = *(_OWORD *)(v30 + 16);
*(_OWORD *)(v10 + 84) = *(_OWORD *)v30;
*(_OWORD *)(v10 + 100) = v32;
*(_QWORD *)(v10 + 116) = v31;
sub_10002630C(v10 + 124, (double *)(v30 + 40));
sub_10002630C(v10 + 132, (double *)(v30 + 48));
sub_10002630C(v10 + 140, (double *)(v30 + 56));
*(_QWORD *)(v10 + 148) = *(_QWORD *)(v30 + 64);
v10[81] = 1;
v33 = *(_QWORD *)(a1 + 14248);
v34 = *(_OWORD *)(v7 + 100);
v35 = *(_OWORD *)(v7 + 84);
*(_QWORD *)(v33 + 536) = *(_QWORD *)(v7 + 116);
*(_OWORD *)(v33 + 504) = v35;
*(_OWORD *)(v33 + 520) = v34;
sub_10002630C((_QWORD *)(v33 + 544), (double *)(v7 + 124));
sub_10002630C((_QWORD *)(v33 + 552), (double *)(v7 + 132));
sub_10002630C((_QWORD *)(v33 + 560), (double *)(v7 + 140));
*(_QWORD *)(v33 + 568) = *(_QWORD *)(v7 + 148);
sub_10015AB24(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL), v7 + 84);
v36 = *(float32x2_t **)(a1 + 14248);
v37 = (_QWORD *)v36[99];
v38 = v37[53];
if ( v38 )
{
v39 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
v40 = (double *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 192LL))(*(_QWORD *)(a1 + 3920));
sub_1000262F4(&v58, v40);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), 1.0);
(*(void (__fastcall **)(_QWORD, int *))(**(_QWORD **)(a1 + 3920) + 184LL))(
*(_QWORD *)(a1 + 3920),
&dword_1009F7210);
v41 = *(_QWORD *)(*(_QWORD *)(a1 + 14248) + 800LL);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v41 + 184LL))(v41, v36 + 68);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 128LL))(v41, v36[63].f32[0]);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 144LL))(v41, v36[63].f32[1]);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 376LL))(v41, v36[64].f32[0]);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 392LL))(v41, v36[64].f32[1]);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 264LL))(v41, v36[65].f32[0]);
(*(void (__fastcall **)(__int64, float32_t))(*(_QWORD *)v41 + 280LL))(v41, v36[65].f32[1]);
v42 = *(unsigned int **)(v38 + 56);
v43 = *v42;
if ( (_DWORD)v43 )
{
v44 = *((__int64 **)v42 + 2);
v56 = (unsigned __int64)&v44[v43 - 1];
do
{
v45 = *v44;
if ( !*v44 )
break;
v46 = *(_QWORD *)(a1 + 14248);
v57.i32[0] = *(_DWORD *)(v45 + 916);
v59 = &v57;
v47 = sub_10015CA10(v46 + 464, (int *)&v57);
v48 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v45 + 192LL))(v45);
cocos2d::CCNode::convertToNodeSpace(v41, v48, &v59);
sub_100026318((float32x2_t *)&v59, v36 + 68, &v57);
v49 = sub_10002630C((__int64 *)((char *)v47 + 20), (double *)&v57);
*((float *)v47 + 9) = (*(float (__fastcall **)(__int64, double))(*(_QWORD *)v45 + 384LL))(v45, v49)
- v36[64].f32[0];
*((float *)v47 + 10) = (*(float (__fastcall **)(__int64))(*(_QWORD *)v45 + 400LL))(v45) - v36[64].f32[1];
v50 = v36[63].f32[0];
v51 = v36[63].f32[1];
v52 = *(float *)(v45 + 1316);
if ( v50 != 0.0 )
{
v53 = *(float *)(v45 + 1312);
if ( v53 != 0.0 )
*((float *)v47 + 7) = *(float *)(v45 + 1152) / (float)(v50 * v53);
}
if ( v51 != 0.0 && v52 != 0.0 )
*((float *)v47 + 8) = *(float *)(v45 + 1156) / (float)(v51 * v52);
++v44;
}
while ( (unsigned __int64)v44 <= v56 );
}
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), v39);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 3920) + 184LL))(*(_QWORD *)(a1 + 3920), &v58);
v37 = *(_QWORD **)(*(_QWORD *)(a1 + 14248) + 792LL);
}
GJTransformControl::refreshControl(v37);
v54 = 1;
}
else
{
v54 = 0;
}
if ( *(_BYTE *)(v7 + 156) == 1 )
{
if ( (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14248) + 760LL) + 352LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 760LL)) )
{
v55 = *(_QWORD *)(*(_QWORD *)(a1 + 14248) + 760LL);
*((_DWORD *)v10 + 40) = *(_DWORD *)(v55 + 436);
v10[156] = 1;
if ( *(_DWORD *)(v55 + 440) == -1 )
sub_1001575C8(v55, *(float *)(v7 + 160));
}
}
v10[80] = *(_BYTE *)(v7 + 80);
if ( (v54 & 1) != 0 )
goto LABEL_36;
goto LABEL_34;
}
v10 = (char *)v7;
if ( v9 == 6 )
{
SelectedObjects = EditorUI::getSelectedObjects(*(_QWORD *)(a1 + 14248), v8);
sub_1001A6BC4(*(_QWORD *)(a1 + 14248), *(_QWORD *)(v7 + 72), 1, v16);
sub_1003FC55C(v7, SelectedObjects);
LABEL_33:
v10 = (char *)v7;
goto LABEL_34;
}
goto LABEL_34;
}
if ( v9 == 1 )
{
LABEL_29:
v21 = *(_BYTE **)(*(_QWORD *)(v7 + 56) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, (__int64)v21);
LevelEditorLayer::removeSpecial(a1, (__int64)v21);
v21[1132] = v21[1133];
EditorUI::deselectObject(*(_QWORD *)(a1 + 14248), (__int64)v21, v22);
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v21 + 1312LL))(v21, 1);
goto LABEL_33;
}
if ( v9 == 2 )
{
LABEL_30:
v23 = *(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v23);
LevelEditorLayer::addSpecial(a1, v23);
if ( *(_BYTE *)(v23 + 1132) == 1 )
{
v24 = *(_QWORD *)(a1 + 14248);
v25 = sub_1002E73C8(v23);
EditorUI::selectObjects(v24, (__int64)v25, 1);
}
GameObject::assignUniqueID(v23);
goto LABEL_33;
}
v10 = (char *)v7;
if ( v9 == 3 )
{
LABEL_14:
v11 = sub_1002E736C();
v12 = *(_QWORD *)(v7 + 72);
if ( (unsigned int)sub_1002E757C(v12) )
{
v13 = 0;
do
{
v14 = sub_1002E75A0(v12, v13);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v14);
LevelEditorLayer::addSpecial(a1, v14);
if ( *(_BYTE *)(v14 + 1132) == 1 )
sub_1002E74E0((__int64)v11);
GameObject::assignUniqueID(v14);
++v13;
}
while ( v13 < (unsigned int)sub_1002E757C(v12) );
}
v10 = (char *)v7;
if ( !(unsigned int)sub_1002E757C((__int64)v11) )
goto LABEL_34;
EditorUI::selectObjects(*(_QWORD *)(a1 + 14248), (__int64)v11, 1);
goto LABEL_33;
}
LABEL_34:
if ( (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14248) + 792LL) + 352LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL)) )
{
EditorUI::deactivateTransformControl(*(_QWORD *)(a1 + 14248));
EditorUI::showTransformControl(*(_QWORD *)(a1 + 14248));
}
LABEL_36:
if ( a2 )
{
LevelEditorLayer::addToRedoList(a1);
if ( (unsigned int)sub_1002E757C(a3) )
{
if ( *(_BYTE *)(sub_1002E75B0(a3) + 80) == 1 )
LevelEditorLayer::undoLastAction(a1);
}
}
else
{
LevelEditorLayer::addToUndoList(a1, (__int64)v10, 1);
if ( (unsigned int)sub_1002E757C(a3) && *(_BYTE *)(v7 + 80) == 1 )
LevelEditorLayer::redoLastAction(a1);
}
return cocos2d::CCObject::release((_DWORD *)v7);
}