//
// LocalLevelManager::dataLoaded from 0x1005f7e50 to 0x1005f8a84 (3124 bytes)
//
// 1 xrefs:
// > ??> @ 0x10097c240
//
// 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)
{
__int128 v2; // xmm0
cocos2d::CCArray *ArrayForKey; // rax
cocos2d::CCArray *m_localLevels; // rdi
unsigned int v5; // r15d
int v6; // r14d
LocalLevelManager *v7; // r13
cocos2d::CCArray *v8; // rbx
int v9; // eax
unsigned int v10; // eax
int v11; // ecx
bool v12; // cf
LocalLevelManager *v13; // rbx
cocos2d::CCArray *v14; // r14
cocos2d::CCArray *v15; // rdi
int v16; // ebx
LocalLevelManager *v17; // rdi
cocos2d::CCArray *v18; // r13
unsigned int v19; // ebx
__int64 v20; // rax
__int64 v21; // rax
unsigned int v22; // eax
cocos2d::CCDictionary *v23; // rdi
__int64 v24; // r12
unsigned int v25; // ebx
int v26; // r14d
int v27; // eax
int v28; // r14d
unsigned int v29; // r15d
__int64 v30; // rbx
int v31; // eax
__int64 v32; // rax
cocos2d::CCDictionary *v33; // r14
cocos2d::CCObject *v34; // rbx
int *p_m_uIndexInArray; // r14
unsigned int v36; // r15d
__int64 v37; // rax
cocos2d::CCDictionary *v38; // rbx
__int64 v39; // rax
char v40; // r14
char *v41; // rsi
char v42; // r13
size_t v43; // rdx
char *v44; // rdi
size_t v45; // rax
bool v46; // zf
bool v47; // bl
cocos2d::CCDictionary *v48; // rbx
cocos2d::CCDictionary *v49; // r14
unsigned int v50; // r15d
cocos2d::CCString *v51; // rax
const char *CString; // r13
size_t v53; // rax
std::string::size_type v54; // rbx
char *data; // r12
__int64 v56; // rax
size_t v57; // r14
__int64 v58; // rbx
cocos2d::CCArray *v59; // rax
cocos2d::CCArray *m_localLists; // rdi
unsigned int v61; // r15d
int v62; // r14d
LocalLevelManager *v63; // r13
cocos2d::CCArray *v64; // rbx
int v65; // eax
unsigned int v66; // eax
int v67; // ecx
cocos2d::CCArray *v68; // rbx
LocalLevelManager *v69; // rax
cocos2d::CCArray *v70; // rdi
unsigned int v71; // r12d
__int64 v72; // rax
__int64 v73; // r14
__int64 v74; // r15
std::string::pointer v75; // rdi
cocos2d::CCObject *v76; // rbx
void *v77; // rbx
unsigned int i; // r14d
__int64 v79; // rax
GJLevelList *v80; // r13
unsigned int v81; // eax
cocos2d::CCDictionary *v82; // rdi
__int64 v83; // r12
int v84; // r15d
unsigned int j; // ebx
int v86; // eax
int v87; // r15d
unsigned int v88; // ebx
__int64 v89; // rax
__int64 v90; // rbx
cocos2d::CCObject *v91; // rbx
unsigned int v92; // ebx
int v93; // eax
__int64 v94; // rbx
cocos2d::CCArray *v95; // r14
unsigned int v96; // r12d
cocos2d::CCString *v97; // rax
const char *v98; // r13
size_t v99; // rax
std::string::size_type v100; // rbx
char *v101; // r15
__int64 v102; // rax
size_t v103; // r14
__int64 v104; // rbx
__int128 v105; // [rsp+0h] [rbp-D0h] BYREF
void *__s2; // [rsp+10h] [rbp-C0h]
cocos2d::CCArray *v107; // [rsp+20h] [rbp-B0h]
DS_Dictionary *v108; // [rsp+28h] [rbp-A8h]
__int128 __s1; // [rsp+30h] [rbp-A0h] BYREF
void *v110; // [rsp+40h] [rbp-90h]
unsigned int v111; // [rsp+54h] [rbp-7Ch]
int *v112; // [rsp+58h] [rbp-78h]
cocos2d::CCDictionary *LevelsInNameGroups; // [rsp+60h] [rbp-70h]
void *__p; // [rsp+68h] [rbp-68h]
cocos2d::CCArray *v115; // [rsp+70h] [rbp-60h]
int v116; // [rsp+7Ch] [rbp-54h]
LocalLevelManager *v117; // [rsp+80h] [rbp-50h]
cocos2d::CCDictionary *v118; // [rsp+88h] [rbp-48h]
std::string __dst; // [rsp+90h] [rbp-40h] BYREF
v108 = a2;
ArrayForKey = DS_Dictionary::getArrayForKey(a2, "LLM_01", 0);
v117 = a1;
m_localLevels = a1->m_localLevels;
if ( m_localLevels )
{
v107 = ArrayForKey;
if ( (unsigned int)sub_100720070(m_localLevels) )
{
v5 = 1;
v6 = -1;
v7 = v117;
do
{
v8 = v7->m_localLevels;
v9 = sub_100720070(v8);
*(_DWORD *)(sub_1007200C0(v8, (unsigned int)(v9 + v6)) + 624) = v5 - 1;
v10 = sub_100720070(v7->m_localLevels);
v11 = v5 + 1;
--v6;
v12 = v5++ < v10;
}
while ( v12 );
}
else
{
v11 = 1;
v7 = v117;
}
v116 = v11;
v16 = sub_100720070(v107);
v17 = v7;
v18 = v107;
LevelsInNameGroups = LocalLevelManager::getLevelsInNameGroups(v17);
if ( (unsigned int)sub_100720070(v107) )
{
v116 += v16;
v19 = 0;
do
{
v111 = v19;
v20 = sub_1007200C0(v18, v19);
*(_BYTE *)(v20 + 670) = 0;
v46 = (*(_BYTE *)(v20 + 344) & 1) == 0;
v118 = (cocos2d::CCDictionary *)v20;
if ( v46 )
{
v21 = v20 + 344;
__dst.__r_.__value_.__r.__words[2] = *(_QWORD *)(v21 + 16);
v2 = *(_OWORD *)v21;
*(_OWORD *)&__dst.__r_.__value_.__l.0 = *(_OWORD *)v21;
v22 = (unsigned int)__dst.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_16;
}
else
{
sub_100006B70(&__dst, *(const void **)(v20 + 360), *(_QWORD *)(v20 + 352), *(double *)&v2);
v22 = (unsigned int)__dst.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_16:
if ( !(v22 >> 1) )
goto LABEL_20;
goto LABEL_21;
}
}
if ( !__dst.__r_.__value_.__l.__size_ )
LABEL_20:
std::string::assign(&__dst, "Unknown");
LABEL_21:
v23 = LevelsInNameGroups;
v24 = cocos2d::CCDictionary::objectForKey_1((__int64)LevelsInNameGroups, (char *)&__dst);
if ( !v24 )
{
v32 = sub_10071F9E0(v23, &__dst);
v33 = v118;
v34 = (cocos2d::CCObject *)v32;
sub_10071FCD0(v32, v118);
v33[8].m_uOrderOfArrival = v116;
cocos2d::CCDictionary::setObject_1((__int64)LevelsInNameGroups, v34, (char *)&__dst);
--v116;
goto LABEL_56;
}
v25 = 0;
v26 = 0;
while ( v25 < (unsigned int)sub_100720070(v24) )
{
v27 = *(_DWORD *)(sub_1007200C0(v24, v25) + 604);
if ( v27 > v26 )
v26 = v27;
++v25;
}
v28 = v26 + 1;
v29 = 0;
do
{
if ( v29 >= (unsigned int)sub_100720070(v24) )
{
p_m_uIndexInArray = &v118[5].m_uIndexInArray;
v36 = 0;
v112 = &v118[5].m_uIndexInArray;
while ( 1 )
{
if ( v36 >= (unsigned int)sub_100720070(v24) )
{
v48 = v118;
sub_10071FCD0(v24, v118);
v31 = v116;
v48[8].m_uOrderOfArrival = v116;
LABEL_54:
v116 = v31 - 1;
goto LABEL_56;
}
v37 = sub_1007200C0(v24, v36);
v38 = v118;
if ( (*(_BYTE *)(v37 + 392) & 1) != 0 )
{
sub_100006B70(&__s1, *(const void **)(v37 + 408), *(_QWORD *)(v37 + 400), *(double *)&v2);
}
else
{
v39 = v37 + 392;
v110 = *(void **)(v39 + 16);
v2 = *(_OWORD *)v39;
__s1 = *(_OWORD *)v39;
}
if ( (*(_BYTE *)p_m_uIndexInArray & 1) != 0 )
{
sub_100006B70(
&v105,
*(const void **)&v38[5].m_uOrderOfArrival,
*(_QWORD *)&v38[5].m_unknown2,
*(double *)&v2);
}
else
{
__s2 = *((void **)p_m_uIndexInArray + 2);
v2 = *(_OWORD *)p_m_uIndexInArray;
v105 = *(_OWORD *)p_m_uIndexInArray;
}
v40 = v105;
v41 = (char *)__s2;
v42 = __s1 & 1;
if ( (__s1 & 1) != 0 )
{
v43 = *((_QWORD *)&__s1 + 1);
v44 = (char *)v110;
__p = __s2;
if ( (v105 & 1) != 0 )
goto LABEL_46;
}
else
{
v43 = (unsigned __int8)__s1 >> 1;
v44 = (char *)&__s1 + 1;
__p = __s2;
if ( (v105 & 1) != 0 )
{
LABEL_46:
v45 = *((_QWORD *)&v105 + 1);
goto LABEL_47;
}
}
v45 = (unsigned __int8)v105 >> 1;
v41 = (char *)&v105 + 1;
LABEL_47:
v46 = v45 == v43;
if ( v45 < v43 )
v43 = v45;
LOBYTE(v115) = v46;
v47 = memcmp(v44, v41, v43) == 0;
if ( (v40 & 1) != 0 )
{
operator delete(__p);
v42 = __s1 & 1;
}
p_m_uIndexInArray = v112;
if ( v42 )
operator delete(v110);
++v36;
v18 = v107;
if ( ((unsigned __int8)v115 & v47) != 0 )
goto LABEL_56;
}
}
v30 = sub_1007200C0(v24, v29++);
}
while ( *(_DWORD *)(v30 + 604) != v118[8].m_eObjType );
if ( *(_BYTE *)(v30 + 670) )
{
sub_10071FCD0(v24, v118);
*(_DWORD *)(v30 + 604) = v28;
v31 = v116;
v118[8].m_uOrderOfArrival = v116;
goto LABEL_54;
}
GJGameLevel::handleStatsConflict((GJGameLevel *)v118);
sub_100720220(v24, v30, 1);
sub_10071FCD0(v24, v118);
LABEL_56:
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v19 = v111 + 1;
}
while ( v19 < (unsigned int)sub_100720070(v18) );
}
sub_100720270(v117->m_localLevels);
v49 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::allKeys(LevelsInNameGroups);
if ( (unsigned int)sub_100720070(v49) )
{
v50 = 0;
v118 = v49;
do
{
v51 = cocos2d::CCArray::stringAtIndex((cocos2d::CCArray *)v49, v50);
CString = cocos2d::CCString::getCString(v51);
v53 = strlen(CString);
if ( v53 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_147:
sub_100006BF0(*(double *)&v2);
v54 = v53;
if ( v53 >= 0x17 )
{
v56 = v53 | 7;
v57 = 26;
if ( (v54 | 7) != 0x17 )
v57 = v56 + 1;
data = (char *)operator new(v57);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v57 + 1;
__dst.__r_.__value_.__l.__size_ = v54;
v49 = v118;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v53);
data = __dst.__r_.__value_.__s.__data_;
if ( !v53 )
goto LABEL_69;
}
memmove(data, CString, v54);
LABEL_69:
data[v54] = 0;
v58 = cocos2d::CCDictionary::objectForKey_1((__int64)LevelsInNameGroups, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
sub_100720050(v117->m_localLevels, v58);
++v50;
}
while ( v50 < (unsigned int)sub_100720070(v49) );
}
v13 = v117;
if ( (unsigned int)sub_100720070(v117->m_localLevels) )
qsort(
v13->m_localLevels->data->arr,
v13->m_localLevels->data->num,
8u,
(int (__cdecl *)(const void *, const void *))sub_1005F67B0);
}
else
{
v13 = v117;
if ( ArrayForKey )
{
v14 = ArrayForKey;
cocos2d::CCObject::retain(ArrayForKey);
v15 = v117->m_localLevels;
if ( v15 )
{
cocos2d::CCObject::release(v15);
v13 = v117;
}
v13->m_localLevels = v14;
}
}
v59 = DS_Dictionary::getArrayForKey(v108, "LLM_03", 0);
m_localLists = v13->m_localLists;
if ( m_localLists )
{
__p = v59;
if ( (unsigned int)sub_100720070(m_localLists) )
{
v61 = 1;
v62 = -1;
v63 = v117;
do
{
v64 = v63->m_localLists;
v65 = sub_100720070(v64);
*(_DWORD *)(sub_1007200C0(v64, (unsigned int)(v65 + v62)) + 376) = v61 - 1;
v66 = sub_100720070(v63->m_localLists);
v67 = v61 + 1;
--v62;
v12 = v61++ < v66;
}
while ( v12 );
}
else
{
v67 = 1;
v63 = v117;
}
LODWORD(v115) = v67;
LODWORD(v112) = sub_100720070(__p);
v118 = cocos2d::CCDictionary::create();
if ( (unsigned int)sub_100720070(v63->m_localLists) )
{
v71 = 0;
do
{
v72 = sub_1007200C0(v63->m_localLists, v71);
v73 = v72;
v74 = v72 + 424;
if ( (*(_BYTE *)(v72 + 424) & 1) != 0 )
{
sub_100006B70(&__dst, *(const void **)(v72 + 440), *(_QWORD *)(v72 + 432), *(double *)&v2);
}
else
{
__dst.__r_.__value_.__r.__words[2] = *(_QWORD *)(v72 + 440);
v2 = *(_OWORD *)v74;
*(_OWORD *)&__dst.__r_.__value_.__l.0 = *(_OWORD *)v74;
}
v75 = (std::string::pointer)v118;
v76 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey_1((__int64)v118, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
v75 = __dst.__r_.__value_.__l.__data_;
operator delete(__dst.__r_.__value_.__l.__data_);
}
if ( !v76 )
{
v76 = (cocos2d::CCObject *)sub_10071F9E0(v75, &__dst);
if ( (*(_BYTE *)v74 & 1) != 0 )
{
sub_100006B70(&__dst, *(const void **)(v73 + 440), *(_QWORD *)(v73 + 432), *(double *)&v2);
}
else
{
__dst.__r_.__value_.__r.__words[2] = *(_QWORD *)(v74 + 16);
v2 = *(_OWORD *)v74;
*(_OWORD *)&__dst.__r_.__value_.__l.0 = *(_OWORD *)v74;
}
cocos2d::CCDictionary::setObject_1((__int64)v118, v76, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}
sub_10071FCD0(v76, v73);
++v71;
v63 = v117;
}
while ( v71 < (unsigned int)sub_100720070(v117->m_localLists) );
}
v77 = __p;
if ( (unsigned int)sub_100720070(__p) )
{
LODWORD(v115) = (_DWORD)v112 + (_DWORD)v115;
for ( i = 0; i < (unsigned int)sub_100720070(__p); ++i )
{
v79 = sub_1007200C0(v77, i);
v80 = (GJLevelList *)v79;
*(_BYTE *)(v79 + 399) = 0;
if ( (*(_BYTE *)(v79 + 424) & 1) != 0 )
{
sub_100006B70(&__dst, *(const void **)(v79 + 440), *(_QWORD *)(v79 + 432), *(double *)&v2);
v81 = (unsigned int)__dst.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_102:
if ( !(v81 >> 1) )
goto LABEL_106;
goto LABEL_107;
}
}
else
{
__dst.__r_.__value_.__r.__words[2] = *(_QWORD *)(v79 + 440);
v2 = *(_OWORD *)(v79 + 424);
*(_OWORD *)&__dst.__r_.__value_.__l.0 = v2;
v81 = (unsigned __int8)v2;
if ( (v2 & 1) == 0 )
goto LABEL_102;
}
if ( !__dst.__r_.__value_.__l.__size_ )
LABEL_106:
std::string::assign(&__dst, "Unknown");
LABEL_107:
v82 = v118;
v83 = cocos2d::CCDictionary::objectForKey_1((__int64)v118, (char *)&__dst);
if ( v83 )
{
v84 = 0;
for ( j = 0; j < (unsigned int)sub_100720070(v83); ++j )
{
v86 = *(_DWORD *)(sub_1007200C0(v83, j) + 372);
if ( v86 > v84 )
v84 = v86;
}
v87 = v84 + 1;
v88 = 0;
do
{
if ( v88 >= (unsigned int)sub_100720070(v83) )
{
v92 = 0;
while ( v92 < (unsigned int)sub_100720070(v83) )
{
sub_1007200C0(v83, v92++);
if ( GJLevelList::hasMatchingLevels(v80) )
goto LABEL_127;
}
sub_10071FCD0(v83, v80);
LABEL_125:
v93 = (int)v115;
v80->m_listOrder = (int)v115;
LODWORD(v115) = v93 - 1;
goto LABEL_127;
}
v89 = sub_1007200C0(v83, v88++);
}
while ( *(_DWORD *)(v89 + 372) != v80->m_listRevision );
if ( *(_BYTE *)(v89 + 399) )
{
v90 = v89;
if ( GJLevelList::hasMatchingLevels(v80) )
goto LABEL_127;
sub_10071FCD0(v83, v80);
*(_DWORD *)(v90 + 372) = v87;
goto LABEL_125;
}
v94 = v89;
GJLevelList::handleStatsConflict(v80);
sub_100720220(v83, v94, 1);
sub_10071FCD0(v83, v80);
}
else
{
v91 = (cocos2d::CCObject *)sub_10071F9E0(v82, &__dst);
sub_10071FCD0(v91, v80);
v80->m_listOrder = (int)v115;
cocos2d::CCDictionary::setObject_1((__int64)v118, v91, (char *)&__dst);
LODWORD(v115) = (_DWORD)v115 - 1;
}
LABEL_127:
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v77 = __p;
}
}
sub_100720270(v117->m_localLists);
v95 = cocos2d::CCDictionary::allKeys(v118);
if ( (unsigned int)sub_100720070(v95) )
{
v96 = 0;
v115 = v95;
do
{
v97 = cocos2d::CCArray::stringAtIndex(v95, v96);
v98 = cocos2d::CCString::getCString(v97);
v99 = strlen(v98);
if ( v99 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_147;
v100 = v99;
if ( v99 >= 0x17 )
{
v102 = v99 | 7;
v103 = 26;
if ( (v100 | 7) != 0x17 )
v103 = v102 + 1;
v101 = (char *)operator new(v103);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v101;
__dst.__r_.__value_.__r.__words[0] = v103 + 1;
__dst.__r_.__value_.__l.__size_ = v100;
v95 = v115;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v99);
v101 = __dst.__r_.__value_.__s.__data_;
if ( !v99 )
goto LABEL_140;
}
memmove(v101, v98, v100);
LABEL_140:
v101[v100] = 0;
v104 = cocos2d::CCDictionary::objectForKey_1((__int64)v118, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
sub_100720050(v117->m_localLists, v104);
++v96;
}
while ( v96 < (unsigned int)sub_100720070(v95) );
}
if ( (unsigned int)sub_100720070(v117->m_localLists) )
qsort(
v117->m_localLists->data->arr,
v117->m_localLists->data->num,
8u,
(int (__cdecl *)(const void *, const void *))sub_1005F67E0);
}
else if ( v59 )
{
v68 = v59;
cocos2d::CCObject::retain(v59);
v69 = v117;
v70 = v117->m_localLists;
if ( v70 )
{
cocos2d::CCObject::release(v70);
v69 = v117;
}
v69->m_localLists = v68;
}
if ( DS_Dictionary::getIntegerForKey(v108, "LLM_02") <= 18 )
LocalLevelManager::updateLevelRevision(v117);
}