//
// LevelBrowserLayer::setupLevelBrowser from 0x1004180d4 to 0x100418358 (644 bytes)
//
// 7 xrefs:
// > LevelListLayer::init @ 0x1002448a8
// > LevelListLayer::onRefreshLevelList @ 0x100244b60
// > LevelListLayer::cellPerformedAction @ 0x1002465fc
// > LevelListLayer::setIDPopupClosed @ 0x10024670c
// > LevelBrowserLayer::loadPage @ 0x100417178
// > LevelBrowserLayer::loadLevelsFinished @ 0x10041899c
// > LevelBrowserLayer::onEnter @ 0x1004198e4
//
// 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::setupLevelBrowser(LevelBrowserLayer *a1, cocos2d::CCArray *a2)
{
cocos2d::CCDirector *v4; // x0
cocos2d::CCTouchDispatcher *v5; // x0
cocos2d::CCDirector *v6; // x0
int m_listHeight; // w8
float v8; // s8
GJSearchObject *m_searchObject; // x9
int m_searchType; // w8
BoomListType m_folder; // w21
_BOOL4 v12; // w21
void **v13; // x1
__n128 v14; // q0
GJListLayer *m_list; // x20
__n128 v16; // q1
void *__p[2]; // [xsp+0h] [xbp-50h] BYREF
char v18; // [xsp+17h] [xbp-39h]
float v19; // [xsp+18h] [xbp-38h]
float v20; // [xsp+1Ch] [xbp-34h]
if ( a1->m_list )
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v4->getTouchDispatcher)(v4);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v5, a1->m_list);
((void (__fastcall *)(GJListLayer *))a1->m_list->removeMeAndCleanup)(a1->m_list);
a1->m_list = nullptr;
}
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
m_listHeight = a1->m_listHeight;
if ( m_listHeight <= 0 )
v8 = 220.0;
else
v8 = (float)(unsigned int)m_listHeight;
m_searchObject = a1->m_searchObject;
m_searchType = m_searchObject->m_searchType;
if ( m_searchObject->m_searchMode == 1 )
{
if ( m_searchType == 102 )
goto LABEL_8;
goto LABEL_26;
}
m_folder = Level;
if ( m_searchType > 97 )
{
if ( m_searchType > 101 )
{
if ( m_searchType == 102 )
{
LABEL_8:
if ( a1->m_isOverlay )
m_folder = LevelList3;
else
m_folder = LevelList2;
goto LABEL_27;
}
if ( m_searchType != 103 )
goto LABEL_27;
LABEL_26:
m_folder = LevelList;
goto LABEL_27;
}
if ( m_searchType == 98 )
{
m_folder = Level2;
}
else if ( m_searchType == 101 )
{
m_folder = SmartTemplate;
}
}
else if ( m_searchType > 24 )
{
if ( m_searchType == 25 )
{
a2 = (cocos2d::CCArray *)((__int64 (__fastcall *)(LevelBrowserLayer *, cocos2d::CCArray *))a1->updateResultArray)(
a1,
a2);
m_folder = Level3;
}
else if ( m_searchType == 26 )
{
m_folder = m_searchObject->m_folder;
a2 = (cocos2d::CCArray *)((__int64 (__fastcall *)(LevelBrowserLayer *, cocos2d::CCArray *))a1->updateResultArray)(
a1,
a2);
}
}
else if ( m_searchType == 9 )
{
m_folder = MapPack;
}
else if ( m_searchType == 14 )
{
m_folder = Score;
}
else
{
m_folder = Level;
}
LABEL_27:
if ( a2 )
a2 = (cocos2d::CCArray *)CustomListView::create(
a2,
&a1->TableViewCellDelegate,
v8,
356.0,
0,
m_folder,
a1->m_initialListViewY);
v12 = (unsigned int)(a1->m_searchObject->m_searchType - 25) < 2;
LevelBrowserLayer::getSearchTitle(__p, a1);
if ( v18 >= 0 )
v13 = __p;
else
v13 = (void **)__p[0];
a1->m_list = GJListLayer::create((BoomListView *)a2, (const char *)v13, (cocos2d::ccColor4B)-12684609, 356.0, v8, v12);
if ( v18 < 0 )
operator delete(__p[0]);
v14 = ((__n128 (__fastcall *)(LevelBrowserLayer *))a1->addChild)(a1);
v14.n128_f32[0] = (float)(v19 + -356.0) * 0.5;
m_list = a1->m_list;
v16.n128_f32[0] = a1->m_unkFloat + (float)((float)((float)((float)(v20 - v8) * 0.5) + -10.0) + 5.0);
sub_100022980(v14, v16, __p);
((void (__fastcall *)(GJListLayer *, void **))m_list->setPosition)(m_list, __p);
}