//
// GameLevelManager::cleanupDailyLevels from 0x3c0040 to 0x3c0142 (258 bytes)
//
// 1 xrefs:
// > GameLevelManager::encodeDataTo @ 0x3c7b3c
//
// 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 GameLevelManager::cleanupDailyLevels(GameLevelManager *a1)
{
unsigned int v2; // r5
int v3; // r9
int v4; // r8
cocos2d::CCArray *v5; // r6
int v6; // r0
cocos2d::CCString *v7; // r0
char *CString; // r0
char *v9; // r10
int v10; // r3
int v11; // [sp+4h] [bp-20h]
cocos2d::CCDictionary *m_dailyLevels; // [sp+Ch] [bp-18h]
cocos2d::CCDictionary *v13; // [sp+Ch] [bp-18h]
cocos2d::CCDictionary *v14; // [sp+Ch] [bp-18h]
std::string v15; // [sp+18h] [bp-Ch] BYREF
v2 = 0;
v3 = 0;
v4 = 0;
v11 = 0;
v5 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
while ( v2 < cocos2d::CCArray::count(v5) )
{
v6 = cocos2d::CCArray::count(v5);
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, ~v2 + v6);
CString = (char *)cocos2d::CCString::getCString(v7);
m_dailyLevels = a1->m_dailyLevels;
v9 = CString;
sub_776584((int)&v15, CString);
v13 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_dailyLevels, &v15);
sub_774008(&v15);
v10 = v13[9].m_uAutoReleaseCount - v13[9].m_eObjType;
if ( v10 > 100000 )
{
if ( v10 > 200000 )
{
if ( v10 >= v11 )
{
v11 = v13[9].m_uAutoReleaseCount - v13[9].m_eObjType;
goto LABEL_12;
}
}
else if ( v10 >= v3 )
{
v3 = v13[9].m_uAutoReleaseCount - v13[9].m_eObjType;
goto LABEL_12;
}
}
else if ( v10 >= v4 )
{
v4 = v13[9].m_uAutoReleaseCount - v13[9].m_eObjType;
goto LABEL_12;
}
BYTE1(v13[12].m_uID) = 1;
LOBYTE(v13[12].m_uID) = 1;
if ( v13[8].m_eObjType - v13[8].m_uIndexInArray <= 0 )
{
v14 = a1->m_dailyLevels;
sub_776584((int)&v15, v9);
cocos2d::CCDictionary::removeObjectForKey(v14);
sub_774008(&v15);
}
LABEL_12:
++v2;
}
}