//
// LevelBrowserLayer::setIDPopupClosed from 0x1402cca50 to 0x1402ccc42 (498 bytes)
//
// 3 xrefs:
// > LevelListLayer::setIDPopupClosed @ 0x140307105
// > ??> @ 0x140585268
// > ??> @ 0x1406d2d08
//
// 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=4
void LevelBrowserLayer::setIDPopupClosed(LevelBrowserLayer *a1, SetIDPopup *a2, int a3)
{
__int64 v5; // rax
__int64 v6; // rax
GameManager *v7; // rcx
GameManager *v8; // rcx
int ty_low; // ebx
float ty; // eax
__int64 v11; // rax
__int64 v12; // rax
GJSearchObject *PageObject; // rax
void *v14; // [rsp+38h] [rbp+10h]
void *v15; // [rsp+38h] [rbp+10h]
void *v16; // [rsp+38h] [rbp+10h]
void *v17; // [rsp+38h] [rbp+10h]
if ( a2->getTag(a2) == 4 )
{
if ( a3 >= 0 )
{
if ( a3 > 999 )
a3 = 999;
}
else
{
a3 = 0;
}
if ( *(_QWORD *)&a1->m_obAnchorPoint.y )
{
v5 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v14 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = qword_1406C2ED8;
}
*(_DWORD *)(v5 + 948) = 0;
*(_DWORD *)(*(_QWORD *)&a1->m_obAnchorPoint.y + 452LL) = a3;
*(_DWORD *)(*(_QWORD *)&a1->m_obAnchorPoint.y + 424LL) = 0;
LevelBrowserLayer::loadPage((LevelBrowserLayer *)((char *)a1 - 560), *(GJSearchObject **)&a1->m_obAnchorPoint.y);
v6 = *(_QWORD *)&a1->m_obAnchorPoint.y;
if ( v6 && *(_DWORD *)(v6 + 320) == 99 )
{
v7 = (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);
v7 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v7, "0092", a3);
}
else
{
v8 = (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);
v8 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v8, "0091", a3);
}
}
}
else
{
ty_low = a3 - 1;
ty = a1->m_sInverse.ty;
if ( SLODWORD(ty) > 0 && SLODWORD(ty) < ty_low )
ty_low = LODWORD(a1->m_sInverse.ty);
v11 = *(_QWORD *)&a1->m_obAnchorPoint.y;
if ( v11 && *(_DWORD *)(v11 + 424) != ty_low )
{
v12 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v17 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = qword_1406C2ED8;
}
*(_DWORD *)(v12 + 948) = 0;
PageObject = GJSearchObject::getPageObject(*(GJSearchObject **)&a1->m_obAnchorPoint.y, ty_low);
LevelBrowserLayer::loadPage((LevelBrowserLayer *)((char *)a1 - 560), PageObject);
}
}
}