//
// GameLevelManager::limitSavedLevels from 0x100099e30 to 0x100099f90 (352 bytes)
//
// 2 xrefs:
// > GameLevelManager::encodeDataTo @ 0x10009ae00
// > GameLevelManager::dataLoaded @ 0x10009bbd0
//
// 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::limitSavedLevels(GameLevelManager *a1)
{
cocos2d::CCArray *SavedLevels; // x21
GameManager *v3; // x0
int v4; // w20
GameManager *v5; // x0
int v6; // w23
__int64 i; // x20
GameManager *v8; // x0
cocos2d::CCArray *v9; // x21
unsigned int v10; // w24
int v11; // w25
int v12; // w0
cocos2d::CCString *v13; // x0
char *CString; // x0
cocos2d::CCDictionary *m_gauntletLevels; // x22
__int64 v16; // x22
void *__p[2]; // [xsp+8h] [xbp-58h] BYREF
char v18; // [xsp+1Fh] [xbp-41h]
SavedLevels = GameLevelManager::getSavedLevels(a1, 0, 0);
v3 = GameManager::sharedState();
if ( GameManager::getGameVariable(v3, "0042") )
v4 = 100;
else
v4 = 10;
v5 = GameManager::sharedState();
if ( GameManager::getGameVariable(v5, "0119") )
v6 = -1;
else
v6 = v4;
for ( i = 0; (unsigned int)i < (unsigned int)sub_10024A36C(SavedLevels); i = (unsigned int)(i + 1) )
*(_BYTE *)(sub_10024A388(SavedLevels, i) + 992) = (int)i > v6;
v8 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v8, "0127") )
{
v9 = cocos2d::CCDictionary::allKeys(a1->m_gauntletLevels);
if ( (unsigned int)sub_10024A36C(v9) )
{
v10 = 0;
v11 = -1;
do
{
v12 = sub_10024A36C(v9);
v13 = (cocos2d::CCString *)sub_10024A388(v9, (unsigned int)(v12 + v11));
CString = (char *)cocos2d::CCString::getCString(v13);
m_gauntletLevels = a1->m_gauntletLevels;
sub_100009900(__p, CString);
v16 = cocos2d::CCDictionary::objectForKey_1(m_gauntletLevels, __p);
if ( v18 < 0 )
operator delete(__p[0]);
*(_BYTE *)(v16 + 992) = (int)i > v6;
LODWORD(i) = i + 1;
++v10;
--v11;
}
while ( v10 < (unsigned int)sub_10024A36C(v9) );
}
}
}