//
// LevelEditorLayer::handleAction from 0x1403f2580 to 0x1403f2fa0 (2592 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::redoLastAction @ 0x1403f3018
// > LevelEditorLayer::undoLastAction @ 0x1403f3098
// > ??> @ 0x140925430
//
// 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:31:48 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall LevelEditorLayer::handleAction(__int64 a1, char a2, cocos2d::CCArray *a3)
{
struct cocos2d::CCObject *Object; // rbp
__int64 v7; // rcx
cocos2d::CCObject **v8; // r14
int v9; // r13d
char v10; // r12
__int64 v11; // rdi
__int64 v12; // rbx
cocos2d::CCArray *v13; // rax
int v14; // eax
_BYTE *v15; // rbx
__int64 v16; // rdx
cocos2d::CCArray *v17; // r15
unsigned int j; // edi
struct cocos2d::CCObject *v19; // rbx
__int64 v20; // rdx
cocos2d::CCArray *v21; // r12
cocos2d::CCArray *v22; // r15
unsigned int i; // edi
struct cocos2d::CCObject *v24; // rbx
int v25; // eax
cocos2d::CCArray *v26; // r15
cocos2d::CCArray *v27; // r12
unsigned int k; // r14d
struct cocos2d::CCObject *v29; // rbx
struct cocos2d::CCObject *v30; // rax
__int64 v31; // rbx
__int64 v32; // rcx
cocos2d::CCArray *v33; // rax
__int64 v34; // rbx
cocos2d::CCObject *v35; // rax
__int64 v36; // rbx
__int64 TransformState; // rax
__int64 v38; // rbx
struct cocos2d::CCObject *v39; // rax
struct cocos2d::CCObject *v40; // rax
struct cocos2d::CCObject *v41; // rax
__int64 v42; // r12
__int64 v43; // r15
const struct cocos2d::CCPoint *v44; // rax
__int64 v45; // rbx
unsigned int *v46; // r15
__int64 v47; // rax
__int64 *v48; // r15
__int64 v49; // rdi
float *v50; // r13
__int64 v51; // rax
float v52; // xmm4_4
float v53; // xmm3_4
float v54; // xmm1_4
float v55; // xmm2_4
cocos2d::CCObject *SelectedObjects; // rbx
cocos2d::CCArray *v57; // r15
__int64 v58; // rdi
cocos2d::CCObject *v59; // rcx
char v60; // bl
unsigned int v61; // eax
unsigned int v62; // ecx
cocos2d::CCArray *v63; // rcx
unsigned int v64; // eax
unsigned int v65; // ecx
cocos2d::CCObject **v66; // [rsp+20h] [rbp-98h]
char v67[8]; // [rsp+28h] [rbp-90h] BYREF
char v68[8]; // [rsp+30h] [rbp-88h] BYREF
__int64 *v69; // [rsp+38h] [rbp-80h]
struct cocos2d::CCObject *v70; // [rsp+40h] [rbp-78h]
char v71[8]; // [rsp+48h] [rbp-70h] BYREF
char v72[16]; // [rsp+50h] [rbp-68h] BYREF
cocos2d::CCObject **v75; // [rsp+D8h] [rbp+20h] BYREF
if ( !cocos2d::CCArray::count(a3) )
return;
Object = cocos2d::CCArray::lastObject(a3);
v70 = Object;
cocos2d::CCObject::retain(Object);
cocos2d::CCArray::removeLastObject(a3, 1);
v8 = (cocos2d::CCObject **)Object;
v9 = *((_DWORD *)Object + 16);
if ( a2 )
goto LABEL_7;
switch ( v9 )
{
case 1:
LABEL_11:
v15 = *(_BYTE **)(*((_QWORD *)Object + 7) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, (__int64)v15);
LevelEditorLayer::removeSpecial(a1, v15);
v15[1140] = v15[1141];
EditorUI::deselectObject(*(_QWORD *)(a1 + 14904), (__int64)v15);
LOBYTE(v16) = 1;
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v15 + 1160LL))(v15, v16);
break;
case 2:
LABEL_8:
v11 = *(_QWORD *)(*((_QWORD *)Object + 7) + 56LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1192LL))(a1, v11);
LevelEditorLayer::addSpecial(a1, v11);
if ( *(_BYTE *)(v11 + 1140) )
{
v12 = *(_QWORD *)(a1 + 14904);
v13 = cocos2d::CCArray::createWithObject((struct cocos2d::CCObject *)v11);
EditorUI::selectObjects(v12, v13, 1);
}
v14 = dword_1408FE470;
*(_DWORD *)(v11 + 924) = dword_1408FE470;
*(_DWORD *)(v11 + 52) = v14;
dword_1408FE470 = v14 + 1;
break;
case 3:
LABEL_15:
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v22 = *((cocos2d::CCArray **)Object + 9);
for ( i = 0; i < cocos2d::CCArray::count(v22); ++i )
{
v24 = cocos2d::CCArray::objectAtIndex(v22, i);
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)a1 + 1192LL))(a1, v24);
LevelEditorLayer::addSpecial(a1, v24);
if ( *((_BYTE *)v24 + 1140) )
cocos2d::CCArray::addObject(v21, v24);
v25 = dword_1408FE470;
*((_DWORD *)v24 + 231) = dword_1408FE470;
*((_DWORD *)v24 + 13) = v25;
dword_1408FE470 = v25 + 1;
}
if ( cocos2d::CCArray::count(v21) )
EditorUI::selectObjects(*(_QWORD *)(a1 + 14904), v21, 1);
break;
case 4:
LABEL_12:
v17 = *((cocos2d::CCArray **)Object + 9);
for ( j = 0; j < cocos2d::CCArray::count(v17); ++j )
{
v19 = cocos2d::CCArray::objectAtIndex(v17, j);
GJBaseGameLayer::removeObjectFromSection(a1, (__int64)v19);
LevelEditorLayer::removeSpecial(a1, v19);
*((_BYTE *)v19 + 1140) = *((_BYTE *)v19 + 1141);
EditorUI::deselectObject(*(_QWORD *)(a1 + 14904), (__int64)v19);
LOBYTE(v20) = 1;
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v19 + 1160LL))(v19, v20);
}
break;
default:
LABEL_7:
v10 = 0;
switch ( v9 )
{
case 1:
goto LABEL_8;
case 2:
goto LABEL_11;
case 3:
goto LABEL_12;
case 4:
goto LABEL_15;
case 5:
v26 = *((cocos2d::CCArray **)Object + 9);
if ( v26 )
{
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
for ( k = 0; k < cocos2d::CCArray::count(v26); ++k )
{
v29 = cocos2d::CCArray::objectAtIndex(v26, k);
v30 = (struct cocos2d::CCObject *)GameObjectCopy::create(*((_QWORD *)v29 + 7));
cocos2d::CCArray::addObject(v27, v30);
GameObjectCopy::resetObject(v29);
v31 = *((_QWORD *)v29 + 7);
GJBaseGameLayer::removeObjectFromSection(a1, v31);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1192LL))(a1, v31);
}
v8 = (cocos2d::CCObject **)operator new(0xA0u);
v66 = v8;
v75 = v8;
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v8);
*v8 = (cocos2d::CCObject *)&UndoObject::`vftable';
v8[7] = nullptr;
*((_DWORD *)v8 + 16) = 0;
v8[9] = nullptr;
*((_WORD *)v8 + 40) = 0;
GJTransformState::GJTransformState((__int64)v8 + 84);
if ( v27 )
{
v33 = (cocos2d::CCArray *)cocos2d::CCArray::create(v32);
v8[9] = v33;
cocos2d::CCArray::addObjectsFromArray(v33, v27);
cocos2d::CCObject::retain(v8[9]);
}
*((_DWORD *)v8 + 16) = v9;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v8);
v10 = 0;
}
else
{
v34 = *(_QWORD *)(*((_QWORD *)Object + 7) + 56LL);
v8 = (cocos2d::CCObject **)operator new(0xA0u);
v66 = v8;
v75 = v8;
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v8);
*v8 = (cocos2d::CCObject *)&UndoObject::`vftable';
v8[7] = nullptr;
*((_DWORD *)v8 + 16) = 0;
v8[9] = nullptr;
*((_WORD *)v8 + 40) = 0;
GJTransformState::GJTransformState((__int64)v8 + 84);
if ( v34 )
{
v35 = (cocos2d::CCObject *)GameObjectCopy::create(v34);
v8[7] = v35;
cocos2d::CCObject::retain(v35);
}
*((_DWORD *)v8 + 16) = v9;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v8);
GameObjectCopy::resetObject(*((_QWORD *)Object + 7));
v36 = *(_QWORD *)(*((_QWORD *)Object + 7) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, v36);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1192LL))(a1, v36);
}
if ( *((_BYTE *)Object + 81)
&& (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14904) + 840LL) + 344LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14904) + 840LL)) )
{
TransformState = EditorUI::getTransformState(*(_QWORD *)(a1 + 14904));
sub_1401B39C0((__int64)v8 + 84, TransformState);
*((_BYTE *)v8 + 81) = 1;
sub_1401B39C0(*(_QWORD *)(a1 + 14904) + 528LL, (__int64)Object + 84);
v38 = *(_QWORD *)(*(_QWORD *)(a1 + 14904) + 840LL);
*(_DWORD *)(v38 + 604) = *((_DWORD *)Object + 29);
*(_DWORD *)(v38 + 608) = *((_DWORD *)Object + 30);
*(_DWORD *)(v38 + 592) = *((_DWORD *)Object + 37);
*(_DWORD *)(v38 + 596) = *((_DWORD *)Object + 38);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v38 + 416) + 352LL))(*(_QWORD *)(v38 + 416));
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v38 + 184LL))(v38, (__int64)Object + 124);
v39 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v38 + 512), 0);
(*(void (__fastcall **)(struct cocos2d::CCObject *, void *))(*(_QWORD *)v39 + 184LL))(v39, &unk_14090A6C8);
v40 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v38 + 512), 9u);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v40 + 184LL))(
v40,
(__int64)Object + 132);
v41 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v38 + 512), 0xAu);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v41 + 184LL))(
v41,
(__int64)Object + 140);
v42 = *(_QWORD *)(a1 + 14904);
v43 = *(_QWORD *)(*(_QWORD *)(v42 + 840) + 424LL);
if ( v43 )
{
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 168LL))(*(_QWORD *)(a1 + 4296));
v44 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 200LL))(*(_QWORD *)(a1 + 4296));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, v44);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 160LL))(*(_QWORD *)(a1 + 4296));
(*(void (__fastcall **)(_QWORD, int *))(**(_QWORD **)(a1 + 4296) + 184LL))(
*(_QWORD *)(a1 + 4296),
&dword_14090AF10);
v45 = *(_QWORD *)(*(_QWORD *)(a1 + 14904) + 848LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v45 + 184LL))(v45, v42 + 568);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 120LL))(v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 136LL))(v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 368LL))(v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 384LL))(v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 256LL))(v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 272LL))(v45);
v46 = *(unsigned int **)(v43 + 56);
v47 = *v46;
if ( (_DWORD)v47 )
{
v48 = *((__int64 **)v46 + 2);
v69 = &v48[v47 - 1];
if ( v48 <= v69 )
{
do
{
v49 = *v48;
if ( !*v48 )
break;
LODWORD(v75) = *(_DWORD *)(v49 + 924);
v50 = *(float **)sub_1401A8A10(
(_QWORD *)(*(_QWORD *)(a1 + 14904) + 464LL),
(__int64)v72,
(unsigned __int8 *)&v75);
v51 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 200LL))(v49);
cocos2d::CCNode::convertToNodeSpace(v45, v67, v51);
cocos2d::CCPoint::operator+(v67, v68, v42 + 568);
cocos2d::CCPoint::operator=(v50 + 5, v68);
v50[9] = (*(float (__fastcall **)(__int64))(*(_QWORD *)v49 + 376LL))(v49) - *(float *)(v42 + 536);
v50[10] = (*(float (__fastcall **)(__int64))(*(_QWORD *)v49 + 392LL))(v49) - *(float *)(v42 + 540);
v52 = *(float *)(v42 + 528);
v53 = *(float *)(v42 + 532);
v54 = *(float *)(v49 + 1320);
v55 = *(float *)(v49 + 1324);
if ( v52 != 0.0 && v54 != 0.0 )
v50[7] = *(float *)(v49 + 1160) / (float)(v54 * v52);
if ( v53 != 0.0 && v55 != 0.0 )
v50[8] = *(float *)(v49 + 1164) / (float)(v55 * v53);
++v48;
}
while ( v48 <= v69 );
v8 = v66;
Object = v70;
}
}
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 160LL))(*(_QWORD *)(a1 + 4296));
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 4296) + 184LL))(*(_QWORD *)(a1 + 4296), v71);
}
GJTransformControl::refreshControl(*(_QWORD *)(*(_QWORD *)(a1 + 14904) + 840LL));
v10 = 1;
}
*((_BYTE *)v8 + 80) = *((_BYTE *)Object + 80);
if ( !v10 )
goto LABEL_56;
break;
case 6:
SelectedObjects = EditorUI::getSelectedObjects(*(_QWORD *)(a1 + 14904));
v57 = *((cocos2d::CCArray **)Object + 9);
v58 = *(_QWORD *)(a1 + 14904);
EditorUI::deselectAll(v58);
if ( cocos2d::CCArray::count(v57) )
{
EditorUI::selectObjects(v58, v57, 1);
*(_BYTE *)(v58 + 824) = 1;
EditorUI::updateSpecialUIElements(v58);
}
if ( *((cocos2d::CCObject **)Object + 9) != SelectedObjects )
{
if ( SelectedObjects )
cocos2d::CCObject::retain(SelectedObjects);
v59 = *((cocos2d::CCObject **)Object + 9);
if ( v59 )
cocos2d::CCObject::release(v59);
*((_QWORD *)Object + 9) = SelectedObjects;
}
goto LABEL_56;
default:
goto LABEL_56;
}
goto LABEL_58;
}
LABEL_56:
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14904) + 840LL) + 344LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14904) + 840LL)) )
{
EditorUI::deactivateTransformControl(*(_QWORD *)(a1 + 14904));
EditorUI::showTransformControl(*(_QWORD *)(a1 + 14904));
}
LABEL_58:
v60 = *(_BYTE *)(a1 + 14663);
if ( a2 )
{
v61 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14920));
v62 = 1000;
if ( !v60 )
v62 = 200;
if ( v61 >= v62 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(a1 + 14920), 0, 1);
v63 = *(cocos2d::CCArray **)(a1 + 14920);
}
else
{
v64 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14912));
v65 = 1000;
if ( !v60 )
v65 = 200;
if ( v64 >= v65 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(a1 + 14912), 0, 1);
v63 = *(cocos2d::CCArray **)(a1 + 14912);
}
cocos2d::CCArray::addObject(v63, (struct cocos2d::CCObject *)v8);
if ( cocos2d::CCArray::count(a3) )
{
if ( a2 )
{
if ( *((_BYTE *)cocos2d::CCArray::lastObject(a3) + 80) )
LevelEditorLayer::undoLastAction(a1);
}
else if ( *((_BYTE *)Object + 80) )
{
LevelEditorLayer::redoLastAction(a1);
}
}
cocos2d::CCObject::release(Object);
}