//
// LevelBrowserLayer::setIDPopupClosed from 0x6ecd7c to 0x6ecea4 (296 bytes)
//
// 4 xrefs:
// > `non-virtual thunk to'LevelBrowserLayer::setIDPopupClosed @ 0x6ecea8
// > LevelListLayer::setIDPopupClosed @ 0xa77be0
// > ??> @ 0x3a0b0
// > ??> @ 0x115db90
//
// 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 LevelBrowserLayer::setIDPopupClosed(LevelBrowserLayer *a1, SetIDPopup *a2, int a3)
{
int m_lastPage; // w1
int v6; // w19
GJSearchObject *v7; // x0
GJSearchObject *PageObject; // x0
GameManager *v9; // x0
GJSearchObject *m_searchObject; // x2
GJSearchObject *v11; // x0
GameManager *v12; // x0
int v13; // w2
const char *v14; // x1
int v15; // [xsp+28h] [xbp+28h]
if ( a2->getTag(a2) == 4 )
{
if ( a3 < 0 )
{
a3 = 0;
}
else if ( a3 >= 1000 )
{
a3 = 999;
}
if ( a1->m_searchObject )
{
v9 = GameManager::sharedState();
m_searchObject = a1->m_searchObject;
v9->m_currentLevelID = 0;
m_searchObject->m_folder = a3;
m_searchObject->m_page = 0;
LevelBrowserLayer::loadPage(a1, m_searchObject);
v11 = a1->m_searchObject;
if ( v11 && v11->m_searchType == SavedLevels )
{
v12 = GameManager::sharedState();
v13 = a3;
v14 = "0092";
}
else
{
v12 = GameManager::sharedState();
v13 = a3;
v14 = "0091";
}
GameManager::setIntGameVariable(v12, v14, v13);
}
}
else
{
m_lastPage = a1->m_lastPage;
v6 = a3 - 1;
if ( v6 < m_lastPage || m_lastPage <= 0 )
{
v7 = a1->m_searchObject;
m_lastPage = v6;
if ( !v7 )
return;
}
else
{
v7 = a1->m_searchObject;
if ( !v7 )
return;
}
if ( m_lastPage != v7->m_page )
{
v15 = m_lastPage;
GameManager::sharedState()->m_currentLevelID = 0;
PageObject = GJSearchObject::getPageObject(a1->m_searchObject, v15);
LevelBrowserLayer::loadPage(a1, PageObject);
}
}
}