//
// GameLevelManager::getOnlineLevels from 0x1000b5c20 to 0x1000b63e8 (1992 bytes)
//
// 3 xrefs:
// > LevelBrowserLayer::loadPage @ 0x100498bc4
// > sub_100502538 @ 0x1005026bc
// > sub_100505BBC @ 0x100505dd0
//
// 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 10:58:41 +0000
//
void __fastcall GameLevelManager::getOnlineLevels(_DWORD *a1, __int64 a2)
{
char *Key; // x20
int v5; // w27
unsigned __int8 v6; // w22
int v7; // w28
std::string *v8; // x0
__int64 v10; // x22
__int64 v11; // x0
int GameVariable; // w0
__int64 CompletedLevels; // x22
__int64 i; // x23
__int64 v15; // x26
__int64 v16; // x0
const std::string::value_type *CString; // x0
__int64 v18; // x22
__int64 v19; // x23
__int64 v20; // x0
std::string *p_dst; // x1
std::string::size_type size; // x2
int v23; // w26
int v24; // w23
int v25; // w8
_BOOL4 v26; // w22
std::string *v27; // x0
__int64 v28; // x0
int v29; // w22
std::string *v30; // x1
int v31; // w23
std::string *v32; // x24
const char *v33; // x25
void **v34; // x8
__int64 v35; // x0
const std::string::value_type *v36; // x0
int v37; // w8
__int64 v38; // x0
const std::string::value_type *v39; // x0
__int64 v40; // x0
const std::string::value_type *v41; // x0
std::string *v42; // x1
std::string *v43; // x1
int v44; // w8
int v45; // w22
void *v46; // x23
__int64 v47; // x0
const std::string::value_type *v48; // x0
std::string *v49; // x1
int v50; // [xsp+6Ch] [xbp-154h]
int v51; // [xsp+70h] [xbp-150h]
_BOOL4 v52; // [xsp+7Ch] [xbp-144h]
int v53; // [xsp+80h] [xbp-140h]
void *v54[2]; // [xsp+88h] [xbp-138h] BYREF
char v55; // [xsp+9Fh] [xbp-121h]
void *v56[2]; // [xsp+A0h] [xbp-120h] BYREF
char v57; // [xsp+B7h] [xbp-109h]
std::string v58; // [xsp+B8h] [xbp-108h] BYREF
void *__p[2]; // [xsp+D0h] [xbp-F0h] BYREF
__int64 v60; // [xsp+E0h] [xbp-E0h]
__int128 v61; // [xsp+F0h] [xbp-D0h] BYREF
__int64 v62; // [xsp+100h] [xbp-C0h]
std::string v63; // [xsp+110h] [xbp-B0h] BYREF
std::string __dst; // [xsp+130h] [xbp-90h] BYREF
std::string v65; // [xsp+148h] [xbp-78h] BYREF
Key = (char *)GJSearchObject::getKey(a2);
if ( sub_1000ADBAC((__int64)a1, Key) )
return;
sub_1000ADC1C((__int64)a1, Key);
v5 = *(unsigned __int8 *)(a2 + 404);
if ( (v5 & 1) != 0 )
{
v53 = 0;
v6 = 1;
}
else
{
v6 = *(_BYTE *)(a2 + 405);
v53 = v6;
}
v7 = *(_DWORD *)(a2 + 316);
v8 = (std::string *)sub_100009900(&v65, "(");
if ( (unsigned int)(v7 - 32) > 2 || v5 == 0 )
{
v52 = (unsigned int)(v7 - 32) < 3;
if ( (v6 & 1) != 0 )
{
v10 = GameLevelManager::sharedState();
v11 = GameManager::sharedState(v10);
GameVariable = GameManager::getGameVariable(v11, "0073");
CompletedLevels = GameLevelManager::getCompletedLevels(v10, GameVariable);
for ( i = 0; (unsigned int)i < (unsigned int)sub_1002E757C(CompletedLevels); i = (unsigned int)(i + 1) )
{
v15 = sub_1002E75A0(CompletedLevels, i);
if ( (_DWORD)i )
std::string::append(&v65, ",");
v16 = sub_1003065B0("%i", *(_DWORD *)(v15 + 328) - *(_DWORD *)(v15 + 332));
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v16);
std::string::append(&v65, CString);
}
std::string::append(&v65, ")");
v8 = (std::string *)sub_1002E757C(CompletedLevels);
v53 = ((_DWORD)v8 != 0) & (unsigned __int8)v53;
if ( !(_DWORD)v8 )
v5 = 0;
}
}
else
{
v18 = 200000;
if ( v7 == 33 )
{
v19 = 200000;
v18 = 100000;
}
else if ( v7 == 34 )
{
v19 = 0x7FFFFFFF;
}
else
{
v18 = 0;
v19 = 100000;
}
v20 = GameStatsManager::sharedState(v8);
sub_1003D2C5C(&__dst, v20, v18, v19);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
else
size = __dst.__r_.__value_.__l.__size_;
std::string::append(&v65, (const std::string::value_type *)p_dst, size);
v8 = std::string::append(&v65, ")");
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
{
v5 = __dst.__r_.__value_.__l.__size_ != 0;
operator delete(__dst.__r_.__value_.__l.__data_);
}
else
{
v5 = SHIBYTE(__dst.__r_.__value_.__r.__words[2]) != 0;
}
v53 = 0;
v52 = 1;
}
v51 = *(_DWORD *)(a2 + 424);
v23 = *(unsigned __int8 *)(a2 + 429);
v24 = *(unsigned __int8 *)(a2 + 428);
v25 = *(_DWORD *)(a2 + 316);
if ( v25 != 5 )
{
v26 = 0;
if ( v25 )
goto LABEL_56;
goto LABEL_46;
}
if ( *(char *)(a2 + 343) < 0 )
sub_1000097D0(&__dst, *(void **)(a2 + 320), *(_QWORD *)(a2 + 328));
else
__dst = *(std::string *)(a2 + 320);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v27 = &__dst;
else
v27 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v28 = atoi((const char *)v27);
v29 = v28;
v8 = (std::string *)GameManager::sharedState(v28);
v26 = v29 == HIDWORD(v8[27].__r_.__value_.__r.__words[1]) - LODWORD(v8[27].__r_.__value_.__r.__words[2]);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( !*(_DWORD *)(a2 + 316) )
{
LABEL_46:
if ( *(char *)(a2 + 343) < 0 )
sub_1000097D0(&v63, *(void **)(a2 + 320), *(_QWORD *)(a2 + 328));
else
v63 = *(std::string *)(a2 + 320);
if ( (v63.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v30 = &v63;
else
v30 = (std::string *)v63.__r_.__value_.__r.__words[0];
v8 = (std::string *)sub_100009900(&__dst, (char *)v30);
if ( SHIBYTE(v63.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v63.__r_.__value_.__l.__data_);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}
LABEL_56:
v50 = v24;
GameLevelManager::getBasePostString((__int64)v8, &__dst);
v31 = *(_DWORD *)(a2 + 316);
if ( *(char *)(a2 + 343) < 0 )
sub_1000097D0(&v63, *(void **)(a2 + 320), *(_QWORD *)(a2 + 328));
else
v63 = *(std::string *)(a2 + 320);
if ( (v63.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v32 = &v63;
else
v32 = (std::string *)v63.__r_.__value_.__r.__words[0];
if ( *(char *)(a2 + 367) < 0 )
{
sub_1000097D0(&v61, *(void **)(a2 + 344), *(_QWORD *)(a2 + 352));
}
else
{
v61 = *(_OWORD *)(a2 + 344);
v62 = *(_QWORD *)(a2 + 360);
}
if ( v62 >= 0 )
v33 = (const char *)&v61;
else
v33 = (const char *)v61;
if ( *(char *)(a2 + 391) < 0 )
{
sub_1000097D0(__p, *(void **)(a2 + 368), *(_QWORD *)(a2 + 376));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(a2 + 368);
v60 = *(_QWORD *)(a2 + 384);
}
v34 = __p;
if ( v60 < 0 )
v34 = (void **)__p[0];
v35 = sub_1003065B0(
"&type=%i&str=%s&diff=%s&len=%s&page=%i&total=%i&uncompleted=%i&onlyCompleted=%i&featured=%i&original=%i&twoPlayer=%i&coins=%i",
v31,
(const char *)v32,
v33,
(const char *)v34,
*(_DWORD *)(a2 + 392),
*(_DWORD *)(a2 + 400),
v5,
v53 & 1,
*(unsigned __int8 *)(a2 + 406),
*(unsigned __int8 *)(a2 + 407),
*(unsigned __int8 *)(a2 + 408),
*(unsigned __int8 *)(a2 + 409));
v36 = (const std::string::value_type *)cocos2d::CCString::getCString(v35);
std::string::append(&__dst, v36);
if ( SHIBYTE(v60) < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v62) < 0 )
operator delete((void *)v61);
if ( (SHIBYTE(v63.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
{
if ( !v52 )
goto LABEL_89;
LABEL_81:
switch ( v7 )
{
case '"':
v37 = a1[222];
break;
case '!':
v37 = a1[219];
break;
case ' ':
v37 = a1[216];
break;
default:
v37 = 0;
break;
}
v38 = sub_1003065B0("&active=%i", v37);
v39 = (const std::string::value_type *)cocos2d::CCString::getCString(v38);
std::string::append(&__dst, v39);
goto LABEL_89;
}
operator delete(v63.__r_.__value_.__l.__data_);
if ( v52 )
goto LABEL_81;
LABEL_89:
if ( *(_BYTE *)(a2 + 410) == 1 )
std::string::append(&__dst, "&epic=1");
if ( *(_BYTE *)(a2 + 411) == 1 )
std::string::append(&__dst, "&legendary=1");
if ( *(_BYTE *)(a2 + 412) == 1 )
std::string::append(&__dst, "&mythic=1");
if ( v26 )
std::string::append(&__dst, "&local=1");
if ( v23 )
{
std::string::append(&__dst, "&song=");
v40 = sub_1003065B0("%i", v51);
v41 = (const std::string::value_type *)cocos2d::CCString::getCString(v40);
std::string::append(&__dst, v41);
if ( v50 )
std::string::append(&__dst, "&customSong=1");
}
sub_1000B58CC(a2, &v63);
if ( (v63.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v42 = &v63;
else
v42 = (std::string *)v63.__r_.__value_.__r.__words[0];
std::string::append(&__dst, (const std::string::value_type *)v42);
if ( SHIBYTE(v63.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v63.__r_.__value_.__l.__data_);
if ( ((v5 | v53) & 1) != 0 )
{
std::string::append(&__dst, "&completedLevels=");
if ( (v65.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v43 = &v65;
else
v43 = (std::string *)v65.__r_.__value_.__r.__words[0];
std::string::append(&__dst, (const std::string::value_type *)v43);
}
v44 = *(_DWORD *)(a2 + 316);
if ( v44 == 25 )
{
if ( *(char *)(a2 + 343) < 0 )
sub_1000097D0(&v63, *(void **)(a2 + 320), *(_QWORD *)(a2 + 328));
else
v63 = *(std::string *)(a2 + 320);
if ( SHIBYTE(v63.__r_.__value_.__r.__words[2]) < 0 )
{
v46 = (void *)v63.__r_.__value_.__r.__words[0];
v45 = atoi(v63.__r_.__value_.__l.__data_);
operator delete(v46);
}
else
{
v45 = atoi((const char *)&v63);
}
if ( (sub_1000B9948(a1, (unsigned int)-v45) & 1) == 0 )
std::string::append(&__dst, "&inc=1");
v44 = *(_DWORD *)(a2 + 316);
}
if ( v44 == 31 )
std::string::append(&__dst, "&hypeSecret=1");
std::string::append(&__dst, "&secret=");
v47 = sub_1003065B0("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, "7");
v48 = (const std::string::value_type *)cocos2d::CCString::getCString(v47);
std::string::append(&__dst, v48);
sub_100009900(&v58, "https://www.boomlings.com/database/getGJLevels21.php");
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v49 = &__dst;
else
v49 = (std::string *)__dst.__r_.__value_.__r.__words[0];
sub_100009900(v56, (char *)v49);
sub_100009900(v54, Key);
GameLevelManager::ProcessHttpRequest((__int64)a1, &v58, (char *)v56, (const std::string::value_type *)v54, 2);
if ( v55 < 0 )
operator delete(v54[0]);
if ( v57 < 0 )
operator delete(v56[0]);
if ( SHIBYTE(v58.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v58.__r_.__value_.__l.__data_);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(v65.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v65.__r_.__value_.__l.__data_);
}