//
// GameLevelManager::getSavedLevels from 0x14021ef40 to 0x14021f119 (473 bytes)
//
// 6 xrefs:
// > sub_1400EACF0 @ 0x1400eae70
// > GameLevelManager::limitSavedLevels @ 0x140222253
// > LevelBrowserLayer::loadPage @ 0x1403e4bb9
// > LevelBrowserLayer::FLAlert_Clicked @ 0x1403ea7c2
// > LevelBrowserLayer::FLAlert_Clicked @ 0x1403ea8d3
// > ??> @ 0x14091bb0c
//
// 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 11:28:24 +0000
//
// Hidden C++ exception states: #wind=1
cocos2d::CCArray *__fastcall GameLevelManager::getSavedLevels(__int64 a1, char a2, int a3)
{
cocos2d::CCArray *v6; // rbp
cocos2d::CCArray *v7; // r14
unsigned int v8; // edi
__m128i si128; // xmm6
unsigned int v10; // eax
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
__int64 v14; // rbx
void *v15; // rcx
__int128 v17; // [rsp+30h] [rbp-68h] BYREF
__m128i v18; // [rsp+40h] [rbp-58h]
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v7 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 856));
v8 = 0;
if ( cocos2d::CCArray::count(v7) )
{
si128 = _mm_load_si128((const __m128i *)&Size);
do
{
v10 = cocos2d::CCArray::count(v7);
v11 = cocos2d::CCArray::objectAtIndex(v7, v10 + ~v8);
CString = cocos2d::CCString::getCString(v11);
v17 = 0;
v18 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003D230(&v17, CString, v13);
v14 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 856), &v17);
if ( v18.m128i_i64[1] > 0xFuLL )
{
v15 = (void *)v17;
if ( (unsigned __int64)(v18.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
v18 = si128;
LOBYTE(v17) = 0;
if ( !*(_BYTE *)(v14 + 1185) && (!a2 || *(_BYTE *)(v14 + 984)) && (a3 <= 0 || *(_DWORD *)(v14 + 988) == a3) )
cocos2d::CCArray::addObject(v6, (struct cocos2d::CCObject *)v14);
++v8;
}
while ( v8 < cocos2d::CCArray::count(v7) );
}
if ( cocos2d::CCArray::count(v6) )
qsort(
*(void **)(*((_QWORD *)v6 + 7) + 16LL),
**((unsigned int **)v6 + 7),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_140219080);
return v6;
}