//
// GameLevelManager::getGJChallenges from 0x82c05c to 0x82c420 (964 bytes)
//
// 3 xrefs:
// > ChallengesPage::tryGetChallenges @ 0xa623d0
// > ChallengesPage::init @ 0xa63f44
// > ??> @ 0x542f8
//
// This function is hookable on this platform (idp: arm, 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 12:55:06 +0000
//
__int64 __fastcall GameLevelManager::getGJChallenges(GameLevelManager *this)
{
_BOOL4 isDLActive; // w1
__int64 result; // x0
__int64 *BasePostString; // x0
__int64 v5; // x0
cocos2d::CCString *v6; // x0
size_t v7; // x0
cocos2d::CCString *v8; // x0
__int64 v9; // x25
char *v10; // x4
char *v11; // x5
cocos2d::CCString *v12; // x0
size_t v13; // x0
const char *v14; // x1
size_t v15; // x0
char *CString; // [xsp+58h] [xbp+58h]
char *v17; // [xsp+58h] [xbp+58h]
char *v18; // [xsp+58h] [xbp+58h]
__int64 v19[2]; // [xsp+68h] [xbp+68h] BYREF
void *v20; // [xsp+78h] [xbp+78h]
__int64 v21[2]; // [xsp+80h] [xbp+80h] BYREF
void *v22; // [xsp+90h] [xbp+90h]
void *v23[2]; // [xsp+98h] [xbp+98h] BYREF
void *v24; // [xsp+A8h] [xbp+A8h]
__int64 v25[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v26; // [xsp+C0h] [xbp+C0h]
__int64 v27[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v28; // [xsp+D8h] [xbp+D8h]
__int64 v29[2]; // [xsp+E0h] [xbp+E0h] BYREF
void *v30; // [xsp+F0h] [xbp+F0h]
__int64 v31[2]; // [xsp+F8h] [xbp+F8h] BYREF
void *v32; // [xsp+108h] [xbp+108h]
__int64 v33[2]; // [xsp+110h] [xbp+110h] BYREF
void *v34; // [xsp+120h] [xbp+120h]
isDLActive = GameLevelManager::isDLActive(this, "get_chal");
result = 0;
if ( !isDLActive )
{
GameLevelManager::addDLToActive(this, "get_chal");
BasePostString = GameLevelManager::getBasePostString(v19);
v5 = GameManager::sharedState((GameManager *)BasePostString);
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)(*(_DWORD *)(v5 + 896) - *(_DWORD *)(v5 + 900)));
CString = (char *)cocos2d::CCString::getCString(v6);
v21[0] = 0;
v21[1] = 0;
v22 = nullptr;
v7 = strlen(CString);
std::string::__init(v21, CString, v7);
v25[0] = 0;
v25[1] = 0;
v26 = nullptr;
std::string::__init(v25, "19847", 5u);
cocos2d::ZipUtils::base64EncodeEnc(v23, v21, v25);
if ( (v25[0] & 1) != 0 )
operator delete(v26);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v9 = cocos2d::CCString::getCString(v8);
gen_random(5, v27);
v10 = (char *)v27 + 1;
if ( (v27[0] & 1) != 0 )
v10 = (char *)v28;
v11 = (char *)v23 + 1;
if ( ((__int64)v23[0] & 1) != 0 )
v11 = (char *)v24;
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&world=%i&gdl=%i&secret=%s&chk=%s%s",
nullptr,
0,
v9,
v10,
v11);
v17 = (char *)cocos2d::CCString::getCString(v12);
v13 = strlen(v17);
std::string::append((__int64)v19, v17, v13);
if ( (v27[0] & 1) != 0 )
operator delete(v28);
v29[0] = 0;
v29[1] = 0;
v30 = nullptr;
std::string::__init(v29, "https://www.boomlings.com/database/getGJChallenges.php", 0x36u);
v14 = (char *)v19 + 1;
if ( (v19[0] & 1) != 0 )
v14 = (const char *)v20;
v18 = (char *)v14;
v31[0] = 0;
v31[1] = 0;
v32 = nullptr;
v15 = strlen(v14);
std::string::__init(v31, v18, v15);
v33[0] = 0;
v33[1] = 0;
v34 = nullptr;
std::string::__init(v33, "get_chal", 8u);
GameLevelManager::ProcessHttpRequest(this, v29, (__int64)v31, (char *)v33, 53);
if ( (v33[0] & 1) != 0 )
operator delete(v34);
if ( (v31[0] & 1) != 0 )
operator delete(v32);
if ( (v29[0] & 1) != 0 )
operator delete(v30);
if ( ((__int64)v23[0] & 1) != 0 )
operator delete(v24);
if ( (v21[0] & 1) != 0 )
operator delete(v22);
if ( (v19[0] & 1) != 0 )
operator delete(v20);
return 1;
}
return result;
}