//
// GameLevelManager::onGetGJDailyLevelStateCompleted from 0x10008ffec to 0x1000905d0 (1508 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x100088fa4
//
// 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 GameLevelManager::onGetGJDailyLevelStateCompleted(GameLevelManager *a1, _QWORD *a2, __int64 a3)
{
const char *v6; // x1
bool v7; // w0
bool v8; // w22
_BOOL4 v9; // w22
__int64 v10; // x20
_BOOL4 v11; // w0
_BOOL4 v12; // w23
GJDailyLevelDelegate *m_GJDailyLevelDelegate; // x0
_BOOL4 v14; // w0
_BOOL4 v15; // w23
GJDailyLevelDelegate *v16; // x0
cocos2d::CCArray *v17; // x23
unsigned int v18; // w0
cocos2d::CCString *v19; // x0
int v20; // w21
cocos2d::CCString *v21; // x0
int v22; // w0
cocos2d::CCString *v23; // x0
char *CString; // x0
cocos2d::CCString *v25; // x0
char *v26; // x0
cocos2d::CCString *v27; // x0
const char *v28; // x0
std::string *p_a; // x22
size_t v30; // x0
bool v31; // w22
cocos2d::CCArray *v32; // x23
GJDailyLevelDelegate *v33; // x0
GJDailyLevelDelegate *v34; // x0
cocos2d::CCString *v35; // x0
int v36; // w22
GameManager *v37; // x0
cocos2d::CCString *v38; // x0
int v39; // w22
cocos2d::CCString *v40; // x0
int v41; // w24
cocos2d::CCString *v42; // x0
char *v43; // x0
int v44; // w23
GJRewardItem *Reward; // x22
GameStatsManager *v46; // x0
GJDailyLevelDelegate *v47; // x0
GJDailyLevelDelegate *v48; // x0
void *__dst[2]; // [xsp+30h] [xbp-130h] BYREF
__int64 v50; // [xsp+40h] [xbp-120h]
void *v51[2]; // [xsp+48h] [xbp-118h] BYREF
__int64 v52; // [xsp+58h] [xbp-108h]
void *v53[2]; // [xsp+60h] [xbp-100h] BYREF
char v54; // [xsp+77h] [xbp-E9h]
void *__p[2]; // [xsp+78h] [xbp-E8h] BYREF
char v56; // [xsp+8Fh] [xbp-D1h]
std::string __a; // [xsp+90h] [xbp-D0h] BYREF
void *v58[2]; // [xsp+A8h] [xbp-B8h] BYREF
char v59; // [xsp+BFh] [xbp-A1h]
std::string __str; // [xsp+C0h] [xbp-A0h] BYREF
std::string v61; // [xsp+D8h] [xbp-88h] BYREF
_BYTE v62[20]; // [xsp+104h] [xbp-5Ch] BYREF
v6 = (const char *)a3;
if ( *(char *)(a3 + 23) < 0 )
v6 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, v6);
sub_100009900(&v61, "weekly_state");
v7 = sub_1000045BC((_QWORD *)a3, &v61);
v8 = v7;
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v61.__r_.__value_.__l.__data_);
if ( v8 )
goto LABEL_5;
}
else if ( v7 )
{
LABEL_5:
v9 = 0;
v10 = 1;
goto LABEL_12;
}
sub_100009900(&v61, "event_state");
v9 = sub_1000045BC((_QWORD *)a3, &v61);
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v61.__r_.__value_.__l.__data_);
if ( v9 )
v10 = 2;
else
v10 = 0;
LABEL_12:
sub_100009900(&v61, "-1");
v11 = sub_1000045BC(a2, &v61);
v12 = v11;
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v61.__r_.__value_.__l.__data_);
if ( v12 )
{
LABEL_14:
m_GJDailyLevelDelegate = a1->m_GJDailyLevelDelegate;
if ( !m_GJDailyLevelDelegate )
return;
goto LABEL_15;
}
}
else if ( v11 )
{
goto LABEL_14;
}
sub_100009900(&v61, "-2");
v14 = sub_1000045BC(a2, &v61);
v15 = v14;
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v61.__r_.__value_.__l.__data_);
if ( v15 )
{
LABEL_19:
v16 = a1->m_GJDailyLevelDelegate;
if ( v16 )
((void (__fastcall *)(GJDailyLevelDelegate *, __int64, __int64))v16->dailyStatusFailed)(v16, v10, 3);
return;
}
}
else if ( v14 )
{
goto LABEL_19;
}
v17 = (cocos2d::CCArray *)sub_100093338(a2, "|");
v18 = sub_10024A36C(v17);
if ( !v9 )
{
if ( v18 >= 2 )
goto LABEL_24;
LABEL_30:
m_GJDailyLevelDelegate = a1->m_GJDailyLevelDelegate;
if ( m_GJDailyLevelDelegate )
{
LABEL_15:
((void (__fastcall *)(GJDailyLevelDelegate *, __int64, __int64))m_GJDailyLevelDelegate->dailyStatusFailed)(
m_GJDailyLevelDelegate,
v10,
0xFFFFFFFFLL);
return;
}
return;
}
if ( v18 <= 3 )
goto LABEL_30;
LABEL_24:
v19 = cocos2d::CCArray::stringAtIndex(v17, 0);
v20 = cocos2d::CCString::intValue(v19);
v21 = cocos2d::CCArray::stringAtIndex(v17, 1u);
v22 = cocos2d::CCString::intValue(v21);
GameLevelManager::storeDailyLevelState(a1, v20, v22, (GJTimedLevelType)v10);
if ( !v9 )
goto LABEL_76;
v23 = cocos2d::CCArray::stringAtIndex(v17, 2u);
CString = (char *)cocos2d::CCString::getCString(v23);
sub_100009900(&__str, CString);
v25 = cocos2d::CCArray::stringAtIndex(v17, 3u);
v26 = (char *)cocos2d::CCString::getCString(v25);
sub_100009900(v58, v26);
std::string::basic_string(&v61, &__str, 5u, 0xFFFFFFFFFFFFFFFFLL, (std::allocator *)&__a);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
__str = v61;
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__a, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
__a = __str;
v27 = (cocos2d::CCString *)sub_100268F4C("%c%s%s%c%c%s", 112, "C26", "fpYa", 81, 67, "tg");
v28 = cocos2d::CCString::getCString(v27);
p_a = &__a;
std::string::append(&__a, v28);
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
v30 = strlen((const char *)p_a);
sub_1000F7448(p_a, v30, v62);
sub_1000F78E0(v62, &v61);
sub_100009900(__p, (char *)&v61);
v31 = sub_1000045BC(__p, v58);
if ( v56 < 0 )
operator delete(__p[0]);
if ( !v31 )
{
v34 = a1->m_GJDailyLevelDelegate;
if ( v34 )
((void (__fastcall *)(GJDailyLevelDelegate *, __int64, __int64))v34->dailyStatusFailed)(v34, 2, 0xFFFFFFFFLL);
goto LABEL_52;
}
sub_100009900(v53, "59182");
cocos2d::ZipUtils::base64DecodeEnc(__p, &__str, v53);
if ( v54 < 0 )
operator delete(v53[0]);
v32 = (cocos2d::CCArray *)sub_100093338(__p, ":");
if ( (unsigned int)sub_10024A36C(v32) <= 4 )
{
v33 = a1->m_GJDailyLevelDelegate;
if ( !v33 )
goto LABEL_50;
LABEL_49:
((void (__fastcall *)(GJDailyLevelDelegate *, __int64, __int64))v33->dailyStatusFailed)(v33, 2, 0xFFFFFFFFLL);
LABEL_50:
if ( v56 < 0 )
operator delete(__p[0]);
LABEL_52:
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
if ( v59 < 0 )
operator delete(v58[0]);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
return;
}
v35 = cocos2d::CCArray::stringAtIndex(v32, 1u);
v36 = cocos2d::CCString::intValue(v35);
v37 = GameManager::sharedState();
if ( v36 != v37->m_chk.random - v37->m_chk.seed )
{
v33 = a1->m_GJDailyLevelDelegate;
if ( !v33 )
goto LABEL_50;
goto LABEL_49;
}
v38 = cocos2d::CCArray::stringAtIndex(v32, 2u);
v39 = cocos2d::CCString::intValue(v38);
v40 = cocos2d::CCArray::stringAtIndex(v32, 3u);
v41 = cocos2d::CCString::intValue(v40);
v42 = cocos2d::CCArray::stringAtIndex(v32, 4u);
v43 = (char *)cocos2d::CCString::getCString(v42);
sub_100009900(v51, v43);
v44 = (unsigned int)GameStatsManager::sharedState();
if ( SHIBYTE(v52) < 0 )
{
sub_1000097D0(__dst, v51[0], (unsigned __int64)v51[1]);
}
else
{
*(_OWORD *)__dst = *(_OWORD *)v51;
v50 = v52;
}
Reward = (GJRewardItem *)GameStatsManager::createReward(v44, v41, v39, (int)__dst);
if ( SHIBYTE(v50) < 0 )
operator delete(__dst[0]);
if ( Reward )
{
v46 = GameStatsManager::sharedState();
GameStatsManager::storeEventChest(v46, v20, Reward);
}
else
{
v47 = a1->m_GJDailyLevelDelegate;
if ( v47 )
((void (__fastcall *)(GJDailyLevelDelegate *, __int64, __int64))v47->dailyStatusFailed)(v47, 2, 0xFFFFFFFFLL);
}
if ( SHIBYTE(v52) < 0 )
operator delete(v51[0]);
if ( v56 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
if ( v59 < 0 )
operator delete(v58[0]);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( Reward )
{
LABEL_76:
v48 = a1->m_GJDailyLevelDelegate;
if ( v48 )
((void (__fastcall *)(GJDailyLevelDelegate *, __int64))v48->dailyStatusFinished)(v48, v10);
}
}