//
// LevelBrowserLayer::setIDPopupClosed from 0x100418e30 to 0x100418f2c (252 bytes)
//
// 3 xrefs:
// > LevelListLayer::setIDPopupClosed @ 0x10024674c
// > sub_100418F2C @ 0x100418f30
// > ??> @ 0x100823170
//
// 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
//
void __fastcall LevelBrowserLayer::setIDPopupClosed(LevelBrowserLayer *a1, SetIDPopup *a2, int a3)
{
int v5; // w20
GJSearchObject *m_searchObject; // x1
GJSearchObject *v7; // x8
GameManager *v8; // x0
const char *v9; // x1
int m_lastPage; // w9
int v12; // w20
GJSearchObject *v13; // x8
GJSearchObject *PageObject; // x1
if ( ((unsigned int (__fastcall *)(SetIDPopup *))a2->getTag)(a2) == 4 )
{
if ( (a3 & ~(a3 >> 31)) >= 999 )
v5 = 999;
else
v5 = a3 & ~(a3 >> 31);
if ( a1->m_searchObject )
{
GameManager::sharedState()->m_currentLevelID = 0;
m_searchObject = a1->m_searchObject;
m_searchObject->m_folder = v5;
m_searchObject->m_page = 0;
LevelBrowserLayer::loadPage(a1, m_searchObject);
v7 = a1->m_searchObject;
if ( v7 && v7->m_searchType == SavedLevels )
{
v8 = GameManager::sharedState();
v9 = "0092";
}
else
{
v8 = GameManager::sharedState();
v9 = "0091";
}
GameManager::setIntGameVariable(v8, v9, v5);
}
}
else
{
m_lastPage = a1->m_lastPage;
if ( m_lastPage >= a3 || m_lastPage <= 0 )
v12 = a3 - 1;
else
v12 = a1->m_lastPage;
v13 = a1->m_searchObject;
if ( v13 && v13->m_page != v12 )
{
GameManager::sharedState()->m_currentLevelID = 0;
PageObject = GJSearchObject::getPageObject(a1->m_searchObject, v12);
LevelBrowserLayer::loadPage(a1, PageObject);
}
}
}