//
// GameLevelManager::getOnlineLevels from 0x100558520 to 0x100559010 (2800 bytes)
//
// 3 xrefs:
// > LevelBrowserLayer::loadPage @ 0x100485002
// > sub_10093B920 @ 0x10093bb34
// > sub_10093F950 @ 0x10093fc1c
//
// This function is hookable on this platform (idp: pc, 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:32:06 +0000
//
void __fastcall GameLevelManager::getOnlineLevels(__int64 a1, __int64 a2)
{
char *Key; // r14
unsigned __int8 v4; // al
int v5; // edx
int v6; // ebx
int v7; // r14d
__int64 v8; // rbx
__int64 v9; // rax
unsigned __int8 GameVariable; // al
__int64 CompletedLevels; // r12
__int64 v12; // rax
const std::string::value_type *CString; // rax
unsigned int i; // r13d
__int64 v15; // rax
const std::string::value_type *v16; // rax
bool v17; // al
int v18; // ecx
__int64 v19; // rax
const std::string::value_type *data; // rsi
std::string::size_type size; // rdx
int v22; // eax
const char *v23; // rdi
int v24; // ebx
__int64 v25; // rax
const char *v26; // rbx
size_t v27; // rax
std::string::size_type v28; // r14
char *v29; // r12
size_t v30; // r13
_OWORD *v31; // r14
__int64 v32; // rax
const std::string::value_type *v33; // rsi
__int64 v34; // rax
__int64 v35; // rax
const std::string::value_type *v36; // rsi
const std::string::value_type *v37; // rsi
int v38; // eax
int v39; // ebx
std::string::pointer v40; // r14
__int64 v41; // rax
const std::string::value_type *v42; // rax
const char *v43; // rbx
size_t v44; // rax
size_t v45; // r14
char *v46; // r15
size_t v47; // r12
size_t v48; // rax
size_t v49; // rbx
char *v50; // r14
__int64 v51; // r15
size_t v52; // r15
char v53; // [rsp+0h] [rbp-170h]
char v54; // [rsp+0h] [rbp-170h]
char v55; // [rsp+0h] [rbp-170h]
std::string v56; // [rsp+40h] [rbp-130h] BYREF
char *v57; // [rsp+58h] [rbp-118h]
_QWORD __dst[2]; // [rsp+60h] [rbp-110h] BYREF
void *v59; // [rsp+70h] [rbp-100h]
__int128 v60; // [rsp+78h] [rbp-F8h] BYREF
void *v61; // [rsp+88h] [rbp-E8h]
__int128 v62; // [rsp+90h] [rbp-E0h] BYREF
void *v63; // [rsp+A0h] [rbp-D0h]
__int128 v64; // [rsp+B0h] [rbp-C0h] BYREF
void *v65; // [rsp+C0h] [rbp-B0h]
int v66; // [rsp+D4h] [rbp-9Ch]
std::string v67; // [rsp+D8h] [rbp-98h] BYREF
int v68; // [rsp+F4h] [rbp-7Ch]
__int64 v69; // [rsp+F8h] [rbp-78h]
std::string v70; // [rsp+100h] [rbp-70h] BYREF
int v71; // [rsp+118h] [rbp-58h]
char v72; // [rsp+11Eh] [rbp-52h]
char v73; // [rsp+11Fh] [rbp-51h]
std::string __s; // [rsp+120h] [rbp-50h] BYREF
bool v75; // [rsp+146h] [rbp-2Ah]
unsigned __int8 v76; // [rsp+147h] [rbp-29h]
Key = (char *)GJSearchObject::getKey(a2);
if ( GameLevelManager::isDLActive(a1, Key) )
return;
v69 = a1;
v57 = Key;
GameLevelManager::addDLToActive(a1, Key);
v76 = *(_BYTE *)(a2 + 404);
if ( v76 )
{
v4 = 1;
v71 = 0;
}
else
{
v4 = *(_BYTE *)(a2 + 405);
v71 = v4;
}
v5 = *(_DWORD *)(a2 + 316);
*(_WORD *)&v67.__r_.__value_.__l.0 = 10242;
v67.__r_.__value_.__s.__data_[1] = 0;
v75 = (unsigned int)(v5 - 32) < 3;
if ( (v76 & v75) == 1 )
{
if ( v5 == 33 )
{
v6 = 100000;
v7 = 200000;
}
else if ( v5 == 34 )
{
v6 = 200000;
v7 = 0x7FFFFFFF;
}
else
{
v6 = 0;
v7 = 100000;
}
v19 = GameStatsManager::sharedState();
GameStatsManager::getCompletedDailyIDs(&__s, v19, v6, v7);
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
{
data = __s.__r_.__value_.__l.__data_;
size = __s.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&__s.__r_.__value_.__l.0 >> 1;
data = __s.__r_.__value_.__s.__data_;
}
std::string::append(&v67, data, size);
std::string::append(&v67, ")");
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
{
v76 = __s.__r_.__value_.__l.__size_ != 0;
operator delete(__s.__r_.__value_.__l.__data_);
}
else
{
v76 = *(_BYTE *)&__s.__r_.__value_.__s.0 != 0;
}
v75 = 1;
v71 = 0;
}
else if ( v4 )
{
v8 = GameLevelManager::sharedState();
v9 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v9, "0073");
CompletedLevels = GameLevelManager::getCompletedLevels(v8, GameVariable);
if ( (unsigned int)sub_1007FEF90(CompletedLevels) )
{
sub_1007FEFE0(CompletedLevels, 0);
v12 = sub_10088E820("%i", v53);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v12);
std::string::append(&v67, CString);
for ( i = 1; i < (unsigned int)sub_1007FEF90(CompletedLevels); ++i )
{
sub_1007FEFE0(CompletedLevels, i);
std::string::append(&v67, ",");
v15 = sub_10088E820("%i", v54);
v16 = (const std::string::value_type *)cocos2d::CCString::getCString(v15);
std::string::append(&v67, v16);
}
}
std::string::append(&v67, ")");
v17 = (unsigned int)sub_1007FEF90(CompletedLevels) != 0;
v18 = v71;
LOBYTE(v18) = v17 & v71;
v71 = v18;
v76 &= v17;
}
v22 = *(_DWORD *)(a2 + 316);
v66 = *(_DWORD *)(a2 + 424);
v72 = *(_BYTE *)(a2 + 429);
v73 = *(_BYTE *)(a2 + 428);
if ( v22 != 5 )
{
v68 = 0;
if ( v22 )
goto LABEL_54;
LABEL_36:
if ( (*(_BYTE *)(a2 + 320) & 1) != 0 )
sub_10001AD30(&v70, *(const void **)(a2 + 336), *(_QWORD *)(a2 + 328));
else
v70 = *(std::string *)(a2 + 320);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
v26 = v70.__r_.__value_.__l.__data_;
else
v26 = v70.__r_.__value_.__s.__data_;
v27 = strlen(v26);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v28 = v27;
if ( v27 >= 0x17 )
{
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = (v27 | 7) + 1;
v29 = (char *)operator new(v30);
__s.__r_.__value_.__r.__words[2] = (std::string::size_type)v29;
__s.__r_.__value_.__r.__words[0] = v30 | 1;
__s.__r_.__value_.__l.__size_ = v28;
}
else
{
__s.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v27);
v29 = __s.__r_.__value_.__s.__data_;
if ( !v27 )
goto LABEL_50;
}
memmove(v29, v26, v28);
LABEL_50:
v29[v28] = 0;
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v70.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__s.__r_.__value_.__l.__data_);
goto LABEL_54;
}
if ( (*(_BYTE *)(a2 + 320) & 1) != 0 )
sub_10001AD30(&__s, *(const void **)(a2 + 336), *(_QWORD *)(a2 + 328));
else
__s = *(std::string *)(a2 + 320);
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
v23 = __s.__r_.__value_.__l.__data_;
else
v23 = __s.__r_.__value_.__s.__data_;
v24 = atoi(v23);
v25 = GameManager::sharedState();
LOBYTE(v25) = v24 == *(_DWORD *)(v25 + 660) - *(_DWORD *)(v25 + 664);
v68 = v25;
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__s.__r_.__value_.__l.__data_);
if ( !*(_DWORD *)(a2 + 316) )
goto LABEL_36;
LABEL_54:
GameLevelManager::getBasePostString(&__s);
v31 = (_OWORD *)(a2 + 320);
if ( (*(_BYTE *)(a2 + 320) & 1) != 0 )
{
sub_10001AD30(&v70, *(const void **)(a2 + 336), *(_QWORD *)(a2 + 328));
}
else
{
v70.__r_.__value_.__r.__words[2] = *(_QWORD *)(a2 + 336);
*(_OWORD *)&v70.__r_.__value_.__l.0 = *v31;
}
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
{
if ( (*(_BYTE *)(a2 + 344) & 1) != 0 )
goto LABEL_59;
}
else if ( (*(_BYTE *)(a2 + 344) & 1) != 0 )
{
LABEL_59:
sub_10001AD30(&v62, *(const void **)(a2 + 360), *(_QWORD *)(a2 + 352));
if ( (v62 & 1) != 0 )
goto LABEL_60;
LABEL_64:
if ( (*(_BYTE *)(a2 + 368) & 1) != 0 )
goto LABEL_61;
goto LABEL_65;
}
v63 = *(void **)(a2 + 360);
v62 = *(_OWORD *)(a2 + 344);
if ( (v62 & 1) == 0 )
goto LABEL_64;
LABEL_60:
if ( (*(_BYTE *)(a2 + 368) & 1) != 0 )
{
LABEL_61:
sub_10001AD30(&v64, *(const void **)(a2 + 384), *(_QWORD *)(a2 + 376));
goto LABEL_66;
}
LABEL_65:
v65 = *(void **)(a2 + 384);
v64 = *(_OWORD *)(a2 + 368);
LABEL_66:
v32 = sub_10088E820(
"&type=%i&str=%s&diff=%s&len=%s&page=%i&total=%i&uncompleted=%i&onlyCompleted=%i&featured=%i&original=%i&twoPlayer=%i&coins=%i",
*(_DWORD *)(a2 + 400));
v33 = (const std::string::value_type *)cocos2d::CCString::getCString(v32);
std::string::append(&__s, v33);
if ( (v64 & 1) != 0 )
{
operator delete(v65);
if ( (v62 & 1) == 0 )
{
LABEL_68:
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_69;
LABEL_73:
operator delete(v70.__r_.__value_.__l.__data_);
if ( !v75 )
goto LABEL_75;
goto LABEL_74;
}
}
else if ( (v62 & 1) == 0 )
{
goto LABEL_68;
}
operator delete(v63);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_73;
LABEL_69:
if ( v75 )
{
LABEL_74:
v34 = sub_10088E820("&active=%i", v55);
v33 = (const std::string::value_type *)cocos2d::CCString::getCString(v34);
std::string::append(&__s, v33);
}
LABEL_75:
if ( *(_BYTE *)(a2 + 410) == 1 )
{
v33 = "&epic=1";
std::string::append(&__s, "&epic=1");
}
if ( *(_BYTE *)(a2 + 411) == 1 )
{
v33 = "&legendary=1";
std::string::append(&__s, "&legendary=1");
}
if ( *(_BYTE *)(a2 + 412) == 1 )
{
v33 = "&mythic=1";
std::string::append(&__s, "&mythic=1");
}
if ( (_BYTE)v68 )
{
v33 = "&local=1";
std::string::append(&__s, "&local=1");
}
if ( v72 )
{
std::string::append(&__s, "&song=");
v35 = sub_10088E820("%i", v55);
v33 = (const std::string::value_type *)cocos2d::CCString::getCString(v35);
std::string::append(&__s, v33);
if ( v73 )
{
v33 = "&customSong=1";
std::string::append(&__s, "&customSong=1");
}
}
GameLevelManager::writeSpecialFilters(&v70, (__int64)v33, a2);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
v36 = v70.__r_.__value_.__l.__data_;
else
v36 = v70.__r_.__value_.__s.__data_;
std::string::append(&__s, v36);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v70.__r_.__value_.__l.__data_);
if ( (((unsigned __int8)v71 | v76) & 1) != 0 )
{
std::string::append(&__s, "&completedLevels=");
if ( (*(_BYTE *)&v67.__r_.__value_.__s.0 & 1) != 0 )
v37 = v67.__r_.__value_.__l.__data_;
else
v37 = v67.__r_.__value_.__s.__data_;
std::string::append(&__s, v37);
}
v38 = *(_DWORD *)(a2 + 316);
if ( v38 == 25 )
{
if ( (*(_BYTE *)v31 & 1) != 0 )
{
sub_10001AD30(&v70, *(const void **)(a2 + 336), *(_QWORD *)(a2 + 328));
}
else
{
v70.__r_.__value_.__r.__words[2] = *(_QWORD *)(a2 + 336);
*(_OWORD *)&v70.__r_.__value_.__l.0 = *v31;
}
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
{
v40 = v70.__r_.__value_.__l.__data_;
v39 = atoi(v70.__r_.__value_.__l.__data_);
operator delete(v40);
}
else
{
v39 = atoi(v70.__r_.__value_.__s.__data_);
}
if ( !(unsigned __int8)GameLevelManager::hasDownloadedLevel(v69, (unsigned int)-v39) )
std::string::append(&__s, "&inc=1");
v38 = *(_DWORD *)(a2 + 316);
}
if ( v38 == 31 )
std::string::append(&__s, "&hypeSecret=1");
std::string::append(&__s, "&secret=");
v41 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
v42 = (const std::string::value_type *)cocos2d::CCString::getCString(v41);
std::string::append(&__s, v42);
v56.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v56.__r_.__value_.__r.__words[0] = 57;
v56.__r_.__value_.__l.__size_ = 52;
strcpy(v56.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/getGJLevels21.php");
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) != 0 )
v43 = __s.__r_.__value_.__l.__data_;
else
v43 = __s.__r_.__value_.__s.__data_;
v44 = strlen(v43);
if ( v44 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v45 = v44;
if ( v44 >= 0x17 )
{
v47 = 26;
if ( (v44 | 7) != 0x17 )
v47 = (v44 | 7) + 1;
v46 = (char *)operator new(v47);
v59 = v46;
__dst[0] = v47 | 1;
__dst[1] = v45;
goto LABEL_118;
}
LOBYTE(__dst[0]) = 2 * v44;
v46 = (char *)__dst + 1;
if ( v44 )
LABEL_118:
memmove(v46, v43, v45);
v46[v45] = 0;
v48 = strlen(v57);
if ( v48 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v49 = v48;
if ( v48 >= 0x17 )
{
v52 = 26;
if ( (v48 | 7) != 0x17 )
v52 = (v48 | 7) + 1;
v50 = (char *)operator new(v52);
v61 = v50;
*(_QWORD *)&v60 = v52 | 1;
*((_QWORD *)&v60 + 1) = v49;
v51 = v69;
goto LABEL_126;
}
LOBYTE(v60) = 2 * v48;
v50 = (char *)&v60 + 1;
v51 = v69;
if ( v48 )
LABEL_126:
memmove(v50, v57, v49);
v50[v49] = 0;
GameLevelManager::ProcessHttpRequest(v51, &v56, (__int64)__dst, &v60, 2u);
if ( (v60 & 1) != 0 )
{
operator delete(v61);
if ( (__dst[0] & 1) == 0 )
{
LABEL_129:
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_130;
LABEL_136:
operator delete(v56.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_131:
if ( (*(_BYTE *)&v67.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_132;
}
goto LABEL_137;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_129;
}
operator delete(v59);
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_136;
LABEL_130:
if ( (*(_BYTE *)&__s.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_131;
LABEL_137:
operator delete(__s.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v67.__r_.__value_.__s.0 & 1) != 0 )
LABEL_132:
operator delete(v67.__r_.__value_.__l.__data_);
}