//
// EditorOptionsLayer::onClose from 0x140291a90 to 0x140291ca3 (531 bytes)
//
// 2 xrefs:
// > ??> @ 0x140575870
// > ??> @ 0x1406d19d0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=8
void EditorOptionsLayer::onClose(EditorOptionsLayer *a1, cocos2d::CCObject *a2)
{
GameManager *v4; // rcx
int IntGameVariable; // edi
GameManager *v6; // rcx
int v7; // eax
__int64 v8; // rcx
GameManager *v9; // rcx
GameManager *v10; // rcx
__int64 v11; // rax
LevelEditorLayer *v12; // rcx
void *v13; // [rsp+30h] [rbp+8h]
void *v14; // [rsp+30h] [rbp+8h]
void *v15; // [rsp+30h] [rbp+8h]
void *v16; // [rsp+30h] [rbp+8h]
void *v17; // [rsp+30h] [rbp+8h]
void *v18; // [rsp+30h] [rbp+8h]
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v13 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
IntGameVariable = GameManager::getIntGameVariable(v4, "0049");
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v14 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
v7 = GameManager::getIntGameVariable(v6, "0050");
if ( a1->m_buttonsPerRow == IntGameVariable && a1->m_buttonRows == v7 )
{
v8 = qword_1406C2ED8;
}
else
{
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v15 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v9, "0049", a1->m_buttonsPerRow);
v10 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v10, "0050", a1->m_buttonRows);
v8 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v17 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = qword_1406C2ED8;
}
v11 = *(_QWORD *)(v8 + 528);
if ( v11 )
*(_BYTE *)(*(_QWORD *)(v11 + 14496) + 1441LL) = 1;
}
if ( !v8 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = qword_1406C2ED8;
}
v12 = *(LevelEditorLayer **)(v8 + 528);
if ( v12 )
LevelEditorLayer::updatePreviewParticles(v12);
SetupTriggerPopup::onClose(a1, a2);
}