//
// GameLevelManager::processOnDownloadLevelCompleted from 0x100544610 to 0x10054576b (4443 bytes)
//
// 2 xrefs:
// > GameLevelManager::onDownloadLevelCompleted @ 0x10051fea2
// > GameLevelManager::onUpdateLevelCompleted @ 0x10051ff85
//
// 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
//
__int64 __fastcall GameLevelManager::processOnDownloadLevelCompleted(
GameLevelManager *a1,
unsigned __int8 *a2,
__int64 a3,
int a4,
__m128 a5)
{
cocos2d::CCArray *v8; // r15
__int64 v9; // rdx
cocos2d::CCString *v10; // rax
cocos2d::CCString *v11; // rax
cocos2d::CCString *v12; // rax
int v13; // r12d
const char *v14; // r14
void *m_levelUpdateDelegate; // rdi
cocos2d::CCArray *v16; // r15
const void *v17; // rdi
unsigned __int64 v18; // rcx
size_t v19; // rdx
__int64 (__fastcall *v20)(void *, __int64, __int64, __int64); // rax
__int64 v21; // rcx
__int64 v22; // rsi
cocos2d::CCString *v24; // rax
const char *CString; // r13
size_t v26; // rax
size_t v27; // r12
char *v28; // rbx
size_t v29; // r14
cocos2d::CCString *v30; // rax
const char *v31; // r13
size_t v32; // rax
size_t v33; // r12
char *v34; // rbx
size_t v35; // r14
cocos2d::CCString *v36; // rax
const char *v37; // r13
size_t v38; // rax
size_t v39; // r12
char *v40; // rbx
char *v41; // r14
size_t v42; // r14
cocos2d::CCString *v43; // rax
const char *v44; // r13
size_t v45; // rax
size_t v46; // r12
char *v47; // rbx
size_t v48; // r14
char v49; // r14
cocos2d::CCString *v50; // rax
const char *v51; // r12
size_t v52; // rax
size_t v53; // r13
size_t v54; // rbx
cocos2d::CCString *v55; // rax
const char *v56; // r14
size_t v57; // rax
size_t v58; // r15
char *v59; // rbx
size_t v60; // r12
MusicDownloadManager *v61; // r14
char v62; // bl
char v63; // r15
cocos2d::CCDictionary *v64; // rax
GJGameLevel *v65; // r14
GameManager *v66; // rax
unsigned int v67; // eax
int v68; // ebx
const char *data; // rdi
int v70; // eax
int v71; // r13d
__int64 v72; // r15
std::string::pointer v73; // rax
cocos2d::CCString *v74; // rax
const char *v75; // rax
const char *v76; // rbx
unsigned int v77; // eax
size_t v78; // rax
size_t v79; // r14
char *v80; // r12
size_t v81; // rbx
char v82; // bl
void *v83; // r14
size_t v84; // rcx
char *v85; // rdi
char *v86; // rsi
size_t v87; // rdx
bool v88; // zf
char v89; // r15
cocos2d::CCString *v90; // rax
const char *v91; // r14
size_t v92; // rax
std::string::size_type v93; // r12
char *v94; // rbx
void *m_levelDownloadDelegate; // rdi
size_t v96; // r13
cocos2d::CCString *v97; // rax
const char *v98; // rax
const char *v99; // rbx
unsigned int v100; // eax
size_t v101; // rax
size_t v102; // r14
char *v103; // r12
size_t v104; // rbx
char v105; // bl
void *v106; // r14
size_t v107; // rcx
char *v108; // rdi
size_t v109; // rdx
char *v110; // rsi
bool v111; // zf
char v112; // r15
GameLevelManager *v113; // rdi
int v114; // ebx
GJGameLevel *v115; // r15
int seed; // eax
int random; // ebx
void *v118; // rdi
GJGameLevel *v119; // r14
int v120; // eax
GameLevelManager *v121; // rcx
bool v122; // cc
int v123; // ebx
GJGameLevel *SavedGauntletLevel; // rax
int v125; // eax
int v126; // esi
int v127; // eax
LevelDownloadDelegate *v128; // rdi
int v129; // ebx
bool v130; // r14
cocos2d::CCString *v131; // rax
const char *v132; // rax
GameLevelManager *v133; // rdi
LevelUpdateDelegate *v134; // rdi
cocos2d::CCString *v135; // rax
const char *v136; // rax
GameLevelManager *v137; // rdi
char v138; // [rsp+0h] [rbp-240h]
__int128 v139; // [rsp+20h] [rbp-220h] BYREF
void *__p; // [rsp+30h] [rbp-210h]
__int128 v141; // [rsp+40h] [rbp-200h] BYREF
void *v142; // [rsp+50h] [rbp-1F0h]
__int128 v143; // [rsp+60h] [rbp-1E0h] BYREF
void *v144; // [rsp+70h] [rbp-1D0h]
__int128 v145; // [rsp+80h] [rbp-1C0h] BYREF
void *v146; // [rsp+90h] [rbp-1B0h]
__int64 __s1; // [rsp+A0h] [rbp-1A0h] BYREF
size_t v148; // [rsp+A8h] [rbp-198h]
void *v149; // [rsp+B0h] [rbp-190h]
std::string v150; // [rsp+B8h] [rbp-188h] BYREF
int v151; // [rsp+D4h] [rbp-16Ch]
GJGameLevel *v152; // [rsp+D8h] [rbp-168h]
__int64 v153; // [rsp+E0h] [rbp-160h] BYREF
size_t v154; // [rsp+E8h] [rbp-158h]
void *v155; // [rsp+F0h] [rbp-150h]
std::string v156; // [rsp+F8h] [rbp-148h] BYREF
std::string __str; // [rsp+110h] [rbp-130h] BYREF
__int128 __dst; // [rsp+128h] [rbp-118h] BYREF
void *v159; // [rsp+138h] [rbp-108h]
__int64 v160; // [rsp+140h] [rbp-100h] BYREF
size_t v161; // [rsp+148h] [rbp-F8h]
void *v162; // [rsp+150h] [rbp-F0h]
int v163; // [rsp+15Ch] [rbp-E4h]
GameLevelManager *v164; // [rsp+160h] [rbp-E0h]
unsigned int v165; // [rsp+168h] [rbp-D8h]
bool v166; // [rsp+16Fh] [rbp-D1h]
size_t __n[2]; // [rsp+170h] [rbp-D0h] BYREF
void *v168; // [rsp+180h] [rbp-C0h]
_BYTE v169[32]; // [rsp+1A0h] [rbp-A0h] BYREF
__int128 __s2; // [rsp+1C0h] [rbp-80h] BYREF
void *v171; // [rsp+1D0h] [rbp-70h]
_BYTE v172[32]; // [rsp+1F0h] [rbp-50h] BYREF
v8 = (cocos2d::CCArray *)sub_10052DD30((unsigned __int8 *)a3, "_", *(double *)a5.i64);
if ( !(unsigned int)sub_100720070(v8) )
{
if ( (_BYTE)a4 )
{
m_levelUpdateDelegate = a1->m_levelUpdateDelegate;
if ( !m_levelUpdateDelegate )
return __stack_chk_guard;
}
else
{
m_levelUpdateDelegate = a1->m_levelDownloadDelegate;
if ( !m_levelUpdateDelegate )
return __stack_chk_guard;
}
v20 = *(__int64 (__fastcall **)(void *, __int64, __int64, __int64))(*(_QWORD *)m_levelUpdateDelegate + 8LL);
v21 = __stack_chk_guard;
v22 = 0;
return v20(m_levelUpdateDelegate, v22, v9, v21);
}
v163 = a4;
v10 = cocos2d::CCArray::stringAtIndex(v8, 0);
v165 = cocos2d::CCString::intValue(v10);
v11 = cocos2d::CCArray::stringAtIndex(v8, 1u);
v166 = cocos2d::CCString::boolValue(v11);
v12 = cocos2d::CCArray::stringAtIndex(v8, 2u);
v13 = cocos2d::CCString::intValue(v12);
if ( (*(_BYTE *)a3 & 1) != 0 )
v14 = *(const char **)(a3 + 16);
else
v14 = (const char *)(a3 + 1);
GameLevelManager::removeDLFromActive(a1, v14);
v16 = (cocos2d::CCArray *)sub_10052DD30(a2, "#", *(double *)a5.i64);
if ( (unsigned int)sub_100720070(v16) >= 3 )
{
LOBYTE(__s2) = 4;
*(_WORD *)((char *)&__s2 + 1) = 12589;
BYTE3(__s2) = 0;
v17 = a2 + 1;
v18 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v17 = *((const void **)a2 + 2);
v18 = *((_QWORD *)a2 + 1);
}
v19 = 2;
if ( v18 < 2 )
v19 = v18;
v164 = a1;
if ( (v18 != 2) | (memcmp(v17, (char *)&__s2 + 1, v19) != 0) )
{
v151 = v13;
v24 = cocos2d::CCArray::stringAtIndex(v16, 0);
CString = cocos2d::CCString::getCString(v24);
v26 = strlen(CString);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v27 = v26;
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
v159 = v28;
*(_QWORD *)&__dst = v29 + 1;
*((_QWORD *)&__dst + 1) = v27;
}
else
{
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( !v26 )
{
LABEL_30:
v28[v27] = 0;
v30 = cocos2d::CCArray::stringAtIndex(v16, 1u);
v31 = cocos2d::CCString::getCString(v30);
v32 = strlen(v31);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v33 = v32;
v34 = (char *)&v160 + 1;
if ( v32 >= 0x17 )
{
v35 = 26;
if ( (v32 | 7) != 0x17 )
v35 = (v32 | 7) + 1;
v34 = (char *)operator new(v35);
v162 = v34;
v160 = v35 | 1;
v161 = v33;
}
else
{
LOBYTE(v160) = 2 * v32;
if ( !v32 )
{
LABEL_38:
v34[v33] = 0;
v36 = cocos2d::CCArray::stringAtIndex(v16, 2u);
v37 = cocos2d::CCString::getCString(v36);
v38 = strlen(v37);
if ( v38 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v39 = v38;
if ( v38 >= 0x17 )
{
v42 = 26;
if ( (v38 | 7) != 0x17 )
v42 = (v38 | 7) + 1;
v40 = (char *)operator new(v42);
v155 = v40;
v153 = v42 | 1;
v154 = v39;
v41 = (char *)&__s2 + 1;
}
else
{
LOBYTE(v153) = 2 * v38;
v40 = (char *)&v153 + 1;
v41 = (char *)&__s2 + 1;
if ( !v38 )
{
LABEL_46:
v40[v39] = 0;
if ( (unsigned int)sub_100720070(v16) < 4 )
goto LABEL_63;
v43 = cocos2d::CCArray::stringAtIndex(v16, 3u);
v44 = cocos2d::CCString::getCString(v43);
v45 = strlen(v44);
if ( v45 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v46 = v45;
if ( v45 >= 0x17 )
{
v48 = 26;
if ( (v45 | 7) != 0x17 )
v48 = (v45 | 7) + 1;
v47 = (char *)operator new(v48);
v171 = v47;
*(_QWORD *)&__s2 = v48 | 1;
*((_QWORD *)&__s2 + 1) = v46;
}
else
{
LOBYTE(__s2) = 2 * v45;
v47 = (char *)&__s2 + 1;
if ( !v45 )
goto LABEL_55;
}
memmove(v47, v44, v46);
LABEL_55:
v47[v46] = 0;
v49 = __s2;
if ( (__s2 & 1) != 0 )
{
sub_100006B70(&v139, v171, *((unsigned __int64 *)&__s2 + 1), *(double *)a5.i64);
}
else
{
__p = v171;
a5.i64[0] = __s2;
v139 = __s2;
}
GameLevelManager::storeUserNames((__int64)v164, (unsigned __int8 *)&v139, *(double *)a5.i64);
if ( (v139 & 1) != 0 )
operator delete(__p);
if ( (v49 & 1) != 0 )
operator delete(v171);
v41 = (char *)&__s2 + 1;
LABEL_63:
if ( (unsigned int)sub_100720070(v16) < 5 )
goto LABEL_94;
v50 = cocos2d::CCArray::stringAtIndex(v16, 4u);
v51 = cocos2d::CCString::getCString(v50);
v52 = strlen(v51);
if ( v52 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v53 = v52;
if ( v52 >= 0x17 )
{
v54 = 26;
if ( (v52 | 7) != 0x17 )
v54 = (v52 | 7) + 1;
v41 = (char *)operator new(v54);
v171 = v41;
*(_QWORD *)&__s2 = v54 | 1;
*((_QWORD *)&__s2 + 1) = v53;
}
else
{
LOBYTE(__s2) = 2 * v52;
if ( !v52 )
{
LABEL_72:
v41[v53] = 0;
if ( (unsigned int)sub_100720070(v16) < 6 )
{
v56 = "";
}
else
{
v55 = cocos2d::CCArray::stringAtIndex(v16, 5u);
v56 = cocos2d::CCString::getCString(v55);
}
v57 = strlen(v56);
if ( v57 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v58 = v57;
if ( v57 >= 0x17 )
{
v60 = 26;
if ( (v57 | 7) != 0x17 )
v60 = (v57 | 7) + 1;
v59 = (char *)operator new(v60);
v168 = v59;
__n[0] = v60 | 1;
__n[1] = v58;
}
else
{
LOBYTE(__n[0]) = 2 * v57;
v59 = (char *)__n + 1;
if ( !v57 )
{
LABEL_83:
v59[v58] = 0;
v61 = MusicDownloadManager::sharedState();
v62 = __s2;
if ( (__s2 & 1) != 0 )
{
sub_100006B70(&v141, v171, *((unsigned __int64 *)&__s2 + 1), *(double *)a5.i64);
}
else
{
v142 = v171;
a5.i64[0] = __s2;
v141 = __s2;
}
v63 = __n[0] & 1;
if ( (__n[0] & 1) != 0 )
{
sub_100006B70(&v143, v168, __n[1], *(double *)a5.i64);
}
else
{
v144 = v168;
a5.i64[0] = __n[0];
v143 = *(_OWORD *)__n;
}
MusicDownloadManager::createSongsInfo(v61, &v141, &v143);
if ( (v143 & 1) != 0 )
{
operator delete(v144);
if ( (v141 & 1) == 0 )
{
LABEL_91:
if ( !v63 )
goto LABEL_92;
goto LABEL_147;
}
}
else if ( (v141 & 1) == 0 )
{
goto LABEL_91;
}
operator delete(v142);
if ( !v63 )
{
LABEL_92:
if ( (v62 & 1) == 0 )
goto LABEL_94;
goto LABEL_93;
}
LABEL_147:
operator delete(v168);
if ( (v62 & 1) == 0 )
{
LABEL_94:
if ( (__dst & 1) != 0 )
{
sub_100006B70(&v145, v159, *((unsigned __int64 *)&__dst + 1), *(double *)a5.i64);
}
else
{
v146 = v159;
a5.i64[0] = __dst;
v145 = __dst;
}
v64 = GameLevelManager::responseToDict((__int64)&v145, 0, *(double *)a5.i64);
v65 = GJGameLevel::create(v64, 1);
if ( (v145 & 1) != 0 )
operator delete(v146);
if ( v65->m_lowDetailMode )
{
v66 = GameManager::sharedState();
if ( GameManager::getGameVariable(v66, "0108") )
v65->m_lowDetailModeToggled = 1;
}
v67 = v165;
if ( v166 )
v65->m_gauntletLevel = 1;
if ( v67 == -2 )
{
v68 = v65->m_dailyID.random - v65->m_dailyID.seed;
v65->m_dailyID.value = v68;
a5.i32[1] = 0;
a5.f32[0] = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v65->m_dailyID.seed = (int)a5.f32[0];
v65->m_dailyID.random = (int)a5.f32[0] + v68;
}
if ( (v65->m_levelString.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&__str,
v65->m_levelString.m_data.m_long.longStorage,
v65->m_levelString.m_data.m_long.size,
*(double *)a5.i64);
}
else
{
__str.__r_.__value_.__r.__words[2] = (std::string::size_type)v65->m_levelString.m_data.m_long.longStorage;
a5 = *(__m128 *)&v65->m_levelString.m_data.m_short.sizex2;
*(__m128 *)&__str.__r_.__value_.__l.0 = a5;
}
*(_WORD *)&v150.__r_.__value_.__l.0 = 0;
data = __str.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
data = __str.__r_.__value_.__l.__data_;
v152 = v65;
v70 = strlen(data);
if ( v70 > 39 )
{
a5.i32[1] = 0;
a5.f32[0] = (float)v70 / 40.0;
v71 = 40;
v72 = 0;
do
{
v73 = __str.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
v73 = __str.__r_.__value_.__l.__data_;
std::string::push_back(&v150, v73[v72]);
v72 += (int)a5.f32[0];
--v71;
}
while ( v71 );
}
else
{
std::string::operator=(&v150, &__str);
}
v74 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"Qg");
v75 = cocos2d::CCString::getCString(v74);
std::string::append(&v150, v75);
if ( (*(_BYTE *)&v150.__r_.__value_.__s.0 & 1) != 0 )
v76 = v150.__r_.__value_.__l.__data_;
else
v76 = v150.__r_.__value_.__s.__data_;
v77 = strlen(v76);
sub_100792420(v76, v77, v172);
sub_100792C00(v172, &__s2);
v78 = strlen((const char *)&__s2);
if ( v78 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v79 = v78;
if ( v78 >= 0x17 )
{
v81 = 26;
if ( (v78 | 7) != 0x17 )
v81 = (v78 | 7) + 1;
v80 = (char *)operator new(v81);
v168 = v80;
__n[0] = v81 | 1;
__n[1] = v79;
}
else
{
LOBYTE(__n[0]) = 2 * v78;
v80 = (char *)__n + 1;
if ( !v78 )
{
LABEL_128:
v80[v79] = 0;
v82 = __n[0];
v83 = v168;
if ( (__n[0] & 1) != 0 )
{
v84 = __n[1];
v85 = (char *)v168;
}
else
{
v85 = (char *)__n + 1;
v84 = LOBYTE(__n[0]) >> 1;
}
v86 = (char *)&v160 + 1;
v87 = (unsigned __int8)v160 >> 1;
if ( (v160 & 1) != 0 )
{
v87 = v161;
v86 = (char *)v162;
}
v88 = v87 == v84;
if ( v87 >= v84 )
v87 = v84;
v89 = v88 & (memcmp(v85, v86, v87) == 0);
if ( (v82 & 1) != 0 )
operator delete(v83);
if ( !v89 )
{
if ( (_BYTE)v163 )
{
m_levelDownloadDelegate = v164->m_levelUpdateDelegate;
if ( !m_levelDownloadDelegate )
goto LABEL_213;
}
else
{
m_levelDownloadDelegate = v164->m_levelDownloadDelegate;
if ( !m_levelDownloadDelegate )
goto LABEL_213;
}
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)m_levelDownloadDelegate + 8LL))(
m_levelDownloadDelegate,
v165);
goto LABEL_213;
}
v90 = (cocos2d::CCString *)sub_1007AB580("%i,%i,%i,%i,%i,%i,%i,%i", v152->m_featured);
v91 = cocos2d::CCString::getCString(v90);
v92 = strlen(v91);
if ( v92 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v93 = v92;
if ( v92 >= 0x17 )
{
v96 = 26;
if ( (v92 | 7) != 0x17 )
v96 = (v92 | 7) + 1;
v94 = (char *)operator new(v96);
v156.__r_.__value_.__r.__words[2] = (std::string::size_type)v94;
v156.__r_.__value_.__r.__words[0] = v96 | 1;
v156.__r_.__value_.__l.__size_ = v93;
}
else
{
v156.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v92);
v94 = v156.__r_.__value_.__s.__data_;
if ( !v92 )
{
LABEL_155:
v94[v93] = 0;
v97 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"Qg");
v98 = cocos2d::CCString::getCString(v97);
std::string::append(&v156, v98);
if ( (*(_BYTE *)&v156.__r_.__value_.__s.0 & 1) != 0 )
v99 = v156.__r_.__value_.__l.__data_;
else
v99 = v156.__r_.__value_.__s.__data_;
v100 = strlen(v99);
sub_100792420(v99, v100, v169);
sub_100792C00(v169, __n);
v101 = strlen((const char *)__n);
if ( v101 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v102 = v101;
if ( v101 >= 0x17 )
{
v104 = 26;
if ( (v101 | 7) != 0x17 )
v104 = (v101 | 7) + 1;
v103 = (char *)operator new(v104);
v149 = v103;
__s1 = v104 | 1;
v148 = v102;
}
else
{
LOBYTE(__s1) = 2 * v101;
v103 = (char *)&__s1 + 1;
if ( !v101 )
{
LABEL_166:
v103[v102] = 0;
v105 = __s1;
v106 = v149;
if ( (__s1 & 1) != 0 )
{
v107 = v148;
v108 = (char *)v149;
}
else
{
v108 = (char *)&__s1 + 1;
v107 = (unsigned __int8)__s1 >> 1;
}
v109 = (unsigned __int8)v153 >> 1;
if ( (v153 & 1) != 0 )
v109 = v154;
v110 = (char *)&v153 + 1;
if ( (v153 & 1) != 0 )
v110 = (char *)v155;
v111 = v109 == v107;
if ( v109 >= v107 )
v109 = v107;
v112 = v111 & (memcmp(v108, v110, v109) == 0);
if ( (v105 & 1) != 0 )
operator delete(v106);
v113 = v164;
v114 = v151;
if ( v112 )
{
if ( (_BYTE)v163 )
{
v115 = v152;
if ( v151 <= 0 )
{
random = v152->m_dailyID.random;
seed = v152->m_dailyID.seed;
}
else
{
v152->m_dailyID.value = v151;
seed = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);
v115->m_dailyID.seed = seed;
random = seed + v114;
v115->m_dailyID.random = random;
v113 = v164;
}
v122 = random <= seed;
v123 = random - seed;
if ( v122 )
{
v126 = v115->m_levelID.random - v115->m_levelID.seed;
if ( v115->m_gauntletLevel )
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(v113, v126);
else
SavedGauntletLevel = GameLevelManager::getSavedLevel(v113, v126);
}
else
{
SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(v113, v123);
}
if ( SavedGauntletLevel )
{
v129 = 0;
v130 = v115->m_levelVersion > SavedGauntletLevel->m_levelVersion;
GameLevelManager::saveLevel(v164, v115);
v131 = (cocos2d::CCString *)sub_1007AB580("%i", v138);
v132 = cocos2d::CCString::getCString(v131);
v133 = v164;
GameLevelManager::makeTimeStamp(v164, v132);
GameLevelManager::updateLevelRewards(v133, v115);
v134 = v164->m_levelUpdateDelegate;
if ( v134 )
{
LOBYTE(v129) = v130;
((void (__fastcall *)(LevelUpdateDelegate *, GJGameLevel *, _QWORD))v134->levelUpdateFinished)(
v134,
v115,
(unsigned int)(2 * v129 + 1));
}
goto LABEL_211;
}
v118 = v164->m_levelUpdateDelegate;
if ( v118 )
goto LABEL_189;
}
else
{
v119 = v152;
switch ( v165 )
{
case 0xFFFFFFFF:
GameLevelManager::saveLevel(v164, v152);
v125 = v119->m_dailyID.random - v119->m_dailyID.seed;
v121 = v164;
if ( v164->m_activeDailyID < v125 )
v164->m_activeDailyID = v125;
break;
case 0xFFFFFFFE:
GameLevelManager::saveLevel(v164, v152);
v120 = v119->m_dailyID.random - v119->m_dailyID.seed;
v121 = v164;
if ( v164->m_activeWeeklyID < v120 )
v164->m_activeWeeklyID = v120;
break;
case 0xFFFFFFFD:
GameLevelManager::saveLevel(v164, v152);
v127 = v119->m_dailyID.random - v119->m_dailyID.seed;
v121 = v164;
if ( v164->m_activeEventID < v127 )
v164->m_activeEventID = v127;
break;
default:
GameLevelManager::markLevelAsDownloaded(v164, v165);
GameLevelManager::saveLevel(v164, v119);
v135 = (cocos2d::CCString *)sub_1007AB580("%i_%i_%i", v138);
v136 = cocos2d::CCString::getCString(v135);
GameLevelManager::makeTimeStamp(v164, v136);
v137 = (GameLevelManager *)v164->m_levelDownloadDelegate;
if ( v137 )
((void (__fastcall *)(GameLevelManager *, GJGameLevel *))v137->copyWithZone)(
v137,
v119);
GameLevelManager::updateLevelRewards(v137, v119);
goto LABEL_211;
}
v128 = v121->m_levelDownloadDelegate;
if ( v128 )
((void (__fastcall *)(LevelDownloadDelegate *, GJGameLevel *))v128->levelDownloadFinished)(
v128,
v119);
}
LABEL_211:
if ( (*(_BYTE *)&v156.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v156.__r_.__value_.__l.__data_);
LABEL_213:
if ( (*(_BYTE *)&v150.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v150.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_215:
if ( (v153 & 1) == 0 )
goto LABEL_216;
goto LABEL_222;
}
}
else if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_215;
}
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v153 & 1) == 0 )
{
LABEL_216:
if ( (v160 & 1) == 0 )
goto LABEL_217;
goto LABEL_223;
}
LABEL_222:
operator delete(v155);
if ( (v160 & 1) == 0 )
{
LABEL_217:
if ( (__dst & 1) == 0 )
return __stack_chk_guard;
LABEL_218:
operator delete(v159);
return __stack_chk_guard;
}
LABEL_223:
operator delete(v162);
if ( (__dst & 1) == 0 )
return __stack_chk_guard;
goto LABEL_218;
}
if ( (_BYTE)v163 )
v118 = v164->m_levelUpdateDelegate;
else
v118 = v164->m_levelDownloadDelegate;
if ( !v118 )
goto LABEL_211;
LABEL_189:
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v118 + 8LL))(v118, v165);
goto LABEL_211;
}
}
memcpy(v103, __n, v102);
goto LABEL_166;
}
}
memmove(v94, v91, v93);
goto LABEL_155;
}
}
memcpy(v80, &__s2, v79);
goto LABEL_128;
}
LABEL_93:
operator delete(v171);
goto LABEL_94;
}
}
memmove(v59, v56, v58);
goto LABEL_83;
}
}
memmove(v41, v51, v53);
goto LABEL_72;
}
}
memmove(v40, v37, v39);
goto LABEL_46;
}
}
memmove(v34, v31, v33);
goto LABEL_38;
}
}
memmove(v28, CString, v27);
goto LABEL_30;
}
}
if ( (_BYTE)v163 )
{
m_levelUpdateDelegate = a1->m_levelUpdateDelegate;
if ( !m_levelUpdateDelegate )
return __stack_chk_guard;
goto LABEL_18;
}
m_levelUpdateDelegate = a1->m_levelDownloadDelegate;
if ( m_levelUpdateDelegate )
{
LABEL_18:
v20 = *(__int64 (__fastcall **)(void *, __int64, __int64, __int64))(*(_QWORD *)m_levelUpdateDelegate + 8LL);
v21 = __stack_chk_guard;
v22 = v165;
return v20(m_levelUpdateDelegate, v22, v9, v21);
}
return __stack_chk_guard;
}