//
// GameLevelManager::onGetGJDailyLevelStateCompleted from 0x140168df0 to 0x140169b34 (3396 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140143b84
// > ??> @ 0x1406cad10
//
// 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
//
// Hidden C++ exception states: #wind=12
void __fastcall GameLevelManager::onGetGJDailyLevelStateCompleted(GameLevelManager *a1, __int64 *a2, __int64 a3)
{
unsigned __int64 *v3; // r12
const char *v5; // rdx
const void *v6; // rcx
unsigned __int64 v7; // r14
size_t v8; // r8
int v9; // edi
size_t v10; // rbx
unsigned int v11; // r15d
const void *v12; // rcx
size_t v13; // r8
int v14; // edi
const void *v15; // rcx
unsigned __int64 v16; // r14
size_t v17; // r8
int v18; // edi
const void *v19; // rcx
unsigned __int64 v20; // r14
size_t v21; // r8
int v22; // edi
GJDailyLevelDelegate *m_GJDailyLevelDelegate; // rcx
cocos2d::CCArray *v24; // rdi
unsigned int v25; // eax
cocos2d::CCString *v26; // rax
int v27; // r14d
cocos2d::CCString *v28; // rax
int v29; // esi
GJDailyLevelDelegate *v30; // rcx
cocos2d::CCString *v31; // rax
const char *CString; // rax
size_t v33; // r8
cocos2d::CCString *v34; // rax
const char *v35; // rax
size_t v36; // r8
__int64 v37; // rcx
void **v38; // rdx
__int64 v39; // r8
__int64 v40; // r9
__int64 v41; // rdx
void *v42; // rcx
__int64 v43; // xmm2_8
void **v44; // r14
unsigned __int64 v45; // rdi
cocos2d::CCString *v46; // rax
char *v47; // rax
size_t v48; // r8
void **v49; // rax
void **v50; // rcx
__int64 v51; // rdx
size_t v52; // r8
__int128 *p_Buf2; // rdx
char *v54; // rdi
unsigned __int64 v55; // r14
void **v56; // rcx
char *v57; // r15
size_t v58; // r12
__int64 v59; // r8
int v60; // esi
char *v61; // rax
GJDailyLevelDelegate *v62; // rcx
cocos2d::CCArray *v63; // rsi
GJDailyLevelDelegate *v64; // rcx
cocos2d::CCString *v65; // rax
int v66; // r15d
__int64 v67; // rcx
cocos2d::CCString *v68; // rax
cocos2d::CCString *v69; // rax
cocos2d::CCString *v70; // rax
const char *v71; // rax
size_t v72; // r8
__int64 v73; // rdx
__int64 v74; // r8
__int64 v75; // r9
void **v76; // rax
_BYTE *v77; // rsi
unsigned __int64 v78; // r12
__int64 v79; // r15
__int64 v80; // rcx
GJDailyLevelDelegate *v81; // rcx
_BYTE *v82; // rax
void *v83; // rcx
char *v84; // rax
void *v85; // rcx
__int64 v86; // rcx
__int64 v87; // r15
cocos2d::CCString *v88; // rax
const char *v89; // rax
void *v90; // rcx
_BYTE *v91; // rax
void *v92; // rcx
char *v93; // rax
void *v94; // rcx
GJDailyLevelDelegate *v95; // rcx
bool v96; // [rsp+40h] [rbp-C0h]
unsigned int v97; // [rsp+44h] [rbp-BCh]
void *v98; // [rsp+48h] [rbp-B8h]
void **v99; // [rsp+48h] [rbp-B8h]
void *v100; // [rsp+48h] [rbp-B8h]
void *Reward; // [rsp+48h] [rbp-B8h]
int v102; // [rsp+50h] [rbp-B0h]
unsigned int v104; // [rsp+60h] [rbp-A0h]
unsigned int v105; // [rsp+64h] [rbp-9Ch]
__int64 v107; // [rsp+70h] [rbp-90h]
void *Src[2]; // [rsp+88h] [rbp-78h] BYREF
__m128i v109; // [rsp+98h] [rbp-68h]
void *v110[2]; // [rsp+A8h] [rbp-58h] BYREF
__m128i v111; // [rsp+B8h] [rbp-48h]
void *v112[2]; // [rsp+C8h] [rbp-38h] BYREF
__int64 v113; // [rsp+D8h] [rbp-28h]
unsigned __int64 v114; // [rsp+E0h] [rbp-20h]
void *Block[2]; // [rsp+E8h] [rbp-18h] BYREF
unsigned __int64 v116; // [rsp+F8h] [rbp-8h]
unsigned __int64 v117; // [rsp+100h] [rbp+0h]
struct __timeb64 Time; // [rsp+108h] [rbp+8h] BYREF
__int64 v119; // [rsp+118h] [rbp+18h]
unsigned __int64 v120; // [rsp+120h] [rbp+20h]
__int128 Buf2; // [rsp+128h] [rbp+28h] BYREF
size_t Size; // [rsp+138h] [rbp+38h]
unsigned __int64 v123; // [rsp+140h] [rbp+40h]
__int64 v124[4]; // [rsp+148h] [rbp+48h] BYREF
_BYTE v125[48]; // [rsp+168h] [rbp+68h] BYREF
v3 = (unsigned __int64 *)a3;
v5 = (const char *)a3;
if ( *(_QWORD *)(a3 + 24) > 0xFu )
v5 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, v5);
Size = 12;
v123 = 15;
strcpy((char *)&Buf2, "weekly_state");
BYTE13(Buf2) = 0;
HIWORD(Buf2) = 0;
v6 = v3;
if ( v3[3] > 0xF )
v6 = (const void *)*v3;
v7 = v3[2];
v8 = v7;
if ( v7 > 0xC )
v8 = 12;
v9 = memcmp(v6, &Buf2, v8);
v10 = -1;
if ( !v9 )
{
if ( v7 >= 0xC )
v9 = v7 > 0xC;
else
v9 = -1;
}
if ( v9 )
{
v109.m128i_i64[0] = 11;
v109.m128i_i64[1] = 15;
Src[0] = (void *)0x74735F746E657665LL;
Src[1] = (void *)6648929;
v12 = v3;
if ( v3[3] > 0xF )
v12 = (const void *)*v3;
v13 = v7;
if ( v7 > 0xB )
v13 = 11;
v14 = memcmp(v12, Src, v13);
if ( !v14 )
{
if ( v7 >= 0xB )
v14 = v7 > 0xB;
else
v14 = -1;
}
v11 = 0;
if ( !v14 )
v11 = 2;
}
else
{
v11 = 1;
}
v97 = v11;
*(_OWORD *)Block = 0;
v116 = 2;
v117 = 15;
strcpy((char *)Block, "-1");
v15 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v15 = (const void *)*a2;
v16 = a2[2];
v17 = v16;
if ( v16 > 2 )
v17 = 2;
v18 = memcmp(v15, Block, v17);
if ( !v18 )
{
if ( v16 >= 2 )
v18 = v16 > 2;
else
v18 = -1;
}
if ( !v18 )
goto LABEL_49;
*(_OWORD *)Block = 0;
v116 = 2;
v117 = 15;
strcpy((char *)Block, "-2");
v19 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v19 = (const void *)*a2;
v20 = a2[2];
v21 = v20;
if ( v20 > 2 )
v21 = 2;
v22 = memcmp(v19, Block, v21);
if ( !v22 )
{
if ( v20 >= 2 )
v22 = v20 > 2;
else
v22 = -1;
}
if ( !v22 )
{
m_GJDailyLevelDelegate = a1->m_GJDailyLevelDelegate;
if ( m_GJDailyLevelDelegate )
m_GJDailyLevelDelegate->dailyStatusFailed(m_GJDailyLevelDelegate, (GJTimedLevelType)v11, UpdateApp);
LABEL_171:
sub_14003A830((__int64)a2);
v86 = (__int64)v3;
goto LABEL_172;
}
v24 = sub_140140F70(a2, "|");
v25 = cocos2d::CCArray::count(v24);
if ( v11 != 2 )
{
if ( v25 >= 2 )
goto LABEL_45;
LABEL_49:
v30 = a1->m_GJDailyLevelDelegate;
if ( v30 )
v30->dailyStatusFailed(v30, (GJTimedLevelType)v11, (GJErrorCode)0xFFFFFFFFLL);
goto LABEL_171;
}
if ( v25 < 4 )
goto LABEL_49;
LABEL_45:
v26 = cocos2d::CCArray::stringAtIndex(v24, 0);
v27 = cocos2d::CCString::intValue(v26);
v102 = v27;
v28 = cocos2d::CCArray::stringAtIndex(v24, 1u);
v29 = cocos2d::CCString::intValue(v28);
if ( !v11 )
{
ftime64(&Time);
a1->m_dailyTimeLeft = (int)((double)(Time.millitm + 1000 * (Time.time & 0xFFFFF)) / 1000.0 + (double)v29);
a1->m_dailyID = v27;
goto LABEL_169;
}
if ( v11 == 1 )
{
ftime64(&Time);
a1->m_weeklyTimeLeft = (int)((double)(Time.millitm + 1000 * (Time.time & 0xFFFFF)) / 1000.0 + (double)v29);
a1->m_weeklyID = v27;
goto LABEL_169;
}
ftime64(&Time);
a1->m_eventTimeLeft = (int)((double)(Time.millitm + 1000 * (Time.time & 0xFFFFF)) / 1000.0 + (double)v29);
a1->m_eventID = v27;
v31 = cocos2d::CCArray::stringAtIndex(v24, 2u);
CString = cocos2d::CCString::getCString(v31);
*(_OWORD *)v110 = 0;
v111 = 0u;
v33 = -1;
do
++v33;
while ( CString[v33] );
sub_14003A930(v110, CString, v33);
v34 = cocos2d::CCArray::stringAtIndex(v24, 3u);
v35 = cocos2d::CCString::getCString(v34);
Buf2 = 0;
Size = 0;
v123 = 0;
v36 = -1;
do
++v36;
while ( v35[v36] );
sub_14003A930(&Buf2, v35, v36);
*(_OWORD *)Src = 0;
v109 = 0u;
if ( v111.m128i_i64[0] < 5uLL )
sub_14003BCC0(v37);
v38 = v110;
if ( v111.m128i_i64[1] > 0xFuLL )
v38 = (void **)v110[0];
sub_14003A930(Src, (char *)v38 + 5, v111.m128i_i64[0] - 5);
v41 = v111.m128i_i64[1];
if ( v111.m128i_i64[1] > 0xFuLL )
{
v42 = v110[0];
if ( (unsigned __int64)(v111.m128i_i64[1] + 1) >= 0x1000 )
{
v42 = *((void **)v110[0] - 1);
if ( (unsigned __int64)((char *)v110[0] - (char *)v42 - 8) > 0x1F )
goto LABEL_156;
}
j_j_free(v42);
}
*(_OWORD *)v110 = *(_OWORD *)Src;
v43 = v109.m128i_i64[0];
v111 = v109;
*(_OWORD *)v112 = 0;
v113 = 0;
v114 = 0;
v44 = v110;
if ( _mm_srli_si128(v109, 8).m128i_u64[0] > 0xF )
v44 = (void **)Src[0];
v107 = 0x7FFFFFFFFFFFFFFFLL;
if ( v109.m128i_i64[0] > 0x7FFFFFFFFFFFFFFFuLL )
sub_140007B50(Src[0], v41, v39, v40);
if ( v109.m128i_i64[0] > 0xFuLL )
{
v45 = v109.m128i_i64[0] | 0xF;
if ( (v109.m128i_i64[0] | 0xFuLL) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v45 < 0x16 )
v45 = 22;
}
else
{
v45 = 0x7FFFFFFFFFFFFFFFLL;
}
v112[0] = sub_14003AA10(v45 + 1);
v113 = v43;
v114 = v45;
memcpy(v112[0], v44, v43 + 1);
}
else
{
v113 = v109.m128i_i64[0];
v114 = 15;
*(_OWORD *)v112 = *(_OWORD *)v44;
}
v46 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 112, "C26", "fpYa", 81, 67, "tg");
v47 = (char *)cocos2d::CCString::getCString(v46);
v48 = -1;
do
++v48;
while ( v47[v48] );
sub_140041270(v112, v47, v48);
v49 = v112;
if ( v114 <= 0xF )
{
v50 = v112;
}
else
{
v50 = (void **)v112[0];
v49 = (void **)v112[0];
}
v51 = -1;
do
++v51;
while ( *((_BYTE *)v49 + v51) );
sub_140070860((__int64)v50, v51, &Time);
sub_140070B30((unsigned __int8 *)&Time, v125);
*(_OWORD *)Src = 0;
v109 = 0u;
v52 = -1;
do
++v52;
while ( v125[v52] );
sub_14003A930(Src, v125, v52);
p_Buf2 = &Buf2;
v54 = (char *)Buf2;
v55 = v123;
if ( v123 > 0xF )
p_Buf2 = (__int128 *)Buf2;
v56 = Src;
v96 = v109.m128i_i64[1] > 0xFuLL;
v57 = (char *)Src[0];
if ( v109.m128i_i64[1] > 0xFuLL )
v56 = (void **)Src[0];
v58 = v109.m128i_i64[0];
v59 = v109.m128i_i64[0];
if ( Size < v109.m128i_i64[0] )
v59 = Size;
v60 = memcmp(v56, p_Buf2, v59);
if ( !v60 )
{
if ( v58 >= Size )
v60 = v58 > Size;
else
v60 = -1;
}
if ( v96 )
{
v61 = v57;
if ( (unsigned __int64)(v109.m128i_i64[1] + 1) >= 0x1000 )
{
v57 = *((char **)v57 - 1);
if ( (unsigned __int64)(v61 - v57 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v57);
}
if ( !v60 )
{
*(_OWORD *)Src = 0;
v109.m128i_i64[0] = 5;
v109.m128i_i64[1] = 15;
strcpy((char *)Src, "59182");
cocos2d::ZipUtils::base64DecodeEnc(v124, v110, Src);
v63 = sub_140140F70(v124, ":");
if ( cocos2d::CCArray::count(v63) < 5 )
goto LABEL_99;
v65 = cocos2d::CCArray::stringAtIndex(v63, 1u);
v66 = cocos2d::CCString::intValue(v65);
v67 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v98 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v98);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v67 = qword_1406C2ED8;
}
if ( v66 != *(_DWORD *)(v67 + 888) - *(_DWORD *)(v67 + 892) )
{
LABEL_99:
v64 = a1->m_GJDailyLevelDelegate;
if ( v64 )
v64->dailyStatusFailed(v64, Event, (GJErrorCode)0xFFFFFFFFLL);
goto LABEL_125;
}
v68 = cocos2d::CCArray::stringAtIndex(v63, 2u);
v104 = cocos2d::CCString::intValue(v68);
v69 = cocos2d::CCArray::stringAtIndex(v63, 3u);
v105 = cocos2d::CCString::intValue(v69);
v70 = cocos2d::CCArray::stringAtIndex(v63, 4u);
v71 = cocos2d::CCString::getCString(v70);
*(_OWORD *)Block = 0;
v116 = 0;
v117 = 0;
v72 = -1;
do
++v72;
while ( v71[v72] );
sub_14003A930(Block, v71, v72);
Time.time = (__time64_t)Src;
*(_OWORD *)Src = 0;
v109 = 0u;
v76 = Block;
v77 = Block[0];
v78 = v117;
if ( v117 > 0xF )
v76 = (void **)Block[0];
v99 = v76;
v79 = v116;
v80 = 0x7FFFFFFFFFFFFFFFLL;
if ( v116 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(0x7FFFFFFFFFFFFFFFLL, v73, v74, v75);
v109.m128i_i64[1] = 15;
if ( v116 > 0xF )
{
if ( (v116 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v80 = v116 | 0xF;
if ( (v116 | 0xF) < 0x16 )
v80 = 22;
v107 = v80;
}
Src[0] = sub_14003AA10(v80 + 1);
v109.m128i_i64[0] = v79;
v109.m128i_i64[1] = v107;
memcpy(Src[0], v99, v79 + 1);
}
else
{
v109.m128i_i64[0] = v116;
*(_OWORD *)Src = *(_OWORD *)v76;
}
if ( !qword_1406C2EE8 )
{
v100 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v100);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
Reward = (void *)GameStatsManager::createReward(v80, v105, v104, Src);
if ( !Reward )
{
v81 = a1->m_GJDailyLevelDelegate;
if ( v81 )
v81->dailyStatusFailed(v81, Event, (GJErrorCode)0xFFFFFFFFLL);
if ( v78 <= 0xF )
goto LABEL_125;
v82 = v77;
if ( v78 + 1 < 0x1000 || (v77 = *((_BYTE **)v77 - 1), (unsigned __int64)(v82 - v77 - 8) <= 0x1F) )
{
j_j_free(v77);
LABEL_125:
sub_14003A830((__int64)v124);
goto LABEL_126;
}
LABEL_151:
invalid_parameter_noinfo_noreturn();
}
v87 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
Time.time = (__time64_t)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(Time.time);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v87 = qword_1406C2EE8;
}
v88 = cocos2d::CCString::createWithFormat("d%i", v102);
v89 = cocos2d::CCString::getCString(v88);
Time = 0;
v119 = 0;
v120 = 0;
do
++v10;
while ( v89[v10] );
sub_14003A930(&Time, v89, v10);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v87 + 848), Reward, &Time);
if ( v120 > 0xF )
{
v90 = (void *)Time.time;
if ( v120 + 1 >= 0x1000 )
{
v90 = *(void **)(Time.time - 8);
if ( (unsigned __int64)(Time.time - (_QWORD)v90 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v90);
}
if ( v78 > 0xF )
{
v91 = v77;
if ( v78 + 1 >= 0x1000 )
{
v77 = *((_BYTE **)v77 - 1);
if ( (unsigned __int64)(v91 - v77 - 8) > 0x1F )
goto LABEL_151;
}
j_j_free(v77);
}
sub_14003A830((__int64)v124);
if ( v114 > 0xF )
{
v92 = v112[0];
if ( v114 + 1 >= 0x1000 )
{
v92 = *((void **)v112[0] - 1);
if ( (unsigned __int64)((char *)v112[0] - (char *)v92 - 8) > 0x1F )
goto LABEL_156;
}
j_j_free(v92);
}
if ( v55 > 0xF )
{
v93 = v54;
if ( v55 + 1 >= 0x1000 )
{
v54 = *((char **)v54 - 1);
if ( (unsigned __int64)(v93 - v54 - 8) > 0x1F )
goto LABEL_161;
}
j_j_free(v54);
}
if ( v111.m128i_i64[1] > 0xFuLL )
{
v94 = v110[0];
if ( (unsigned __int64)(v111.m128i_i64[1] + 1) >= 0x1000 )
{
v94 = *((void **)v110[0] - 1);
if ( (unsigned __int64)((char *)v110[0] - (char *)v94 - 8) > 0x1F )
goto LABEL_166;
}
j_j_free(v94);
}
v3 = (unsigned __int64 *)a3;
v11 = v97;
LABEL_169:
v95 = a1->m_GJDailyLevelDelegate;
if ( v95 )
v95->dailyStatusFinished(v95, v11);
goto LABEL_171;
}
v62 = a1->m_GJDailyLevelDelegate;
if ( v62 )
v62->dailyStatusFailed(v62, Event, (GJErrorCode)0xFFFFFFFFLL);
LABEL_126:
if ( v114 <= 0xF )
goto LABEL_130;
v83 = v112[0];
if ( v114 + 1 >= 0x1000 )
{
v83 = *((void **)v112[0] - 1);
if ( (unsigned __int64)((char *)v112[0] - (char *)v83 - 8) > 0x1F )
LABEL_156:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v83);
LABEL_130:
if ( v55 <= 0xF )
goto LABEL_134;
v84 = v54;
if ( v55 + 1 >= 0x1000 )
{
v54 = *((char **)v54 - 1);
if ( (unsigned __int64)(v84 - v54 - 8) > 0x1F )
LABEL_161:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v54);
LABEL_134:
if ( v111.m128i_i64[1] > 0xFuLL )
{
v85 = v110[0];
if ( (unsigned __int64)(v111.m128i_i64[1] + 1) < 0x1000
|| (v85 = *((void **)v110[0] - 1), (unsigned __int64)((char *)v110[0] - (char *)v85 - 8) <= 0x1F) )
{
j_j_free(v85);
goto LABEL_138;
}
LABEL_166:
invalid_parameter_noinfo_noreturn();
}
LABEL_138:
v111.m128i_i64[0] = 0;
v111.m128i_i64[1] = 15;
LOBYTE(v110[0]) = 0;
sub_14003A830((__int64)a2);
v86 = a3;
LABEL_172:
sub_14003A830(v86);
}