//
// GameLevelManager::getSavedLevelLists from 0x1005468e0 to 0x1005469ac (204 bytes)
//
// 3 xrefs:
// > LevelBrowserLayer::loadPage @ 0x1004848e5
// > LevelBrowserLayer::FLAlert_Clicked @ 0x100488388
// > sub_100940480 @ 0x1009404ee
//
// This function is hookable on this platform (idp: pc, 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 12:31:59 +0000
//
__int64 __fastcall GameLevelManager::getSavedLevelLists(__int64 a1, int a2)
{
__int64 v3; // rbx
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // r15
__int64 v7; // rsi
__int64 v8; // rsi
v3 = sub_1007FE900(a1);
v4 = *(_QWORD *)(a1 + 784);
if ( v4 )
{
v5 = *(_QWORD *)(v4 + 56);
if ( v5 )
{
v6 = *(_QWORD *)(v5 + 288);
if ( a2 > 0 )
{
while ( 1 )
{
v8 = *(_QWORD *)(v5 + 264);
if ( *(_DWORD *)(v8 + 368) == a2 )
sub_1007FEBF0(v3, v8);
if ( !v6 )
break;
v5 = v6;
v6 = *(_QWORD *)(v6 + 288);
}
}
else
{
sub_1007FEBF0(v3, *(_QWORD *)(v5 + 264));
while ( v6 )
{
v7 = *(_QWORD *)(v6 + 264);
v6 = *(_QWORD *)(v6 + 288);
sub_1007FEBF0(v3, v7);
}
}
}
}
if ( (unsigned int)sub_1007FEF90(v3) )
qsort(
*(void **)(*(_QWORD *)(v3 + 56) + 16LL),
**(unsigned int **)(v3 + 56),
8u,
(int (__cdecl *)(const void *, const void *))sub_10051B950);
return v3;
}