//
// EditorUI::onGoToFreeLayer from 0x10000ab50 to 0x10000abd8 (136 bytes)
//
// 2 xrefs:
// > EditorUI::handleEditorAction @ 0x10060cc99
// > EditorUI::init @ 0x100007490
//
// 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 12:18:49 +0000
//
__int64 __fastcall EditorUI::onGoToFreeLayer(__int64 a1)
{
__int64 v2; // rdi
__int16 NextFreeEditorLayer; // r14
_QWORD *v4; // rdi
_QWORD *v5; // r15
void *v6; // rdi
void *v8[2]; // [rsp+0h] [rbp-40h] BYREF
void *__p[2]; // [rsp+10h] [rbp-30h]
int v10; // [rsp+20h] [rbp-20h]
v2 = *(_QWORD *)(a1 + 1440);
*(_OWORD *)__p = 0;
*(_OWORD *)v8 = 0;
v10 = 1065353216;
NextFreeEditorLayer = LevelEditorLayer::getNextFreeEditorLayer(v2, v8);
v4 = __p[0];
if ( __p[0] )
{
do
{
v5 = (_QWORD *)*v4;
operator delete(v4);
v4 = v5;
}
while ( v5 );
}
v6 = v8[0];
v8[0] = nullptr;
if ( v6 )
operator delete(v6);
*(_WORD *)(*(_QWORD *)(a1 + 1440) + 14210LL) = NextFreeEditorLayer;
return EditorUI::updateGroupIDLabel(a1);
}