//
// GameLevelManager::getGJDailyLevelState from 0x1000ab524 to 0x1000ab7c8 (676 bytes)
//
// 2 xrefs:
// > DailyLevelPage::init @ 0x1001b9958
// > DailyLevelPage::tryGetDailyStatus @ 0x1001ba6b0
//
// 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
//
bool __fastcall GameLevelManager::getGJDailyLevelState(GameLevelManager *a1, GJTimedLevelType a2)
{
const char *v4; // x8
const std::string::value_type *v5; // x1
std::string *v6; // x1
bool isDLActive; // w19
std::string *v8; // x1
GameManager *v9; // x0
cocos2d::CCString *v10; // x0
char *CString; // x0
cocos2d::CCString *v12; // x0
const char *v13; // x22
void **v14; // x8
const char *v15; // x9
cocos2d::CCString *v16; // x0
const char *v17; // x0
std::string *v18; // x1
std::string __dst; // [xsp+30h] [xbp-110h] BYREF
void *v21[2]; // [xsp+50h] [xbp-F0h] BYREF
char v22; // [xsp+67h] [xbp-D9h]
std::string v23; // [xsp+68h] [xbp-D8h] BYREF
void *__p[2]; // [xsp+80h] [xbp-C0h] BYREF
char v25; // [xsp+97h] [xbp-A9h]
std::string v26; // [xsp+98h] [xbp-A8h] BYREF
void *v27[2]; // [xsp+B0h] [xbp-90h] BYREF
char v28; // [xsp+C7h] [xbp-79h]
void *v29[2]; // [xsp+C8h] [xbp-78h] BYREF
char v30; // [xsp+DFh] [xbp-61h]
void *v31[2]; // [xsp+E0h] [xbp-60h] BYREF
char v32; // [xsp+F7h] [xbp-49h]
std::string v33; // [xsp+F8h] [xbp-48h] BYREF
memset(&v33, 0, sizeof(v33));
v4 = "daily_state";
if ( a2 == Event )
v4 = "event_state";
if ( a2 == 1 )
v5 = "weekly_state";
else
v5 = v4;
std::string::assign(&v33, v5);
if ( (v33.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v6 = &v33;
else
v6 = (std::string *)v33.__r_.__value_.__r.__words[0];
isDLActive = GameLevelManager::isDLActive(a1, (const char *)v6);
if ( !isDLActive )
{
if ( (v33.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v8 = &v33;
else
v8 = (std::string *)v33.__r_.__value_.__r.__words[0];
GameLevelManager::addDLToActive(a1, (const char *)v8);
v9 = GameManager::sharedState();
v10 = (cocos2d::CCString *)sub_100268F4C("%i", v9->m_chk.random - v9->m_chk.seed);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_100009900(v31, CString);
sub_100009900(v27, "59182");
cocos2d::ZipUtils::base64EncodeEnc(v29, v31, v27);
if ( v28 < 0 )
operator delete(v27[0]);
GameLevelManager::getBasePostString(&v26);
v12 = (cocos2d::CCString *)sub_100268F4C("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, "7");
v13 = cocos2d::CCString::getCString(v12);
sub_100087A84(5, __p);
if ( v25 >= 0 )
v14 = __p;
else
v14 = (void **)__p[0];
v15 = (const char *)v29;
if ( v30 < 0 )
v15 = (const char *)v29[0];
v16 = (cocos2d::CCString *)sub_100268F4C("&secret=%s&type=%i&chk=%s%s", v13, a2, (const char *)v14, v15);
v17 = cocos2d::CCString::getCString(v16);
std::string::append(&v26, v17);
if ( v25 < 0 )
operator delete(__p[0]);
sub_100009900(&v23, "https://www.boomlings.com/database/getGJDailyLevel.php");
if ( (v26.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &v26;
else
v18 = (std::string *)v26.__r_.__value_.__r.__words[0];
sub_100009900(v21, (char *)v18);
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v33.__r_.__value_.__l.__data_, v33.__r_.__value_.__l.__size_);
else
__dst = v33;
GameLevelManager::ProcessHttpRequest(a1, &v23, (char *)v21, (const std::string::value_type *)&__dst, 48);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( v22 < 0 )
operator delete(v21[0]);
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v23.__r_.__value_.__l.__data_);
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v26.__r_.__value_.__l.__data_);
if ( v30 < 0 )
operator delete(v29[0]);
if ( v32 < 0 )
operator delete(v31[0]);
}
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v33.__r_.__value_.__l.__data_);
return !isDLActive;
}