//
// GameLevelManager::purgeUnusedLevels from 0x14014a430 to 0x14014a6dc (684 bytes)
//
// 3 xrefs:
// > GameLevelManager::encodeDataTo @ 0x14014af3c
// > GameLevelManager::dataLoaded @ 0x14014c504
// > ??> @ 0x1406ca734
//
// 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
//
// Hidden C++ exception states: #wind=2
void GameLevelManager::purgeUnusedLevels(GameLevelManager *a1)
{
cocos2d::CCArray *v2; // rbp
unsigned int i; // esi
unsigned int v4; // eax
cocos2d::CCString *v5; // rax
const char *CString; // rax
const char *v7; // rdi
size_t v8; // r8
__int64 v9; // rbx
void *v10; // rcx
int v11; // ecx
size_t v12; // r8
void *v13; // rcx
__int128 v14; // [rsp+20h] [rbp-68h] BYREF
__int64 v15; // [rsp+30h] [rbp-58h]
unsigned __int64 v16; // [rsp+38h] [rbp-50h]
__int128 v17; // [rsp+40h] [rbp-48h] BYREF
__int64 v18; // [rsp+50h] [rbp-38h]
unsigned __int64 v19; // [rsp+58h] [rbp-30h]
v2 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
for ( i = 0; i < cocos2d::CCArray::count(v2); ++i )
{
v4 = cocos2d::CCArray::count(v2);
v5 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v2, v4 + -1 - i);
CString = cocos2d::CCString::getCString(v5);
v7 = CString;
v14 = 0;
v15 = 0;
v16 = 0;
v8 = -1;
do
++v8;
while ( CString[v8] );
sub_14003A930(&v14, CString, v8);
v9 = cocos2d::CCDictionary::objectForKey(a1->m_onlineLevels, &v14);
if ( v16 > 0xF )
{
v10 = (void *)v14;
if ( v16 + 1 >= 0x1000 )
{
v10 = *(void **)(v14 - 8);
if ( (unsigned __int64)(v14 - (_QWORD)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
v15 = 0;
v16 = 15;
LOBYTE(v14) = 0;
if ( *(_BYTE *)(v9 + 1073) && *(int *)(v9 + 872) <= 0 )
{
if ( (v11 = *(_DWORD *)(v9 + 816) - *(_DWORD *)(v9 + 812), v11 <= 0)
&& *(int *)(v9 + 844) <= 0
&& !*(_DWORD *)(v9 + 1300)
&& !*(_DWORD *)(v9 + 1352)
&& !*(_BYTE *)(v9 + 805)
|| *(_DWORD *)(v9 + 904) - *(_DWORD *)(v9 + 908) <= 0
&& (v11 < 10
&& *(_DWORD *)(v9 + 752) - *(_DWORD *)(v9 + 756) < 5
&& !*(_DWORD *)(v9 + 1300)
&& !*(_DWORD *)(v9 + 1352)
|| *(int *)(v9 + 856) <= 1
&& v11 < 100
&& *(_DWORD *)(v9 + 752) - *(_DWORD *)(v9 + 756) < 10
&& !*(_DWORD *)(v9 + 1300)
&& !*(_DWORD *)(v9 + 1352)) )
{
v17 = 0;
v18 = 0;
v19 = 0;
v12 = -1;
do
++v12;
while ( v7[v12] );
sub_14003A930(&v17, v7, v12);
cocos2d::CCDictionary::removeObjectForKey(a1->m_onlineLevels, &v17);
if ( v19 > 0xF )
{
v13 = (void *)v17;
if ( v19 + 1 >= 0x1000 )
{
v13 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}
}
}
}