//
// GameLevelManager::dataLoaded from 0x10009b128 to 0x10009bc04 (2780 bytes)
//
// 1 xrefs:
// > GameManager::dataLoaded @ 0x10031bac4
//
// 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::dataLoaded(GameLevelManager *a1, DS_Dictionary *a2)
{
cocos2d::CCDictionary *DictForKey; // x0
cocos2d::CCDictElement *m_pElements; // x25
cocos2d::CCDictElement *v6; // x23
cocos2d::CCObject *m_pObject; // x0
GJGameLevel *v8; // x23
const void *v9; // x0
GJGameLevel *v10; // x0
GJGameLevel *v11; // x24
GameStatsManager *v12; // x0
GJGameLevel *v13; // x0
__int64 v14; // x24
__int64 v15; // x23
const void *v16; // x0
GJGameLevel *v17; // x23
GJGameLevel *v18; // x23
GameStatsManager *v19; // x0
cocos2d::CCDictionary *v20; // x0
cocos2d::CCDictElement *next; // x24
cocos2d::CCDictElement *v22; // x23
cocos2d::CCObject *v23; // x0
GJGameLevel *v24; // x23
const void *v25; // x0
GJGameLevel *v26; // x0
GJGameLevel *v27; // x23
GameStatsManager *v28; // x0
cocos2d::CCDictionary *v29; // x0
cocos2d::CCDictElement *v30; // x24
cocos2d::CCDictElement *v31; // x23
cocos2d::CCObject *v32; // x0
GJGameLevel *v33; // x23
const void *v34; // x0
GJGameLevel *v35; // x0
GJGameLevel *v36; // x23
GameStatsManager *v37; // x0
cocos2d::CCArray *ArrayForKey; // x22
cocos2d::CCDictionary *v39; // x21
__int64 v40; // x23
const void *v41; // x0
_DWORD *v42; // x0
_DWORD *v43; // x27
cocos2d::CCString *v44; // x0
char *CString; // x0
cocos2d::CCDictElement *v46; // x24
cocos2d::CCDictElement *v47; // x23
cocos2d::CCObject *v48; // x0
_DWORD *v49; // x23
const void *v50; // x0
_DWORD *v51; // x0
_DWORD *v52; // x1
cocos2d::CCDictionary *v53; // x1
cocos2d::CCDictionary *m_followedCreators; // x0
cocos2d::CCDictionary *v55; // x0
cocos2d::CCDictionary *v56; // x0
cocos2d::CCDictionary *v57; // x0
cocos2d::CCDictElement *v58; // x21
cocos2d::CCDictElement *v59; // x22
unsigned int v60; // w0
cocos2d::CCDictElement *v61; // x24
cocos2d::CCDictionary *m_likedLevels; // x22
__int64 v63; // x0
__int64 v64; // x22
cocos2d::CCDictionary *v65; // x22
cocos2d::CCString *m_trueString; // x23
cocos2d::CCDictionary *v67; // x0
cocos2d::CCDictElement *v68; // x21
cocos2d::CCDictElement *v69; // x22
unsigned int v70; // w0
cocos2d::CCDictElement *v71; // x24
cocos2d::CCDictionary *m_ratedLevels; // x22
__int64 v73; // x0
__int64 v74; // x22
cocos2d::CCDictionary *v75; // x22
cocos2d::CCString *v76; // x23
cocos2d::CCDictionary *v77; // x0
cocos2d::CCDictElement *v78; // x21
cocos2d::CCDictElement *v79; // x22
unsigned int v80; // w0
cocos2d::CCDictElement *v81; // x24
cocos2d::CCDictionary *m_ratedDemons; // x22
__int64 v83; // x0
__int64 v84; // x22
cocos2d::CCDictionary *v85; // x22
cocos2d::CCString *v86; // x23
cocos2d::CCDictionary *v87; // x0
cocos2d::CCDictionary *v88; // x1
cocos2d::CCDictionary *m_onlineFolders; // x0
cocos2d::CCDictionary *v90; // x1
cocos2d::CCDictionary *m_localLevelsFolders; // x0
cocos2d::CCArray *v92; // x0
void *__p[2]; // [xsp+8h] [xbp-68h] BYREF
char v94; // [xsp+1Fh] [xbp-51h]
DictForKey = DS_Dictionary::getDictForKey(a2, "GLM_01", 0);
if ( a1->m_mainLevels )
{
if ( DictForKey )
{
m_pElements = DictForKey->m_pElements;
if ( m_pElements )
{
while ( 1 )
{
v6 = m_pElements;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
sub_100009900(__p, v6->m_szKey);
m_pObject = v6->m_pObject;
if ( m_pObject )
v8 = (GJGameLevel *)__dynamic_cast(
m_pObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v8 = nullptr;
v9 = (const void *)cocos2d::CCDictionary::objectForKey_1(a1->m_mainLevels, __p);
if ( v9 )
{
v10 = (GJGameLevel *)__dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( v8 )
{
v11 = v10;
if ( v10 )
{
GJGameLevel::handleStatsConflict(v10);
v8 = v11;
}
else
{
LABEL_12:
cocos2d::CCDictionary::setObject_1(a1->m_mainLevels, v8, __p);
}
if ( v8->m_normalPercent.random - v8->m_normalPercent.seed >= 100 )
{
v12 = GameStatsManager::sharedState();
GameStatsManager::completedLevel(v12, v8);
}
}
}
else if ( v8 )
{
goto LABEL_12;
}
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( !m_pElements )
break;
}
else if ( !m_pElements )
{
break;
}
}
}
}
}
else
{
sub_10009A998((__int64)a1, DictForKey);
}
v13 = (GJGameLevel *)DS_Dictionary::getDictForKey(a2, "GLM_03", 0);
if ( a1->m_onlineLevels )
{
if ( v13 )
{
v14 = *(_QWORD *)&v13->m_fRotationX;
if ( v14 )
{
while ( 1 )
{
v15 = v14;
v14 = *(_QWORD *)(v14 + 288);
sub_100009900(__p, (char *)v15);
v16 = *(const void **)(v15 + 264);
if ( v16 )
v17 = (GJGameLevel *)__dynamic_cast(
v16,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v17 = nullptr;
v13 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey_1(a1->m_onlineLevels, __p);
if ( v13 )
{
v13 = (GJGameLevel *)__dynamic_cast(
v13,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( v17 )
{
if ( v13 )
{
if ( v13->m_levelVersion > v17->m_levelVersion )
v17 = v13;
GJGameLevel::handleStatsConflict(v17);
cocos2d::CCDictionary::setObject_1(a1->m_onlineLevels, v17, __p);
}
else
{
LABEL_34:
cocos2d::CCDictionary::setObject_1(a1->m_onlineLevels, v17, __p);
}
v13 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey_1(a1->m_onlineLevels, __p);
v18 = v13;
if ( v13->m_normalPercent.random - v13->m_normalPercent.seed >= 100 )
{
v19 = GameStatsManager::sharedState();
GameStatsManager::completedLevel(v19, v18);
}
}
}
else if ( v17 )
{
goto LABEL_34;
}
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( !v14 )
break;
}
else if ( !v14 )
{
break;
}
}
}
}
}
else
{
sub_10009AC20((__int64)a1, v13);
}
GameLevelManager::verifyContainerOnlyHasLevels((GameLevelManager *)v13, a1->m_onlineLevels);
v20 = DS_Dictionary::getDictForKey(a2, "GLM_10", 0);
if ( a1->m_dailyLevels )
{
if ( v20 )
{
next = v20->m_pElements;
if ( next )
{
while ( 1 )
{
v22 = next;
next = (cocos2d::CCDictElement *)next->hh.next;
sub_100009900(__p, v22->m_szKey);
v23 = v22->m_pObject;
if ( v23 )
v24 = (GJGameLevel *)__dynamic_cast(
v23,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v24 = nullptr;
v25 = (const void *)cocos2d::CCDictionary::objectForKey_1(a1->m_dailyLevels, __p);
if ( v25 )
{
v26 = (GJGameLevel *)__dynamic_cast(
v25,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( v24 )
{
if ( v26 )
{
if ( v26->m_levelVersion > v24->m_levelVersion )
v24 = v26;
GJGameLevel::handleStatsConflict(v24);
cocos2d::CCDictionary::setObject_1(a1->m_dailyLevels, v24, __p);
}
else
{
LABEL_56:
cocos2d::CCDictionary::setObject_1(a1->m_dailyLevels, v24, __p);
}
v27 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey_1(a1->m_dailyLevels, __p);
if ( v27->m_orbCompletion.random - v27->m_orbCompletion.seed >= 100 )
{
v28 = GameStatsManager::sharedState();
GameStatsManager::completedLevel(v28, v27);
}
}
}
else if ( v24 )
{
goto LABEL_56;
}
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( !next )
break;
}
else if ( !next )
{
break;
}
}
}
}
}
else
{
sub_10009AC68((__int64)a1, v20);
}
v29 = DS_Dictionary::getDictForKey(a2, "GLM_16", 0);
if ( a1->m_gauntletLevels )
{
if ( v29 )
{
v30 = v29->m_pElements;
if ( v30 )
{
while ( 1 )
{
v31 = v30;
v30 = (cocos2d::CCDictElement *)v30->hh.next;
sub_100009900(__p, v31->m_szKey);
v32 = v31->m_pObject;
if ( v32 )
v33 = (GJGameLevel *)__dynamic_cast(
v32,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v33 = nullptr;
v34 = (const void *)cocos2d::CCDictionary::objectForKey_1(a1->m_gauntletLevels, __p);
if ( v34 )
{
v35 = (GJGameLevel *)__dynamic_cast(
v34,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( v33 )
{
if ( v35 )
{
if ( v35->m_levelVersion > v33->m_levelVersion )
v33 = v35;
GJGameLevel::handleStatsConflict(v33);
cocos2d::CCDictionary::setObject_1(a1->m_gauntletLevels, v33, __p);
}
else
{
LABEL_78:
cocos2d::CCDictionary::setObject_1(a1->m_gauntletLevels, v33, __p);
}
v36 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey_1(a1->m_gauntletLevels, __p);
if ( v36->m_orbCompletion.random - v36->m_orbCompletion.seed >= 100 )
{
v37 = GameStatsManager::sharedState();
GameStatsManager::completedLevel(v37, v36);
}
}
}
else if ( v33 )
{
goto LABEL_78;
}
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( !v30 )
break;
}
else if ( !v30 )
{
break;
}
}
}
}
}
else
{
sub_10009ACB0((__int64)a1, v29);
}
ArrayForKey = DS_Dictionary::getArrayForKey(a2, "GLM_22", 0);
v39 = cocos2d::CCDictionary::create();
if ( (unsigned int)sub_10024A36C(ArrayForKey) )
{
v40 = 0;
do
{
v41 = (const void *)sub_10024A388(ArrayForKey, v40);
if ( v41 )
{
v42 = __dynamic_cast(
v41,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJLevelList,
0);
if ( v42 )
{
v43 = v42;
v44 = (cocos2d::CCString *)sub_100268F4C("%i", v42[86]);
CString = (char *)cocos2d::CCString::getCString(v44);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(v39, v43, __p);
if ( v94 < 0 )
operator delete(__p[0]);
}
}
v40 = (unsigned int)(v40 + 1);
}
while ( (unsigned int)v40 < (unsigned int)sub_10024A36C(ArrayForKey) );
}
if ( a1->m_favoriteLists )
{
if ( v39 )
{
v46 = v39->m_pElements;
if ( v46 )
{
while ( 1 )
{
v47 = v46;
v46 = (cocos2d::CCDictElement *)v46->hh.next;
sub_100009900(__p, v47->m_szKey);
v48 = v47->m_pObject;
if ( v48 )
v49 = __dynamic_cast(
v48,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJLevelList,
0);
else
v49 = nullptr;
v50 = (const void *)cocos2d::CCDictionary::objectForKey_1(a1->m_favoriteLists, __p);
if ( v50 )
{
v51 = __dynamic_cast(
v50,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJLevelList,
0);
if ( v49 )
{
if ( v51 )
{
if ( v51[87] <= v49[87] )
v52 = v49;
else
v52 = v51;
cocos2d::CCDictionary::setObject_1(a1->m_favoriteLists, v52, __p);
goto LABEL_109;
}
LABEL_108:
cocos2d::CCDictionary::setObject_1(a1->m_favoriteLists, v49, __p);
}
}
else if ( v49 )
{
goto LABEL_108;
}
LABEL_109:
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( !v46 )
break;
}
else if ( !v46 )
{
break;
}
}
}
}
}
else
{
sub_10009AD88((__int64)a1, v39);
}
a1->m_activeDailyID = DS_Dictionary::getIntegerForKey(a2, "GLM_11");
a1->m_activeWeeklyID = DS_Dictionary::getIntegerForKey(a2, "GLM_17");
a1->m_activeEventID = DS_Dictionary::getIntegerForKey(a2, "GLM_23");
DS_Dictionary::addBoolValuesToMapForKey(a2, &a1->m_availableFilters, "GLM_09", 0);
DS_Dictionary::addBoolValuesToMapForKeySpecial(a2, &a1->m_availableFilters, "GLM_04", 0);
v53 = DS_Dictionary::getDictForKey(a2, "GLM_06", 0);
m_followedCreators = a1->m_followedCreators;
if ( m_followedCreators )
GameToolbox::mergeDictsSaveLargestInt(m_followedCreators, v53);
else
sub_10009AD40((__int64)a1, v53);
v55 = DS_Dictionary::getDictForKey(a2, "GLM_07", 0);
if ( !a1->m_downloadedLevels )
sub_10009A9E0((__int64)a1, v55);
v56 = DS_Dictionary::getDictForKey(a2, "GLM_08", 0);
if ( !a1->m_searchFilters )
sub_10009AA28((__int64)a1, v56);
v57 = DS_Dictionary::getDictForKey(a2, "GLM_12", 0);
if ( a1->m_likedLevels )
{
v58 = v57->m_pElements;
if ( v58 )
{
v59 = (cocos2d::CCDictElement *)v58->hh.next;
v60 = cocos2d::CCDictionary::count(a1->m_likedLevels);
while ( v60 <= 0x3E7 )
{
v61 = v59;
m_likedLevels = a1->m_likedLevels;
sub_100009900(__p, v58->m_szKey);
v63 = cocos2d::CCDictionary::objectForKey_1(m_likedLevels, __p);
v64 = v63;
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( v64 )
goto LABEL_132;
}
else if ( v63 )
{
goto LABEL_132;
}
v65 = a1->m_likedLevels;
m_trueString = a1->m_trueString;
sub_100009900(__p, v58->m_szKey);
cocos2d::CCDictionary::setObject_1(v65, m_trueString, __p);
if ( v94 < 0 )
operator delete(__p[0]);
LABEL_132:
if ( !v61 )
break;
v59 = (cocos2d::CCDictElement *)v61->hh.next;
v60 = cocos2d::CCDictionary::count(a1->m_likedLevels);
v58 = v61;
}
}
}
else
{
sub_10009AB48((__int64)a1, v57);
}
v67 = DS_Dictionary::getDictForKey(a2, "GLM_13", 0);
if ( a1->m_ratedLevels )
{
v68 = v67->m_pElements;
if ( v68 )
{
v69 = (cocos2d::CCDictElement *)v68->hh.next;
v70 = cocos2d::CCDictionary::count(a1->m_ratedLevels);
while ( v70 <= 0x3E7 )
{
v71 = v69;
m_ratedLevels = a1->m_ratedLevels;
sub_100009900(__p, v68->m_szKey);
v73 = cocos2d::CCDictionary::objectForKey_1(m_ratedLevels, __p);
v74 = v73;
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( v74 )
goto LABEL_145;
}
else if ( v73 )
{
goto LABEL_145;
}
v75 = a1->m_ratedLevels;
v76 = a1->m_trueString;
sub_100009900(__p, v68->m_szKey);
cocos2d::CCDictionary::setObject_1(v75, v76, __p);
if ( v94 < 0 )
operator delete(__p[0]);
LABEL_145:
if ( !v71 )
break;
v69 = (cocos2d::CCDictElement *)v71->hh.next;
v70 = cocos2d::CCDictionary::count(a1->m_ratedLevels);
v68 = v71;
}
}
}
else
{
sub_10009AA70((__int64)a1, v67);
}
v77 = DS_Dictionary::getDictForKey(a2, "GLM_15", 0);
if ( a1->m_ratedDemons )
{
v78 = v77->m_pElements;
if ( v78 )
{
v79 = (cocos2d::CCDictElement *)v78->hh.next;
v80 = cocos2d::CCDictionary::count(a1->m_ratedDemons);
while ( v80 <= 0x3E7 )
{
v81 = v79;
m_ratedDemons = a1->m_ratedDemons;
sub_100009900(__p, v78->m_szKey);
v83 = cocos2d::CCDictionary::objectForKey_1(m_ratedDemons, __p);
v84 = v83;
if ( v94 < 0 )
{
operator delete(__p[0]);
if ( v84 )
goto LABEL_158;
}
else if ( v83 )
{
goto LABEL_158;
}
v85 = a1->m_ratedDemons;
v86 = a1->m_trueString;
sub_100009900(__p, v78->m_szKey);
cocos2d::CCDictionary::setObject_1(v85, v86, __p);
if ( v94 < 0 )
operator delete(__p[0]);
LABEL_158:
if ( !v81 )
break;
v79 = (cocos2d::CCDictElement *)v81->hh.next;
v80 = cocos2d::CCDictionary::count(a1->m_ratedDemons);
v78 = v81;
}
}
}
else
{
sub_10009AAB8((__int64)a1, v77);
}
v87 = DS_Dictionary::getDictForKey(a2, "GLM_14", 0);
if ( !a1->m_reportedLevels )
sub_10009AB00((__int64)a1, v87);
v88 = DS_Dictionary::getDictForKey(a2, "GLM_18", 0);
m_onlineFolders = a1->m_onlineFolders;
if ( m_onlineFolders )
GameToolbox::mergeDictsSkipConflict(m_onlineFolders, v88);
else
sub_10009AB90((__int64)a1, v88);
v90 = DS_Dictionary::getDictForKey(a2, "GLM_19", 0);
m_localLevelsFolders = a1->m_localLevelsFolders;
if ( m_localLevelsFolders )
GameToolbox::mergeDictsSkipConflict(m_localLevelsFolders, v90);
else
sub_10009ABD8((__int64)a1, v90);
v92 = DS_Dictionary::getArrayForKey(a2, "GLM_20", 0);
if ( !a1->m_smartTemplates )
sub_10009C080(a1, v92);
a1->m_leaderboardType = Top100;
GameLevelManager::limitSavedLevels(a1);
GameLevelManager::purgeUnusedLevels(a1);
GameLevelManager::updateUsernames(a1);
}