//
// LocalLevelManager::dataLoaded from 0x433060 to 0x433538 (1240 bytes)
//
// 0 xrefs:
//
// 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 LocalLevelManager::dataLoaded(LocalLevelManager *a1, DS_Dictionary *a2)
{
cocos2d::CCArray *ArrayForKey; // r0
cocos2d::CCArray *m_localLevels; // r0
unsigned int v5; // r10
int updated; // r5
int v7; // r6
GJGameLevel *v8; // r5
cocos2d::CCArray *v9; // r7
cocos2d::CCArray *v10; // r9
unsigned int v11; // r8
int v12; // r9
int v13; // r0
unsigned int i; // r11
int v15; // r0
cocos2d::CCObject *v16; // r8
unsigned int j; // r9
unsigned int v18; // r6
cocos2d::CCArray *v19; // r7
cocos2d::CCString *v20; // r0
char *CString; // r0
cocos2d::CCArray *v22; // r9
cocos2d::CCArray *v23; // r0
cocos2d::CCArray *m_localLists; // r0
unsigned int v25; // r8
int v26; // r5
int v27; // r5
cocos2d::CCDictionary *v28; // r7
cocos2d::CCObject *v29; // r10
cocos2d::CCArray *v30; // r9
cocos2d::CCArray *v31; // r0
unsigned int k; // r11
GJLevelList *v33; // r6
cocos2d::CCArray *v34; // r8
cocos2d::CCArray *v35; // r10
unsigned int v36; // r9
int v37; // r0
cocos2d::CCDictionary *v38; // r2
unsigned int m; // r10
int v40; // r0
cocos2d::CCObject *v41; // r9
unsigned int n; // r9
unsigned int v43; // r6
cocos2d::CCArray *v44; // r8
cocos2d::CCString *v45; // r0
char *v46; // r0
cocos2d::CCArray *v47; // r10
cocos2d::CCArray *v48; // [sp+0h] [bp-2Ch]
cocos2d::CCArray *v49; // [sp+0h] [bp-2Ch]
cocos2d::CCDictionary *LevelsInNameGroups; // [sp+4h] [bp-28h]
cocos2d::CCDictionary *v51; // [sp+4h] [bp-28h]
int v53; // [sp+14h] [bp-18h]
std::string v54; // [sp+18h] [bp-14h] BYREF
_BYTE v55[4]; // [sp+1Ch] [bp-10h] BYREF
std::string v56; // [sp+20h] [bp-Ch] BYREF
ArrayForKey = DS_Dictionary::getArrayForKey(a2, "LLM_01", 0);
v48 = ArrayForKey;
if ( a1->m_localLevels )
{
v5 = 0;
updated = LocalLevelManager::updateLevelOrder(a1);
v7 = cocos2d::CCArray::count(v48) + 1 + updated;
LevelsInNameGroups = LocalLevelManager::getLevelsInNameGroups(a1);
while ( v5 < cocos2d::CCArray::count(v48) )
{
v8 = (GJGameLevel *)cocos2d::CCArray::objectAtIndex(v48, v5);
v8->m_hasBeenModified = 0;
sub_775C20(&v54);
if ( !*((_DWORD *)v54.m_data.m_data - 3) )
sub_7753D4((int)&v54, "Unknown");
v9 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(LevelsInNameGroups, &v54);
if ( v9 )
{
v11 = 0;
v12 = 0;
while ( v11 < cocos2d::CCArray::count(v9) )
{
v13 = cocos2d::CCArray::objectAtIndex(v9, v11++);
if ( v12 < *(_DWORD *)(v13 + 360) )
v12 = *(_DWORD *)(v13 + 360);
}
for ( i = 0; ; ++i )
{
if ( i >= cocos2d::CCArray::count(v9) )
{
for ( j = 0; j < cocos2d::CCArray::count(v9); ++j )
{
cocos2d::CCArray::objectAtIndex(v9, j);
sub_775C20(v55);
sub_775C20(&v56);
v53 = sub_774DBC(v55, &v56);
sub_774008(&v56);
sub_774008(v55);
if ( !v53 )
goto LABEL_31;
}
cocos2d::CCArray::addObject(v9, v8);
goto LABEL_30;
}
v15 = cocos2d::CCArray::objectAtIndex(v9, i);
v16 = (cocos2d::CCObject *)v15;
if ( *(_DWORD *)(v15 + 360) == v8->m_levelRev )
break;
}
if ( !*(_BYTE *)(v15 + 426) )
{
GJGameLevel::handleStatsConflict(v8);
cocos2d::CCArray::removeObject(v9, v16, 1);
cocos2d::CCArray::addObject(v9, v8);
goto LABEL_31;
}
cocos2d::CCArray::addObject(v9, v8);
v16[6].m_unknown5 = v12 + 1;
LABEL_30:
v8->m_levelIndex = v7--;
}
else
{
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCArray::addObject(v10, v8);
v8->m_levelIndex = v7;
cocos2d::CCDictionary::setObject((int)LevelsInNameGroups, v10);
--v7;
}
LABEL_31:
++v5;
sub_774008(&v54);
}
cocos2d::CCArray::removeAllObjects(a1->m_localLevels);
v18 = 0;
v19 = cocos2d::CCDictionary::allKeys(LevelsInNameGroups);
while ( v18 < cocos2d::CCArray::count(v19) )
{
v20 = cocos2d::CCArray::stringAtIndex(v19, v18);
CString = (char *)cocos2d::CCString::getCString(v20);
sub_776584((int)&v56, CString);
v22 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(LevelsInNameGroups, &v56);
sub_774008(&v56);
++v18;
cocos2d::CCArray::addObjectsFromArray(a1->m_localLevels, v22);
}
LocalLevelManager::reorderLevels(a1);
}
else if ( ArrayForKey )
{
cocos2d::CCObject::retain(ArrayForKey);
m_localLevels = a1->m_localLevels;
if ( m_localLevels )
cocos2d::CCObject::release(m_localLevels);
a1->m_localLevels = v48;
}
v23 = DS_Dictionary::getArrayForKey(a2, "LLM_03", 0);
v49 = v23;
if ( a1->m_localLists )
{
v25 = 0;
v26 = LocalLevelManager::updateListOrder(a1);
v27 = v26 + cocos2d::CCArray::count(v49) + 1;
v28 = cocos2d::CCDictionary::create();
while ( v25 < cocos2d::CCArray::count(a1->m_localLists) )
{
v29 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_localLists, v25);
sub_775C20(&v56);
v30 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v28, &v56);
v31 = (cocos2d::CCArray *)sub_774008(&v56);
if ( !v30 )
{
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v31);
sub_775C20(&v56);
cocos2d::CCDictionary::setObject((int)v28, v30);
sub_774008(&v56);
}
cocos2d::CCArray::addObject(v30, v29);
++v25;
}
for ( k = 0; k < cocos2d::CCArray::count(v49); ++k )
{
v33 = (GJLevelList *)cocos2d::CCArray::objectAtIndex(v49, k);
v33->m_modified = 0;
sub_775C20(&v56);
if ( !*((_DWORD *)v56.m_data.m_data - 3) )
sub_7753D4((int)&v56, "Unknown");
v34 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v28, &v56);
if ( v34 )
{
v36 = 0;
v51 = nullptr;
while ( v36 < cocos2d::CCArray::count(v34) )
{
v37 = cocos2d::CCArray::objectAtIndex(v34, v36);
v38 = v51;
++v36;
if ( (int)v51 < *(_DWORD *)(v37 + 304) )
v38 = *(cocos2d::CCDictionary **)(v37 + 304);
v51 = v38;
}
for ( m = 0; ; ++m )
{
if ( m >= cocos2d::CCArray::count(v34) )
{
for ( n = 0; n < cocos2d::CCArray::count(v34); ++n )
{
cocos2d::CCArray::objectAtIndex(v34, n);
if ( GJLevelList::hasMatchingLevels(v33) )
goto LABEL_72;
}
cocos2d::CCArray::addObject(v34, v33);
goto LABEL_71;
}
v40 = cocos2d::CCArray::objectAtIndex(v34, m);
v41 = (cocos2d::CCObject *)v40;
if ( *(_DWORD *)(v40 + 304) == v33->m_listRevision )
break;
}
if ( !*(_BYTE *)(v40 + 331) )
{
GJLevelList::handleStatsConflict(v33);
cocos2d::CCArray::removeObject(v34, v41, 1);
cocos2d::CCArray::addObject(v34, v33);
goto LABEL_72;
}
if ( !GJLevelList::hasMatchingLevels(v33) )
{
cocos2d::CCArray::addObject(v34, v33);
v41[5].m_uOrderOfArrival = (int)&v51->__vftable + 1;
LABEL_71:
v33->m_listOrder = v27--;
}
}
else
{
v35 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCArray::addObject(v35, v33);
v33->m_listOrder = v27;
cocos2d::CCDictionary::setObject((int)v28, v35);
--v27;
}
LABEL_72:
sub_774008(&v56);
}
cocos2d::CCArray::removeAllObjects(a1->m_localLists);
v43 = 0;
v44 = cocos2d::CCDictionary::allKeys(v28);
while ( v43 < cocos2d::CCArray::count(v44) )
{
v45 = cocos2d::CCArray::stringAtIndex(v44, v43);
v46 = (char *)cocos2d::CCString::getCString(v45);
sub_776584((int)&v56, v46);
v47 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v28, &v56);
sub_774008(&v56);
++v43;
cocos2d::CCArray::addObjectsFromArray(a1->m_localLists, v47);
}
LocalLevelManager::reorderLists(a1);
}
else if ( v23 )
{
cocos2d::CCObject::retain(v23);
m_localLists = a1->m_localLists;
if ( m_localLists )
cocos2d::CCObject::release(m_localLists);
a1->m_localLists = v49;
}
if ( DS_Dictionary::getIntegerForKey(a2, "LLM_02") <= 18 )
LocalLevelManager::updateLevelRevision(a1);
}