//
// LevelBrowserLayer::setupLevelBrowser from 0x100499528 to 0x1004997ac (644 bytes)
//
// 7 xrefs:
// > LevelListLayer::init @ 0x1002e196c
// > sub_1002E1BC4 @ 0x1002e1c1c
// > LevelListLayer::cellPerformedAction @ 0x1002e3744
// > LevelListLayer::setIDPopupClosed @ 0x1002e3854
// > LevelBrowserLayer::loadPage @ 0x1004985b4
// > LevelBrowserLayer::loadLevelsFinished @ 0x100499e10
// > LevelBrowserLayer::onEnter @ 0x10049b384
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:05:58 +0000
//
__int64 __fastcall LevelBrowserLayer::setupLevelBrowser(__int64 a1, char *a2)
{
__int64 v4; // x0
__int64 v5; // x0
__int64 v6; // x0
int v7; // w8
float v8; // s8
_DWORD *v9; // x9
int v10; // w8
__int64 v11; // x21
_BOOL8 v12; // x21
void **v13; // x1
__int64 v14; // x20
void *__p[2]; // [xsp+0h] [xbp-50h] BYREF
char v17; // [xsp+17h] [xbp-39h]
__int64 v18; // [xsp+18h] [xbp-38h] BYREF
if ( *(_QWORD *)(a1 + 608) )
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 160LL))(v4);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v5, *(_QWORD *)(a1 + 608));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 608) + 536LL))(*(_QWORD *)(a1 + 608));
*(_QWORD *)(a1 + 608) = 0;
}
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6, &v18);
v7 = *(_DWORD *)(a1 + 768);
if ( v7 <= 0 )
v8 = 220.0;
else
v8 = (float)(unsigned int)v7;
v9 = *(_DWORD **)(a1 + 664);
v10 = v9[79];
if ( v9[108] == 1 )
{
if ( v10 == 102 )
goto LABEL_8;
goto LABEL_26;
}
v11 = 4;
if ( v10 > 97 )
{
if ( v10 > 101 )
{
if ( v10 == 102 )
{
LABEL_8:
if ( *(_BYTE *)(a1 + 748) )
v11 = 28;
else
v11 = 27;
goto LABEL_27;
}
if ( v10 != 103 )
goto LABEL_27;
LABEL_26:
v11 = 25;
goto LABEL_27;
}
if ( v10 == 98 )
{
v11 = 5;
}
else if ( v10 == 101 )
{
v11 = 20;
}
}
else if ( v10 > 24 )
{
if ( v10 == 25 )
{
a2 = (char *)(*(__int64 (__fastcall **)(__int64, char *))(*(_QWORD *)a1 + 1368LL))(a1, a2);
v11 = 26;
}
else if ( v10 == 26 )
{
v11 = (unsigned int)v9[105];
a2 = (char *)(*(__int64 (__fastcall **)(__int64, char *))(*(_QWORD *)a1 + 1368LL))(a1, a2);
}
}
else if ( v10 == 9 )
{
v11 = 13;
}
else if ( v10 == 14 )
{
v11 = 12;
}
else
{
v11 = 4;
}
LABEL_27:
if ( a2 )
a2 = CustomListView::create((__int64)a2, a1 + 576, 0, v11, v8, 356.0, *(float *)(a1 + 776));
v12 = (unsigned int)(*(_DWORD *)(*(_QWORD *)(a1 + 664) + 316LL) - 25) < 2;
LevelBrowserLayer::getSearchTitle(__p, a1);
if ( v17 >= 0 )
v13 = __p;
else
v13 = (void **)__p[0];
*(_QWORD *)(a1 + 608) = GJListLayer::create((__int64)a2, (__int64)v13, 0xFF3E72BF, v12, 356.0, v8);
if ( v17 < 0 )
operator delete(__p[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 456LL))(a1);
v14 = *(_QWORD *)(a1 + 608);
sub_1000262BC(
(float *)__p,
(float)(*(float *)&v18 + -356.0) * 0.5,
*(float *)(a1 + 772) + (float)((float)((float)((float)(*((float *)&v18 + 1) - v8) * 0.5) + -10.0) + 5.0));
return (*(__int64 (__fastcall **)(__int64, void **))(*(_QWORD *)v14 + 184LL))(v14, __p);
}