//
// GameLevelManager::updateLevelOrders from 0x3bf7f4 to 0x3bf8ce (218 bytes)
//
// 2 xrefs:
// > GameLevelManager::encodeDataTo @ 0x3c7b22
// > GameLevelManager::encodeDataTo @ 0x3c7b28
//
// 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::updateLevelOrders(GameLevelManager *a1)
{
unsigned int v2; // r7
cocos2d::CCArray *v3; // r6
cocos2d::CCArray *v4; // r8
int v5; // r0
cocos2d::CCString *v6; // r0
char *CString; // r0
signed int v8; // r4
signed int v9; // r7
int v10; // r0
int v11; // r3
cocos2d::CCDictionary *m_onlineLevels; // [sp+4h] [bp-18h]
cocos2d::CCObject *v13; // [sp+4h] [bp-18h]
std::string v14; // [sp+10h] [bp-Ch] BYREF
v2 = 0;
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v4 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
while ( v2 < cocos2d::CCArray::count(v4) )
{
v5 = cocos2d::CCArray::count(v4);
v6 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v4, ~v2 + v5);
CString = (char *)cocos2d::CCString::getCString(v6);
m_onlineLevels = a1->m_onlineLevels;
sub_776584((int)&v14, CString);
v13 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(m_onlineLevels, &v14);
sub_774008(&v14);
if ( BYTE1(v13[13].m_unknown5) )
v13[7].m_uReference = 0;
else
cocos2d::CCArray::addObject(v3, v13);
++v2;
}
if ( cocos2d::CCArray::count(v3) )
qsort(v3->data->arr, v3->data->num, 4u, savedLevelCompare);
v8 = 0;
v9 = cocos2d::CCArray::count(v3);
while ( v8 < v9 )
{
v10 = cocos2d::CCArray::objectAtIndex(v3, v8);
v11 = v9 - v8++;
*(_DWORD *)(v10 + 380) = v11;
}
}