//
// GameLevelManager::getGJChallenges from 0x4babd4 to 0x4badc4 (496 bytes)
//
// 2 xrefs:
// > ChallengesPage::tryGetChallenges @ 0x5ff42c
// > ChallengesPage::init @ 0x600784
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:16 +0000
//
int __fastcall GameLevelManager::getGJChallenges(GameLevelManager *this)
{
int v2; // r2
int v3; // r3
GameManager *BasePostString; // r0
int v5; // r0
cocos2d::CCString *v6; // r0
const char *CString; // r8
size_t v8; // r0
cocos2d::CCString *v9; // r0
int v10; // r8
int v11; // r2
int v12; // r3
char *v13; // r2
char *v14; // r3
cocos2d::CCString *v15; // r0
char *v16; // r0
const char *v17; // r1
size_t v18; // r0
const char *v20; // [sp+14h] [bp-70h]
char *v21[3]; // [sp+1Ch] [bp-68h] BYREF
int v22[3]; // [sp+28h] [bp-5Ch] BYREF
char v23; // [sp+34h] [bp-50h] BYREF
char v24; // [sp+35h] [bp-4Fh] BYREF
char *v25; // [sp+3Ch] [bp-48h]
int v26[3]; // [sp+40h] [bp-44h] BYREF
int v27[3]; // [sp+4Ch] [bp-38h] BYREF
int v28[3]; // [sp+58h] [bp-2Ch] BYREF
int v29[3]; // [sp+64h] [bp-20h] BYREF
int v30[3]; // [sp+70h] [bp-14h] BYREF
if ( GameLevelManager::isDLActive(this, "get_chal") )
return 0;
GameLevelManager::addDLToActive(this, "get_chal", v2, v3);
BasePostString = GameLevelManager::getBasePostString((GameLevelManager *)v21);
v5 = GameManager::sharedState(BasePostString);
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(*(_DWORD *)(v5 + 696) - *(_DWORD *)(v5 + 700)));
CString = (const char *)cocos2d::CCString::getCString(v6);
memset(v22, 0, sizeof(v22));
v8 = strlen(CString);
std::string::__init(v22, CString, v8);
memset(v26, 0, sizeof(v26));
std::string::__init(v26, "19847", 5u);
cocos2d::ZipUtils::base64EncodeEnc(&v23, v22, v26);
std::string::~string((int)v26);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfd",
"2893",
103,
98,
&a1i2r3e45s789g[9]);
v10 = cocos2d::CCString::getCString(v9);
gen_random(v27, 5, v11, v12);
if ( (v27[0] & 1) != 0 )
v13 = (char *)v27[2];
else
v13 = (char *)v27 + 1;
if ( (v23 & 1) != 0 )
v14 = v25;
else
v14 = &v24;
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&world=%i&gdl=%i&secret=%s&chk=%s%s",
nullptr,
0,
v10,
v13,
v14);
v16 = (char *)cocos2d::CCString::getCString(v15);
std::string::append(v21, v16);
std::string::~string((int)v27);
memset(v28, 0, sizeof(v28));
std::string::__init(v28, "https://www.boomlings.com/database/getGJChallenges.php", 0x36u);
v29[0] = 0;
v29[1] = 0;
if ( ((int)v21[0] & 1) == 0 )
v17 = (char *)v21 + 1;
v29[2] = 0;
if ( ((int)v21[0] & 1) != 0 )
v17 = v21[2];
v20 = v17;
v18 = strlen(v17);
std::string::__init(v29, v20, v18);
memset(v30, 0, sizeof(v30));
std::string::__init(v30, "get_chal", 8u);
GameLevelManager::ProcessHttpRequest(this, v28, (int)v29, (int)v30, 53);
std::string::~string((int)v30);
std::string::~string((int)v29);
std::string::~string((int)v28);
std::string::~string((int)&v23);
std::string::~string((int)v22);
std::string::~string((int)v21);
return 1;
}