//
// LevelPickerPopup::buildSavedPage from 0xc844d0 to 0xc846b4 (484 bytes)
//
// 6 xrefs:
// > LevelPickerPopup::onToggleKind @ 0xc847d8
// > LevelPickerPopup::onToggleFavorites @ 0xc848c8
// > LevelPickerPopup::doPageRequest @ 0xc84b28
// > LevelPickerPopup::onOnlineMode @ 0xc84c50
// > LevelPickerPopup::textChanged @ 0xc84e80
// > ??> @ 0xe4ef8
//
// 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 13:05:40 +0000
//
__int64 __fastcall LevelPickerPopup::buildSavedPage(LevelPickerPopup *this)
{
__int64 *v2; // x21
cocos2d::CCArray *v3; // x0
__int64 v4; // x22
cocos2d::CCArray *v5; // x20
int v6; // w23
int v7; // w0
__int64 v8; // x25
__int64 v9; // x1
int v10; // w0
cocos2d::CCArray *v11; // x1
char *v12; // x1
int v13; // w0
unsigned __int8 v15; // w2
char *v16; // x3
__int64 v17; // x1
__int64 v18; // x0
int v19; // [xsp+58h] [xbp+58h]
v2 = LevelPickerPopup::savedIndex(this);
LevelPickerPopup::updateMatches((__int64)this, v2);
v3 = (cocos2d::CCArray *)(unsigned int)(10 * *((_DWORD *)this + 169));
v4 = (__int64)(*((_QWORD *)this + 127) - *((_QWORD *)this + 126)) >> 2;
if ( (int)v4 <= (int)v3 )
*((_DWORD *)this + 169) = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3);
v6 = 10 * *((_DWORD *)this + 169);
v7 = v6 + 10;
v8 = 4LL * v6;
if ( (int)v4 <= v6 + 10 )
v7 = v4;
if ( v6 < v7 )
{
do
{
++v6;
v9 = *(int *)(*((_QWORD *)this + 126) + v8);
v8 += 4;
cocos2d::CCArray::addObject(v5, *(cocos2d::CCObject **)(*v2 + (v9 << 6)));
v10 = 10 * (*((_DWORD *)this + 169) + 1);
if ( (int)v4 <= v10 )
v10 = v4;
}
while ( v10 > v6 );
}
if ( (unsigned int)cocos2d::CCArray::count(v5) )
v11 = v5;
else
v11 = nullptr;
LevelPickerPopup::setupList(this, v11);
if ( !(unsigned int)cocos2d::CCArray::count(v5) )
{
if ( *((_BYTE *)this + 809) )
{
if ( *v2 == v2[1] )
{
v12 = "No saved lists";
goto LABEL_16;
}
goto LABEL_15;
}
if ( !*((_BYTE *)this + 810) )
goto LABEL_24;
v15 = *((_BYTE *)this + 872);
v16 = (char *)this + 872;
v17 = v15 >> 1;
if ( (v15 & 1) != 0 )
v17 = *((_QWORD *)this + 110);
if ( v17 )
{
LABEL_24:
if ( *v2 == v2[1] )
{
v12 = "No saved levels";
goto LABEL_16;
}
if ( !*((_BYTE *)this + 810) )
{
LABEL_15:
v12 = "Nothing found";
LABEL_16:
PagedListPopup::showStatus(this, (cocos2d::CCLabelBMFont *)v12);
goto LABEL_17;
}
v15 = *((_BYTE *)this + 872);
v12 = "No saved levels";
v16 = (char *)this + 872;
}
else
{
v12 = "No favorite levels";
if ( *v2 == v2[1] )
goto LABEL_16;
}
v18 = v15 >> 1;
if ( (v15 & 1) != 0 )
v18 = *((_QWORD *)v16 + 1);
if ( !v18 )
goto LABEL_16;
goto LABEL_15;
}
LABEL_17:
v19 = 10 * *((_DWORD *)this + 169);
v13 = cocos2d::CCArray::count(v5);
return PagedListPopup::updatePageUI(this, v4, v19, v13);
}