//
// GameLevelManager::getSavedLevels from 0x3bf638 to 0x3bf70e (214 bytes)
//
// 4 xrefs:
// > LevelBrowserLayer::loadPage @ 0x3bb9fc
// > LevelBrowserLayer::FLAlert_Clicked @ 0x3bdb2e
// > LevelBrowserLayer::FLAlert_Clicked @ 0x3bdc10
// > GameLevelManager::limitSavedLevels @ 0x3bff48
//
// 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
//
cocos2d::CCArray *GameLevelManager::getSavedLevels(GameLevelManager *a1, bool a2, int a3)
{
unsigned int v5; // r5
cocos2d::CCArray *v6; // r4
cocos2d::CCArray *v7; // r7
int v8; // r0
cocos2d::CCString *v9; // r0
char *CString; // r0
_BOOL4 v12; // [sp+0h] [bp-Ch]
cocos2d::CCDictionary *m_onlineLevels; // [sp+4h] [bp-8h]
cocos2d::CCObject *v14; // [sp+4h] [bp-8h]
std::string v15; // [sp+10h] [bp+4h] BYREF
v12 = a2;
v5 = 0;
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v7 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
while ( v5 < cocos2d::CCArray::count(v7) )
{
v8 = cocos2d::CCArray::count(v7);
v9 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, ~v5 + v8);
CString = (char *)cocos2d::CCString::getCString(v9);
m_onlineLevels = a1->m_onlineLevels;
sub_776584((int)&v15, CString);
v14 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(m_onlineLevels, &v15);
sub_774008(&v15);
if ( !BYTE1(v14[13].m_unknown5) && (!v12 || LOBYTE(v14[10].m_uUnknown)) && (a3 <= 0 || v14[10].m_unknown2 == a3) )
cocos2d::CCArray::addObject(v6, v14);
++v5;
}
if ( cocos2d::CCArray::count(v6) )
qsort(v6->data->arr, v6->data->num, 4u, savedLevelCompare);
return v6;
}