//
// LocalLevelManager::dataLoaded from 0x14046bb90 to 0x14046c75a (3018 bytes)
//
// 2 xrefs:
// > ??> @ 0x1407b3c20
// > ??> @ 0x1409280b8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:37 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall LocalLevelManager::dataLoaded(__int64 a1, DS_Dictionary *a2)
{
__int64 v2; // r14
unsigned int v3; // r13d
cocos2d::CCObject *ArrayForKey; // rax
cocos2d::CCArray *v5; // rsi
cocos2d::CCObject *v6; // rcx
int updated; // ebx
int v8; // r12d
__int64 v9; // rcx
cocos2d::CCDictionary *v10; // r15
unsigned int v11; // edi
struct cocos2d::CCObject *v12; // rsi
cocos2d::CCArray *v13; // rbx
__int64 v14; // rcx
_QWORD *v15; // rax
unsigned int i; // ebx
struct cocos2d::CCObject *v17; // rax
unsigned int v18; // ebx
struct cocos2d::CCObject *v19; // rsi
cocos2d::CCArray *v20; // rax
__int64 v21; // rcx
cocos2d::CCArray *v22; // rdi
cocos2d::CCArray *v23; // r15
_QWORD *v24; // r14
__int64 *v25; // rdi
__int64 *v26; // rbx
unsigned int v27; // eax
__int64 *v28; // rcx
__int64 *v29; // rcx
cocos2d::CCArray *v30; // rdx
int v31; // r14d
unsigned int v32; // ebx
int v33; // ecx
int v34; // r14d
unsigned int v35; // ebx
struct cocos2d::CCObject *v36; // rax
struct cocos2d::CCObject *v37; // r15
unsigned int v38; // r14d
struct cocos2d::CCObject *v39; // rbx
_QWORD *v40; // r15
__int64 *v41; // r14
__int64 *v42; // rbx
unsigned int v43; // eax
__int64 *v44; // rcx
__int64 *v45; // rcx
cocos2d::CCArray *v46; // rsi
unsigned int v47; // ebx
__m128i si128; // xmm6
cocos2d::CCString *v49; // rax
const char *CString; // rax
size_t v51; // r8
struct cocos2d::CCArray *v52; // rdi
void *v53; // r8
cocos2d::CCObject *v54; // rax
cocos2d::CCArray *v55; // rsi
cocos2d::CCArray *v56; // rcx
cocos2d::CCObject *v57; // rcx
_QWORD *v58; // r12
__int64 *v59; // rbx
__int64 *v60; // r13
unsigned int v61; // eax
__int64 *v62; // rcx
__int64 *v63; // rcx
unsigned int v64; // ebx
unsigned int v65; // eax
unsigned int v66; // r12d
__int64 v67; // rcx
cocos2d::CCDictionary *v68; // r15
unsigned int v69; // edi
struct cocos2d::CCObject *v70; // rsi
cocos2d::CCArray *v71; // rbx
__int64 v72; // rcx
struct cocos2d::CCObject *v73; // rsi
cocos2d::CCArray *v74; // rax
__int64 v75; // rcx
cocos2d::CCArray *v76; // rbx
cocos2d::CCArray *v77; // rbx
int v78; // r14d
unsigned int v79; // edi
int v80; // ecx
int v81; // r14d
unsigned int v82; // edi
struct cocos2d::CCObject *v83; // rax
struct cocos2d::CCObject *v84; // r15
unsigned int v85; // edi
struct cocos2d::CCObject *v86; // rax
cocos2d::CCArray *v87; // rdi
unsigned int v88; // esi
cocos2d::CCString *v89; // rax
const char *v90; // rax
size_t v91; // r8
struct cocos2d::CCArray *v92; // rbx
int v93; // eax
struct cocos2d::CCObject *v94; // rdx
int v95; // ecx
int v96; // eax
int v97; // [rsp+30h] [rbp-99h]
cocos2d::CCDictionary *v98; // [rsp+38h] [rbp-91h]
cocos2d::CCDictionary *v99; // [rsp+38h] [rbp-91h]
unsigned int v100; // [rsp+40h] [rbp-89h]
cocos2d::CCArray *v102; // [rsp+50h] [rbp-79h]
cocos2d::CCArray *v103; // [rsp+50h] [rbp-79h]
__int128 v104; // [rsp+58h] [rbp-71h] BYREF
DS_Dictionary *v105; // [rsp+68h] [rbp-61h]
void *Block[2]; // [rsp+70h] [rbp-59h] BYREF
__m128i v107; // [rsp+80h] [rbp-49h]
_QWORD Buf1[4]; // [rsp+90h] [rbp-39h] BYREF
_QWORD Buf2[4]; // [rsp+B0h] [rbp-19h] BYREF
v105 = a2;
v2 = a1;
v3 = 0;
ArrayForKey = DS_Dictionary::getArrayForKey(a2, "LLM_01", 0);
v5 = ArrayForKey;
v102 = ArrayForKey;
if ( !*(_QWORD *)(v2 + 368) )
{
if ( ArrayForKey )
{
cocos2d::CCObject::retain(ArrayForKey);
v6 = *(cocos2d::CCObject **)(v2 + 368);
if ( v6 )
cocos2d::CCObject::release(v6);
*(_QWORD *)(v2 + 368) = v5;
}
goto LABEL_69;
}
updated = LocalLevelManager::updateLevelOrder(v2);
v8 = updated + cocos2d::CCArray::count(v5) + 1;
v97 = v8;
v10 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v9);
v98 = v10;
v11 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 368)) )
{
do
{
v12 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v2 + 368), v11);
sub_14003F4F0((__int64)Block, (__int64)v12 + 344);
v13 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v10, Block);
sub_14003D310((__int64)Block);
if ( !v13 )
{
v13 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
sub_14003F4F0((__int64)Buf1, (__int64)v12 + 344);
cocos2d::CCDictionary::setObject(v10, v13, Buf1);
sub_14003D310((__int64)Buf1);
}
cocos2d::CCArray::addObject(v13, v12);
++v11;
}
while ( v11 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 368)) );
v2 = a1;
v5 = v102;
}
v104 = 0;
v15 = operator new(0x40u);
*v15 = v15;
v15[1] = v15;
v15[2] = v15;
*((_WORD *)v15 + 12) = 257;
*(_QWORD *)&v104 = v15;
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 368)); ++i )
{
v17 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v2 + 368), i);
if ( *((_QWORD *)v17 + 201) )
sub_1400CF4B0((__int64 *)&v104, (__int64)Block, (_QWORD *)v17 + 199);
}
v18 = 0;
v100 = 0;
if ( cocos2d::CCArray::count(v5) )
{
while ( 1 )
{
v19 = cocos2d::CCArray::objectAtIndex(v5, v18);
*((_BYTE *)v19 + 858) = 0;
sub_14003F4F0((__int64)Block, (__int64)v19 + 344);
if ( !v107.m128i_i64[0] )
sub_1400405A0(Block, &qword_140748070, 7u);
v20 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v10, Block);
v22 = v20;
if ( !v20 )
{
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
v24 = (_QWORD *)((char *)v19 + 1592);
v25 = (__int64 *)v104;
v26 = *(__int64 **)(v104 + 8);
if ( !*((_BYTE *)v26 + 25) )
{
do
{
v27 = (unsigned int)sub_14003D160(v26 + 4, (_QWORD *)v19 + 199) >> 31;
v28 = v26;
if ( (_BYTE)v27 )
v28 = v25;
v25 = v28;
v29 = v26 + 2;
if ( !(_BYTE)v27 )
v29 = v26;
v26 = (__int64 *)*v29;
}
while ( !*(_BYTE *)(*v29 + 25) );
}
if ( !*((_BYTE *)v25 + 25) && sub_14003D160((_QWORD *)v19 + 199, v25 + 4) >= 0 )
{
*((_QWORD *)v19 + 201) = 0;
if ( *((_QWORD *)v19 + 202) > 0xFu )
v24 = (_QWORD *)*v24;
*(_BYTE *)v24 = 0;
}
cocos2d::CCArray::addObject(v23, v19);
*((_DWORD *)v19 + 176) = v8--;
v97 = v8;
v30 = v23;
v10 = v98;
cocos2d::CCDictionary::setObject(v98, v30, Block);
goto LABEL_55;
}
v31 = 0;
v32 = 0;
if ( cocos2d::CCArray::count(v20) )
{
do
{
v33 = *((_DWORD *)cocos2d::CCArray::objectAtIndex(v22, v32) + 171);
if ( v33 <= v31 )
v33 = v31;
v31 = v33;
++v32;
}
while ( v32 < cocos2d::CCArray::count(v22) );
}
v34 = v31 + 1;
v35 = 0;
if ( cocos2d::CCArray::count(v22) )
{
while ( 1 )
{
v36 = cocos2d::CCArray::objectAtIndex(v22, v35);
v37 = v36;
if ( *((_DWORD *)v36 + 171) == *((_DWORD *)v19 + 171) )
break;
if ( ++v35 >= cocos2d::CCArray::count(v22) )
goto LABEL_38;
}
if ( !*((_BYTE *)v36 + 858) )
{
GJGameLevel::handleStatsConflict((__int64)v19, v36);
cocos2d::CCArray::removeObject(v22, v37, 1);
cocos2d::CCArray::addObject(v22, v19);
goto LABEL_54;
}
v58 = (_QWORD *)((char *)v19 + 1592);
v59 = (__int64 *)v104;
v60 = *(__int64 **)(v104 + 8);
if ( !*((_BYTE *)v60 + 25) )
{
do
{
v61 = (unsigned int)sub_14003D160(v60 + 4, (_QWORD *)v19 + 199) >> 31;
v62 = v60;
if ( (_BYTE)v61 )
v62 = v59;
v59 = v62;
v63 = v60 + 2;
if ( !(_BYTE)v61 )
v63 = v60;
v60 = (__int64 *)*v63;
}
while ( !*(_BYTE *)(*v63 + 25) );
}
if ( *((_BYTE *)v59 + 25) )
{
v3 = 0;
}
else
{
v3 = 0;
if ( sub_14003D160((_QWORD *)v19 + 199, v59 + 4) >= 0 )
{
*((_QWORD *)v19 + 201) = 0;
if ( *((_QWORD *)v19 + 202) > 0xFu )
v58 = (_QWORD *)*v58;
*(_BYTE *)v58 = 0;
}
}
cocos2d::CCArray::addObject(v22, v19);
*((_DWORD *)v37 + 171) = v34;
v8 = v97;
}
else
{
LABEL_38:
v38 = 0;
if ( cocos2d::CCArray::count(v22) )
{
do
{
v39 = cocos2d::CCArray::objectAtIndex(v22, v38);
sub_14003F4F0((__int64)Buf2, (__int64)v19 + 408);
sub_14003F4F0((__int64)Buf1, (__int64)v39 + 408);
LODWORD(v39) = sub_14003D160(Buf1, Buf2);
sub_14003D310((__int64)Buf1);
sub_14003D310((__int64)Buf2);
if ( !(_DWORD)v39 )
goto LABEL_54;
}
while ( ++v38 < cocos2d::CCArray::count(v22) );
}
v40 = (_QWORD *)((char *)v19 + 1592);
v41 = (__int64 *)v104;
v42 = *(__int64 **)(v104 + 8);
if ( !*((_BYTE *)v42 + 25) )
{
do
{
v43 = (unsigned int)sub_14003D160(v42 + 4, (_QWORD *)v19 + 199) >> 31;
v44 = v42;
if ( (_BYTE)v43 )
v44 = v41;
v41 = v44;
v45 = v42 + 2;
if ( !(_BYTE)v43 )
v45 = v42;
v42 = (__int64 *)*v45;
}
while ( !*(_BYTE *)(*v45 + 25) );
}
if ( !*((_BYTE *)v41 + 25) && sub_14003D160((_QWORD *)v19 + 199, v41 + 4) >= 0 )
{
*((_QWORD *)v19 + 201) = 0;
if ( *((_QWORD *)v19 + 202) > 0xFu )
v40 = (_QWORD *)*v40;
*(_BYTE *)v40 = 0;
}
cocos2d::CCArray::addObject(v22, v19);
}
*((_DWORD *)v19 + 176) = v8--;
v97 = v8;
LABEL_54:
v10 = v98;
LABEL_55:
sub_14003D310((__int64)Block);
v18 = ++v100;
v5 = v102;
if ( v100 >= cocos2d::CCArray::count(v102) )
{
v2 = a1;
break;
}
}
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v2 + 368));
v46 = cocos2d::CCDictionary::allKeys(v10);
v47 = 0;
if ( cocos2d::CCArray::count(v46) )
{
si128 = _mm_load_si128((const __m128i *)&Size);
do
{
v49 = cocos2d::CCArray::stringAtIndex(v46, v47);
CString = cocos2d::CCString::getCString(v49);
*(_OWORD *)Block = 0;
v107 = 0;
v51 = -1;
do
++v51;
while ( CString[v51] );
sub_14003D230(Block, CString, v51);
v52 = (struct cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v10, Block);
if ( v107.m128i_i64[1] > 0xFuLL )
{
v53 = Block[0];
if ( (unsigned __int64)(v107.m128i_i64[1] + 1) >= 0x1000 )
{
v53 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v53 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v53);
}
v107 = si128;
LOBYTE(Block[0]) = 0;
cocos2d::CCArray::addObjectsFromArray(*(cocos2d::CCArray **)(v2 + 368), v52);
++v47;
}
while ( v47 < cocos2d::CCArray::count(v46) );
}
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 368)) )
qsort(
*(void **)(*(_QWORD *)(*(_QWORD *)(v2 + 368) + 56LL) + 16LL),
**(unsigned int **)(*(_QWORD *)(v2 + 368) + 56LL),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_140219080);
sub_1400CF8C0((void **)&v104);
LABEL_69:
v54 = DS_Dictionary::getArrayForKey(v105, "LLM_03", 0);
v55 = v54;
v103 = v54;
v56 = *(cocos2d::CCArray **)(v2 + 376);
if ( !v56 )
{
if ( v54 )
{
cocos2d::CCObject::retain(v54);
v57 = *(cocos2d::CCObject **)(v2 + 376);
if ( v57 )
cocos2d::CCObject::release(v57);
*(_QWORD *)(v2 + 376) = v55;
}
goto LABEL_123;
}
v64 = 0;
if ( cocos2d::CCArray::count(v56) )
{
do
{
v65 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 376));
*((_DWORD *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v2 + 376), v65 + ~v64) + 94) = v64;
++v64;
}
while ( v64 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 376)) );
}
v66 = v64 + cocos2d::CCArray::count(v55) + 1;
v68 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v67);
v99 = v68;
v69 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 376)) )
{
do
{
v70 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v2 + 376), v69);
sub_14003F4F0((__int64)Buf2, (__int64)v70 + 440);
v71 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v68, Buf2);
sub_14003D310((__int64)Buf2);
if ( !v71 )
{
v71 = (cocos2d::CCArray *)cocos2d::CCArray::create(v72);
sub_14003F4F0((__int64)Buf1, (__int64)v70 + 440);
cocos2d::CCDictionary::setObject(v68, v71, Buf1);
sub_14003D310((__int64)Buf1);
}
cocos2d::CCArray::addObject(v71, v70);
++v69;
v2 = a1;
}
while ( v69 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 376)) );
v55 = v103;
}
if ( cocos2d::CCArray::count(v55) )
{
while ( 1 )
{
v73 = cocos2d::CCArray::objectAtIndex(v55, v3);
*((_BYTE *)v73 + 399) = 0;
sub_14003F4F0((__int64)Block, (__int64)v73 + 440);
if ( !v107.m128i_i64[0] )
sub_1400405A0(Block, &qword_140748070, 7u);
v74 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v68, Block);
v76 = v74;
if ( v74 )
{
v78 = 0;
v79 = 0;
if ( cocos2d::CCArray::count(v74) )
{
do
{
v80 = *((_DWORD *)cocos2d::CCArray::objectAtIndex(v76, v79) + 93);
if ( v80 <= v78 )
v80 = v78;
v78 = v80;
++v79;
}
while ( v79 < cocos2d::CCArray::count(v76) );
}
v81 = v78 + 1;
v82 = 0;
if ( !cocos2d::CCArray::count(v76) )
{
LABEL_109:
v85 = 0;
if ( cocos2d::CCArray::count(v76) )
{
do
{
v86 = cocos2d::CCArray::objectAtIndex(v76, v85);
if ( GJLevelList::hasMatchingLevels((__int64)v73, (__int64)v86) )
goto LABEL_114;
}
while ( ++v85 < cocos2d::CCArray::count(v76) );
}
cocos2d::CCArray::addObject(v76, v73);
goto LABEL_113;
}
while ( 1 )
{
v83 = cocos2d::CCArray::objectAtIndex(v76, v82);
v84 = v83;
if ( *((_DWORD *)v83 + 93) == *((_DWORD *)v73 + 93) )
break;
if ( ++v82 >= cocos2d::CCArray::count(v76) )
goto LABEL_109;
}
v94 = v83;
if ( !*((_BYTE *)v83 + 399) )
{
v95 = *((_DWORD *)v83 + 94);
v96 = *((_DWORD *)v73 + 94);
if ( v96 <= v95 )
v96 = v95;
*((_DWORD *)v73 + 94) = v96;
cocos2d::CCArray::removeObject(v76, v94, 1);
cocos2d::CCArray::addObject(v76, v73);
goto LABEL_114;
}
if ( !GJLevelList::hasMatchingLevels((__int64)v73, (__int64)v83) )
{
cocos2d::CCArray::addObject(v76, v73);
*((_DWORD *)v84 + 93) = v81;
LABEL_113:
*((_DWORD *)v73 + 94) = v66--;
}
}
else
{
v77 = (cocos2d::CCArray *)cocos2d::CCArray::create(v75);
cocos2d::CCArray::addObject(v77, v73);
*((_DWORD *)v73 + 94) = v66--;
cocos2d::CCDictionary::setObject(v68, v77, Block);
}
LABEL_114:
sub_14003D310((__int64)Block);
++v3;
v55 = v103;
v68 = v99;
if ( v3 >= cocos2d::CCArray::count(v103) )
{
v2 = a1;
break;
}
}
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v2 + 376));
v87 = cocos2d::CCDictionary::allKeys(v68);
if ( cocos2d::CCArray::count(v87) )
{
v88 = 0;
do
{
v89 = cocos2d::CCArray::stringAtIndex(v87, v88);
v90 = cocos2d::CCString::getCString(v89);
*(_OWORD *)Block = 0;
v107 = 0;
v91 = -1;
do
++v91;
while ( v90[v91] );
sub_14003D230(Block, v90, v91);
v92 = (struct cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v68, Block);
sub_14003D310((__int64)Block);
cocos2d::CCArray::addObjectsFromArray(*(cocos2d::CCArray **)(v2 + 376), v92);
++v88;
}
while ( v88 < cocos2d::CCArray::count(v87) );
}
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v2 + 376)) )
qsort(
*(void **)(*(_QWORD *)(*(_QWORD *)(v2 + 376) + 56LL) + 16LL),
**(unsigned int **)(*(_QWORD *)(v2 + 376) + 56LL),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_1402190B0);
LABEL_123:
DS_Dictionary::getIntegerForKey(v105, "LLM_02");
if ( v93 < 19 )
LocalLevelManager::updateLevelRevision(v2);
}