//
// LevelBrowserLayer::setupLevelBrowser from 0x6e8874 to 0x6e8bbc (840 bytes)
//
// 8 xrefs:
// > LevelBrowserLayer::loadLevelsFinished @ 0x6e8c8c
// > LevelBrowserLayer::loadPage @ 0x6ea400
// > LevelBrowserLayer::onEnter @ 0x6edb84
// > LevelListLayer::onRefreshLevelList @ 0xa7344c
// > LevelListLayer::init @ 0xa76a24
// > LevelListLayer::setIDPopupClosed @ 0xa77bfc
// > LevelListLayer::cellPerformedAction @ 0xa78b10
// > ??> @ 0x47778
//
// 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::setupLevelBrowser(LevelBrowserLayer *a1, cocos2d::CCArray *a2)
{
cocos2d::CCDirector *v4; // x0
cocos2d::CCTouchDispatcher *v5; // x0
cocos2d::CCDirector *v6; // x0
int m_listHeight; // w0
float v8; // s8
GJSearchObject *m_searchObject; // x2
unsigned int m_searchType; // w0
CustomListView *v11; // x22
char *v12; // x0
GJListLayer *m_list; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
unsigned int *v15; // x3
int v16; // w1
long double v17; // q0
long double v18; // q1
_BOOL4 v19; // [xsp+58h] [xbp+58h]
float v20; // [xsp+68h] [xbp+68h]
float v21; // [xsp+6Ch] [xbp+6Ch]
const char *v22; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
if ( a1->m_list )
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = v4->getTouchDispatcher(v4);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v5, a1->m_list);
a1->m_list->removeMeAndCleanup(a1->m_list);
a1->m_list = nullptr;
}
v6 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v6);
*(float *)&v17 = WinSize.width;
*(float *)&v18 = WinSize.height;
m_listHeight = a1->m_listHeight;
if ( m_listHeight <= 0 )
v8 = 220.0;
else
v8 = (float)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_16;
}
else
{
if ( m_searchType == 26 )
goto LABEL_19;
if ( m_searchType > 0x1A )
{
if ( m_searchType != 102 )
goto LABEL_9;
LABEL_16:
if ( a2 )
goto LABEL_10;
goto LABEL_17;
}
if ( m_searchType == 25 )
LABEL_19:
a2 = (cocos2d::CCArray *)((__int64 (__fastcall *)(LevelBrowserLayer *, cocos2d::CCArray *, long double, long double))a1->updateResultArray)(
a1,
a2,
v17,
v18);
}
LABEL_9:
if ( a2 )
{
LABEL_10:
v11 = CustomListView::create(a2, (BoomListType)((_DWORD)a1 + 576), v8, 356.0);
goto LABEL_11;
}
LABEL_17:
v11 = nullptr;
LABEL_11:
v19 = (unsigned int)(a1->m_searchObject->m_searchType - 25) <= 1;
LevelBrowserLayer::getSearchTitle(a1, &v22);
a1->m_list = GJListLayer::create(v11, v22, (cocos2d::ccColor4B)-12684609, 356.0, v8, v19);
v12 = (char *)(v22 - 24);
if ( v22 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v22 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v12);
}
((void (__fastcall *)(LevelBrowserLayer *))a1->addChild)(a1);
m_list = a1->m_list;
setPosition = m_list->setPosition;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v22,
(float)(v20 - 356.0) * 0.5,
(float)((float)((float)((float)(v21 - v8) * 0.5) + -10.0) + 5.0) + a1->m_unkFloat);
setPosition(m_list, (const cocos2d::CCPoint *)&v22);
}