//
// GameLevelManager::limitSavedLevels from 0x3bff30 to 0x3c0030 (256 bytes)
//
// 2 xrefs:
// > GameLevelManager::encodeDataTo @ 0x3c7b16
// > GameLevelManager::dataLoaded @ 0x3d8f70
//
// 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::limitSavedLevels(GameLevelManager *a1)
{
unsigned int v2; // r6
cocos2d::CCArray *SavedLevels; // r4
GameManager *v4; // r0
int v5; // r8
GameManager *v6; // r0
int v7; // r0
bool v8; // cc
char v9; // r3
GameManager *v10; // r0
unsigned int GameVariable; // r4
cocos2d::CCArray *v12; // r9
int v13; // r0
cocos2d::CCString *v14; // r0
char *CString; // r0
char v16; // r3
cocos2d::CCDictionary *m_gauntletLevels; // [sp+4h] [bp-18h]
int v18; // [sp+4h] [bp-18h]
std::string v19; // [sp+10h] [bp-Ch] BYREF
v2 = 0;
SavedLevels = GameLevelManager::getSavedLevels(a1, 0, 0);
v4 = GameManager::sharedState();
if ( GameManager::getGameVariable(v4, "0042") )
v5 = 100;
else
v5 = 10;
v6 = GameManager::sharedState();
if ( GameManager::getGameVariable(v6, "0119") )
v5 = -1;
while ( v2 < cocos2d::CCArray::count(SavedLevels) )
{
v7 = cocos2d::CCArray::objectAtIndex(SavedLevels, v2);
v8 = (int)v2++ <= v5;
v9 = !v8;
*(_BYTE *)(v7 + 724) = v9;
}
v10 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v10, "0127");
if ( !GameVariable )
{
v12 = cocos2d::CCDictionary::allKeys(a1->m_gauntletLevels);
while ( GameVariable < cocos2d::CCArray::count(v12) )
{
v13 = cocos2d::CCArray::count(v12);
v14 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v12, ~GameVariable + v13);
CString = (char *)cocos2d::CCString::getCString(v14);
m_gauntletLevels = a1->m_gauntletLevels;
sub_776584((int)&v19, CString);
v18 = cocos2d::CCDictionary::objectForKey(m_gauntletLevels, &v19);
sub_774008(&v19);
v8 = (int)(GameVariable + v2) <= v5;
++GameVariable;
v16 = !v8;
*(_BYTE *)(v18 + 724) = v16;
}
}
}