//
// LocalLevelManager::dataLoaded from 0x1001c92fc to 0x1001c9a60 (1892 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007b9368
//
// 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 LocalLevelManager::dataLoaded(LocalLevelManager *a1, DS_Dictionary *a2)
{
DS_Dictionary *v2; // x20
cocos2d::CCArray *ArrayForKey; // x22
int updated; // w24
int v6; // w25
cocos2d::CCDictionary *LevelsInNameGroups; // x21
__int64 v8; // x23
int v9; // w20
__int64 v10; // x0
__int64 v11; // x25
std::string::size_type size; // x8
__int64 v13; // x26
__int64 v14; // x27
int v15; // w24
int v16; // w8
__int64 v17; // x27
int v18; // w24
__int64 v19; // x0
__int64 v20; // x28
__int64 v21; // x26
__int64 v22; // x27
__int64 v23; // x0
bool v24; // w28
cocos2d::CCArray *v25; // x22
unsigned int v26; // w23
cocos2d::CCString *v27; // x0
char *CString; // x0
__int64 v29; // x24
cocos2d::CCArray *v30; // x22
int v31; // w24
int v32; // w25
cocos2d::CCDictionary *v33; // x21
__int64 v34; // x23
__int64 v35; // x0
__int64 v36; // x26
std::string *v37; // x20
__int64 v38; // x0
__int64 v39; // x27
__int64 v40; // x23
int v41; // w20
__int64 v42; // x0
GJLevelList *v43; // x25
std::string::size_type v44; // x8
__int64 v45; // x26
int v46; // w24
__int64 i; // x27
int v48; // w8
__int64 v49; // x28
int v50; // w24
__int64 v51; // x0
__int64 v52; // x27
__int64 v53; // x26
__int64 v54; // x27
cocos2d::CCArray *v55; // x22
unsigned int v56; // w23
cocos2d::CCString *v57; // x0
char *v58; // x0
__int64 v59; // x24
DS_Dictionary *v60; // [xsp+8h] [xbp-B8h]
void *__p[2]; // [xsp+10h] [xbp-B0h] BYREF
__int64 v62; // [xsp+20h] [xbp-A0h]
void *v63[2]; // [xsp+30h] [xbp-90h] BYREF
__int64 v64; // [xsp+40h] [xbp-80h]
std::string __dst; // [xsp+50h] [xbp-70h] BYREF
v2 = a2;
ArrayForKey = DS_Dictionary::getArrayForKey(a2, "LLM_01", 0);
v60 = v2;
if ( a1->m_localLevels )
{
updated = LocalLevelManager::updateLevelOrder(a1);
v6 = sub_10024A36C(ArrayForKey);
LevelsInNameGroups = LocalLevelManager::getLevelsInNameGroups(a1);
if ( (unsigned int)sub_10024A36C(ArrayForKey) )
{
v8 = 0;
v9 = updated + v6 + 1;
do
{
v10 = sub_10024A388(ArrayForKey, v8);
v11 = v10;
*(_BYTE *)(v10 + 670) = 0;
if ( *(char *)(v10 + 367) < 0 )
sub_1000097D0(&__dst, *(void **)(v10 + 344), *(_QWORD *)(v10 + 352));
else
__dst = *(std::string *)(v10 + 344);
size = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __dst.__r_.__value_.__l.__size_;
if ( !size )
std::string::assign(&__dst, "Unknown");
v13 = cocos2d::CCDictionary::objectForKey_1(LevelsInNameGroups, &__dst);
if ( v13 )
{
v14 = 0;
v15 = 0;
while ( (unsigned int)v14 < (unsigned int)sub_10024A36C(v13) )
{
v16 = *(_DWORD *)(sub_10024A388(v13, v14) + 604);
if ( v16 > v15 )
v15 = v16;
v14 = (unsigned int)(v14 + 1);
}
v17 = 0;
v18 = v15 + 1;
do
{
if ( (unsigned int)v17 >= (unsigned int)sub_10024A36C(v13) )
{
v22 = 0;
while ( (unsigned int)v22 < (unsigned int)sub_10024A36C(v13) )
{
v23 = sub_10024A388(v13, v22);
if ( *(char *)(v23 + 415) < 0 )
{
sub_1000097D0(v63, *(void **)(v23 + 392), *(_QWORD *)(v23 + 400));
}
else
{
*(_OWORD *)v63 = *(_OWORD *)(v23 + 392);
v64 = *(_QWORD *)(v23 + 408);
}
if ( *(char *)(v11 + 415) < 0 )
{
sub_1000097D0(__p, *(void **)(v11 + 392), *(_QWORD *)(v11 + 400));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v11 + 392);
v62 = *(_QWORD *)(v11 + 408);
}
v24 = sub_1000045BC(v63, __p);
if ( SHIBYTE(v62) < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v64) < 0 )
operator delete(v63[0]);
v22 = (unsigned int)(v22 + 1);
if ( v24 )
goto LABEL_40;
}
sub_10024A2D0(v13, v11);
goto LABEL_38;
}
v19 = sub_10024A388(v13, v17);
v20 = v19;
v17 = (unsigned int)(v17 + 1);
}
while ( *(_DWORD *)(v19 + 604) != *(_DWORD *)(v11 + 604) );
if ( (*(_BYTE *)(v19 + 670) & 1) != 0 )
{
sub_10024A2D0(v13, v11);
*(_DWORD *)(v20 + 604) = v18;
LABEL_38:
*(_DWORD *)(v11 + 624) = v9;
goto LABEL_39;
}
GJGameLevel::handleStatsConflict((GJGameLevel *)v11);
sub_10024A444(v13, v20, 1);
sub_10024A2D0(v13, v11);
}
else
{
v21 = sub_10024A15C(0);
sub_10024A2D0(v21, v11);
*(_DWORD *)(v11 + 624) = v9;
cocos2d::CCDictionary::setObject_1(LevelsInNameGroups, v21, &__dst);
LABEL_39:
--v9;
}
LABEL_40:
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v8 = (unsigned int)(v8 + 1);
}
while ( (unsigned int)v8 < (unsigned int)sub_10024A36C(ArrayForKey) );
}
sub_10024A45C(a1->m_localLevels);
v25 = cocos2d::CCDictionary::allKeys(LevelsInNameGroups);
if ( (unsigned int)sub_10024A36C(v25) )
{
v26 = 0;
do
{
v27 = cocos2d::CCArray::stringAtIndex(v25, v26);
CString = (char *)cocos2d::CCString::getCString(v27);
sub_100009900(&__dst, CString);
v29 = cocos2d::CCDictionary::objectForKey_1(LevelsInNameGroups, &__dst);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
sub_10024A360(a1->m_localLevels, v29);
++v26;
}
while ( v26 < (unsigned int)sub_10024A36C(v25) );
}
LocalLevelManager::reorderLevels(a1);
v2 = v60;
}
else
{
sub_10009AA28((__int64)a1, ArrayForKey);
}
v30 = DS_Dictionary::getArrayForKey(v2, "LLM_03", 0);
if ( a1->m_localLists )
{
v31 = LocalLevelManager::updateListOrder(a1);
v32 = sub_10024A36C(v30);
v33 = cocos2d::CCDictionary::create();
if ( (unsigned int)sub_10024A36C(a1->m_localLists) )
{
v34 = 0;
do
{
v35 = sub_10024A388(a1->m_localLists, v34);
v36 = v35;
v37 = (std::string *)(v35 + 424);
if ( *(char *)(v35 + 447) < 0 )
{
sub_1000097D0(&__dst, *(void **)(v35 + 424), *(_QWORD *)(v35 + 432));
}
else
{
*(_OWORD *)&__dst.__r_.__value_.__l.__data_ = *(_OWORD *)&v37->__r_.__value_.__l.__data_;
__dst.__r_.__value_.__r.__words[2] = *(_QWORD *)(v35 + 440);
}
v38 = cocos2d::CCDictionary::objectForKey_1(v33, &__dst);
v39 = v38;
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(__dst.__r_.__value_.__l.__data_);
if ( !v39 )
{
LABEL_62:
v39 = sub_10024A15C(v38);
if ( *(char *)(v36 + 447) < 0 )
sub_1000097D0(&__dst, *(void **)(v36 + 424), *(_QWORD *)(v36 + 432));
else
__dst = *v37;
cocos2d::CCDictionary::setObject_1(v33, v39, &__dst);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}
}
else if ( !v38 )
{
goto LABEL_62;
}
sub_10024A2D0(v39, v36);
v34 = (unsigned int)(v34 + 1);
}
while ( (unsigned int)v34 < (unsigned int)sub_10024A36C(a1->m_localLists) );
}
if ( (unsigned int)sub_10024A36C(v30) )
{
v40 = 0;
v41 = v31 + v32 + 1;
do
{
v42 = sub_10024A388(v30, v40);
v43 = (GJLevelList *)v42;
*(_BYTE *)(v42 + 399) = 0;
if ( *(char *)(v42 + 447) < 0 )
sub_1000097D0(&__dst, *(void **)(v42 + 424), *(_QWORD *)(v42 + 432));
else
__dst = *(std::string *)(v42 + 424);
v44 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v44 = __dst.__r_.__value_.__l.__size_;
if ( !v44 )
std::string::assign(&__dst, "Unknown");
v45 = cocos2d::CCDictionary::objectForKey_1(v33, &__dst);
if ( v45 )
{
v46 = 0;
for ( i = 0; (unsigned int)i < (unsigned int)sub_10024A36C(v45); i = (unsigned int)(i + 1) )
{
v48 = *(_DWORD *)(sub_10024A388(v45, i) + 372);
if ( v48 > v46 )
v46 = v48;
}
v49 = 0;
v50 = v46 + 1;
do
{
if ( (unsigned int)v49 >= (unsigned int)sub_10024A36C(v45) )
{
v54 = 0;
while ( (unsigned int)v54 < (unsigned int)sub_10024A36C(v45) )
{
sub_10024A388(v45, v54);
v54 = (unsigned int)(v54 + 1);
if ( GJLevelList::hasMatchingLevels(v43) )
goto LABEL_98;
}
sub_10024A2D0(v45, v43);
LABEL_95:
v43->m_listOrder = v41;
goto LABEL_96;
}
v51 = sub_10024A388(v45, v49);
v52 = v51;
v49 = (unsigned int)(v49 + 1);
}
while ( *(_DWORD *)(v51 + 372) != v43->m_listRevision );
if ( (*(_BYTE *)(v51 + 399) & 1) != 0 )
{
if ( GJLevelList::hasMatchingLevels(v43) )
goto LABEL_98;
sub_10024A2D0(v45, v43);
*(_DWORD *)(v52 + 372) = v50;
goto LABEL_95;
}
GJLevelList::handleStatsConflict(v43);
sub_10024A444(v45, v52, 1);
sub_10024A2D0(v45, v43);
}
else
{
v53 = sub_10024A15C(0);
sub_10024A2D0(v53, v43);
v43->m_listOrder = v41;
cocos2d::CCDictionary::setObject_1(v33, v53, &__dst);
LABEL_96:
--v41;
}
LABEL_98:
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v40 = (unsigned int)(v40 + 1);
}
while ( (unsigned int)v40 < (unsigned int)sub_10024A36C(v30) );
}
sub_10024A45C(a1->m_localLists);
v55 = cocos2d::CCDictionary::allKeys(v33);
if ( (unsigned int)sub_10024A36C(v55) )
{
v56 = 0;
do
{
v57 = cocos2d::CCArray::stringAtIndex(v55, v56);
v58 = (char *)cocos2d::CCString::getCString(v57);
sub_100009900(&__dst, v58);
v59 = cocos2d::CCDictionary::objectForKey_1(v33, &__dst);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
sub_10024A360(a1->m_localLists, v59);
++v56;
}
while ( v56 < (unsigned int)sub_10024A36C(v55) );
}
LocalLevelManager::reorderLists(a1);
v2 = v60;
}
else
{
sub_10009AC20((__int64)a1, v30);
}
if ( DS_Dictionary::getIntegerForKey(v2, "LLM_02") <= 18 )
LocalLevelManager::updateLevelRevision(a1);
}