//
// GameLevelManager::purgeUnusedLevels from 0x100099fac to 0x10009a148 (412 bytes)
//
// 2 xrefs:
// > GameLevelManager::encodeDataTo @ 0x10009ae08
// > GameLevelManager::dataLoaded @ 0x10009bbd8
//
// 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
//
void __fastcall GameLevelManager::purgeUnusedLevels(GameLevelManager *a1)
{
cocos2d::CCArray *v2; // x20
unsigned int v3; // w23
int v4; // w24
int v5; // w0
cocos2d::CCString *v6; // x0
char *CString; // x21
cocos2d::CCDictionary *m_onlineLevels; // x22
__int64 v9; // x22
int v10; // w8
int v11; // w9
bool v12; // vf
int v13; // w8
bool v14; // cc
cocos2d::CCDictionary *v15; // x22
void *__p[2]; // [xsp+8h] [xbp-48h] BYREF
char v17; // [xsp+1Fh] [xbp-31h]
v2 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
if ( (unsigned int)sub_10024A36C(v2) )
{
v3 = 0;
v4 = -1;
do
{
v5 = sub_10024A36C(v2);
v6 = (cocos2d::CCString *)sub_10024A388(v2, (unsigned int)(v5 + v4));
CString = (char *)cocos2d::CCString::getCString(v6);
m_onlineLevels = a1->m_onlineLevels;
sub_100009900(__p, CString);
v9 = cocos2d::CCDictionary::objectForKey_1(m_onlineLevels, __p);
if ( v17 < 0 )
operator delete(__p[0]);
if ( *(_BYTE *)(v9 + 993) == 1 && *(int *)(v9 + 800) <= 0 )
{
if ( (v10 = *(_DWORD *)(v9 + 744),
v11 = *(_DWORD *)(v9 + 740),
v12 = __OFSUB__(v10, v11),
v13 = v10 - v11,
(v13 < 0) ^ v12 | (v13 == 0))
&& *(int *)(v9 + 772) <= 0
&& !*(_DWORD *)(v9 + 1180)
&& !*(_DWORD *)(v9 + 1224)
&& (*(_BYTE *)(v9 + 733) & 1) == 0
|| *(_DWORD *)(v9 + 832) <= *(_DWORD *)(v9 + 836)
&& (v13 <= 9
&& *(_DWORD *)(v9 + 680) - *(_DWORD *)(v9 + 684) <= 4
&& !*(_DWORD *)(v9 + 1180)
&& !*(_DWORD *)(v9 + 1224)
|| (v13 <= 99 ? (v14 = *(_DWORD *)(v9 + 784) <= 1) : (v14 = 0),
v14
&& *(_DWORD *)(v9 + 680) - *(_DWORD *)(v9 + 684) <= 9
&& !*(_DWORD *)(v9 + 1180)
&& !*(_DWORD *)(v9 + 1224))) )
{
v15 = a1->m_onlineLevels;
sub_100009900(__p, CString);
cocos2d::CCDictionary::removeObjectForKey_1((int)v15, (char *)__p);
if ( v17 < 0 )
operator delete(__p[0]);
}
}
++v3;
--v4;
}
while ( v3 < (unsigned int)sub_10024A36C(v2) );
}
}