//
// SetGroupIDLayer::onClose from 0x1405945e0 to 0x1405948c7 (743 bytes)
//
// 4 xrefs:
// > SetGroupIDLayer::onAnim @ 0x140591d04
// > SetGroupIDLayer::keyBackClicked @ 0x1405948d9
// > SetGroupIDLayer::init @ 0x14058eca3
// > ??> @ 0x14092d008
//
// 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:34:33 +0000
//
// Hidden C++ exception states: #wind=5
__int64 __fastcall SetGroupIDLayer::onClose(__int64 a1)
{
int v2; // edi
__int64 v3; // rax
unsigned int v4; // edi
__int64 v5; // rcx
__int64 v6; // rcx
__int64 v7; // rax
cocos2d::CCArray *v8; // rcx
__int64 v9; // rcx
__int64 v10; // rdi
__int64 v11; // rdx
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]
v2 = *(_DWORD *)(a1 + 764);
v3 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v13 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v3 = qword_14090BFD0;
}
*(_DWORD *)(v3 + 1008) = v2;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 728) + 1032LL))(*(_QWORD *)(a1 + 728), 0);
v4 = 0;
*(_QWORD *)(*(_QWORD *)(a1 + 728) + 600LL) = 0;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 1032LL))(*(_QWORD *)(a1 + 704), 0);
*(_QWORD *)(*(_QWORD *)(a1 + 704) + 600LL) = 0;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 712) + 1032LL))(*(_QWORD *)(a1 + 712), 0);
*(_QWORD *)(*(_QWORD *)(a1 + 712) + 600LL) = 0;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 720) + 1032LL))(*(_QWORD *)(a1 + 720), 0);
*(_QWORD *)(*(_QWORD *)(a1 + 720) + 600LL) = 0;
v5 = *(_QWORD *)(a1 + 736);
if ( v5 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v5 + 1032LL))(v5, 0);
*(_QWORD *)(*(_QWORD *)(a1 + 736) + 600LL) = 0;
}
v6 = *(_QWORD *)(a1 + 744);
if ( v6 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v6 + 1032LL))(v6, 0);
*(_QWORD *)(*(_QWORD *)(a1 + 744) + 600LL) = 0;
}
v7 = *(_QWORD *)(a1 + 672);
if ( v7 )
{
*(_BYTE *)(v7 + 1156) = 1;
}
else
{
v8 = *(cocos2d::CCArray **)(a1 + 680);
if ( v8 && cocos2d::CCArray::count(v8) )
{
do
*((_BYTE *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 680), v4++) + 1156) = 1;
while ( v4 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 680)) );
}
}
v9 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v14 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v9 = qword_14090BFD0;
}
EditorUI::updateObjectInfoLabel(*(_QWORD *)(*(_QWORD *)(v9 + 568) + 14904LL));
v10 = qword_14090BFD0;
if ( *(_BYTE *)(a1 + 804) )
{
if ( !qword_14090BFD0 )
{
v15 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
LevelEditorLayer::resetToggledGroupsAndObjects(*(_QWORD **)(v10 + 568));
}
if ( *(_QWORD *)(a1 + 672) && (*(_BYTE *)(a1 + 796) || *(_BYTE *)(a1 + 760)) )
{
if ( !v10 )
{
v16 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
*(_BYTE *)(*(_QWORD *)(v10 + 568) + 14840LL) = 1;
}
if ( !v10 )
{
v17 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
*(_BYTE *)(*(_QWORD *)(v10 + 568) + 15666LL) = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 992LL))(a1, 0);
LOBYTE(v11) = 1;
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 520LL))(a1, v11);
}