//
// GameLevelManager::uploadLevelList from 0x100559b60 to 0x10055a63f (2783 bytes)
//
// 1 xrefs:
// > UploadListPopup::init @ 0x10034f84f
//
// 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:07 +0000
//
__int64 __fastcall GameLevelManager::uploadLevelList(std::string *a1, __int64 a2)
{
__int64 **size; // r15
size_t v3; // r12
char *v4; // rbx
unsigned int v5; // r14d
size_t v6; // r14
__int64 *v7; // rsi
size_t v8; // r13
int v9; // eax
bool v10; // cl
int v11; // eax
bool v12; // cl
std::string *p_str; // rdi
int v14; // ebx
__int64 v15; // rax
const std::string::value_type *CString; // rax
const char *data; // rdi
int v18; // eax
__int64 v19; // rsi
__int64 v20; // rbx
int v21; // r12d
__int64 v22; // r14
std::string::pointer v23; // rax
__int64 v24; // rax
const std::string::value_type *v25; // rsi
std::string::size_type v26; // rdx
const char *v27; // r15
unsigned int v28; // eax
size_t v29; // rax
std::string::size_type v30; // r15
char *v31; // r12
size_t v32; // r13
__int64 v33; // rax
const std::string::value_type *v34; // rax
__int64 v35; // rax
const std::string::value_type *v36; // rax
const char *v37; // r14
size_t v38; // rax
size_t v39; // r15
char *v40; // r12
__int64 v41; // rdi
size_t v42; // r13
char v44; // [rsp+0h] [rbp-270h]
char *v45; // [rsp+18h] [rbp-258h]
std::string v47; // [rsp+28h] [rbp-248h] BYREF
std::string v48; // [rsp+40h] [rbp-230h] BYREF
std::string v49; // [rsp+60h] [rbp-210h] BYREF
std::string v50; // [rsp+80h] [rbp-1F0h] BYREF
__int128 v51; // [rsp+A0h] [rbp-1D0h] BYREF
void *v52; // [rsp+B0h] [rbp-1C0h]
__int128 v53; // [rsp+C0h] [rbp-1B0h] BYREF
void *v54; // [rsp+D0h] [rbp-1A0h]
std::string __dst; // [rsp+E0h] [rbp-190h] BYREF
_QWORD v56[2]; // [rsp+F8h] [rbp-178h] BYREF
void *v57; // [rsp+108h] [rbp-168h]
std::string v58; // [rsp+110h] [rbp-160h] BYREF
std::string v59; // [rsp+128h] [rbp-148h] BYREF
std::string *v60; // [rsp+140h] [rbp-130h]
__int128 v61; // [rsp+148h] [rbp-128h] BYREF
void *v62; // [rsp+158h] [rbp-118h]
__int128 v63; // [rsp+160h] [rbp-110h] BYREF
void *__s1; // [rsp+170h] [rbp-100h]
void *v65; // [rsp+178h] [rbp-F8h]
__int128 v66; // [rsp+180h] [rbp-F0h] BYREF
void *v67; // [rsp+190h] [rbp-E0h]
__int128 v68; // [rsp+1A0h] [rbp-D0h] BYREF
void *v69; // [rsp+1B0h] [rbp-C0h]
std::string v70; // [rsp+1B8h] [rbp-B8h] BYREF
std::string __str; // [rsp+1D0h] [rbp-A0h] BYREF
char v72; // [rsp+1EFh] [rbp-81h]
char __src[48]; // [rsp+1F0h] [rbp-80h] BYREF
_BYTE v74[32]; // [rsp+220h] [rbp-50h] BYREF
GameToolbox::intToString((size_t *)&v63, *(_DWORD *)(a2 + 548));
v60 = a1;
size = (__int64 **)a1[30].__r_.__value_.__l.__size_;
if ( !size )
{
LABEL_19:
p_str = v60 + 30;
sub_1005913C0(&v60[30], &v63);
if ( (*(_BYTE *)(a2 + 432) & 1) != 0 )
{
p_str = (std::string *)&v66;
sub_10001AD30(&v66, *(const void **)(a2 + 448), *(_QWORD *)(a2 + 440));
}
else
{
v67 = *(void **)(a2 + 448);
v66 = *(_OWORD *)(a2 + 432);
}
if ( (*(_BYTE *)(a2 + 504) & 1) != 0 )
{
p_str = (std::string *)&v68;
sub_10001AD30(&v68, *(const void **)(a2 + 520), *(_QWORD *)(a2 + 512));
}
else
{
v69 = *(void **)(a2 + 520);
v68 = *(_OWORD *)(a2 + 504);
}
if ( (*(_BYTE *)(a2 + 480) & 1) != 0 )
{
p_str = &__str;
sub_10001AD30(&__str, *(const void **)(a2 + 496), *(_QWORD *)(a2 + 488));
}
else
{
__str = *(std::string *)(a2 + 480);
}
if ( *(_BYTE *)(a2 + 393) == 1 )
{
v14 = 0;
if ( (v66 & 1) == 0 )
{
LABEL_30:
v48.__r_.__value_.__r.__words[2] = (std::string::size_type)v67;
*(_OWORD *)&v48.__r_.__value_.__l.0 = v66;
goto LABEL_40;
}
}
else
{
p_str = (std::string *)GameManager::sharedState();
if ( GameManager::safeModeEnabled((__int64)p_str) )
{
v14 = 0;
if ( (v66 & 1) == 0 )
goto LABEL_30;
}
else
{
v14 = *(unsigned __int8 *)(a2 + 400) + 2;
if ( !*(_BYTE *)(a2 + 401) )
v14 = *(unsigned __int8 *)(a2 + 400);
if ( (v66 & 1) == 0 )
goto LABEL_30;
}
}
p_str = &v48;
sub_10001AD30(&v48, v67, *((unsigned __int64 *)&v66 + 1));
LABEL_40:
GameLevelManager::removeDelimiterChars((__int64)p_str, &v48, 0);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
{
p_str = (std::string *)v48.__r_.__value_.__l.__data_;
operator delete(v48.__r_.__value_.__l.__data_);
}
if ( (v68 & 1) != 0 )
{
p_str = &v49;
sub_10001AD30(&v49, v69, *((unsigned __int64 *)&v68 + 1));
}
else
{
v49.__r_.__value_.__r.__words[2] = (std::string::size_type)v69;
*(_OWORD *)&v49.__r_.__value_.__l.0 = v68;
}
GameLevelManager::removeDelimiterChars((__int64)p_str, &v49, 0);
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
{
p_str = (std::string *)v49.__r_.__value_.__l.__data_;
operator delete(v49.__r_.__value_.__l.__data_);
}
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
p_str = &v50;
sub_10001AD30(&v50, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
}
else
{
v50 = __str;
}
GameLevelManager::removeDelimiterChars((__int64)p_str, &v50, 0);
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v50.__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(&v59);
v15 = sub_10088E820(
"&listID=%i&listName=%s&listDesc=%s&listLevels=%s&difficulty=%i&listVersion=%i&original=%i&unlisted=%i",
*(_DWORD *)(a2 + 348));
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v15);
std::string::append(&v59, CString);
sub_10051B980(&v61, 5);
*(_WORD *)&v58.__r_.__value_.__l.0 = 0;
data = __str.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
data = __str.__r_.__value_.__l.__data_;
LODWORD(v65) = v14;
v18 = strlen(data);
if ( v18 > 49 )
{
v20 = (int)(float)((float)v18 / 50.0);
v21 = 50;
v22 = 0;
do
{
v23 = __str.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
v23 = __str.__r_.__value_.__l.__data_;
v19 = (unsigned int)v23[v22];
std::string::push_back(&v58, v23[v22]);
v22 += v20;
--v21;
}
while ( v21 );
}
else
{
v19 = (__int64)&__str;
std::string::operator=(&v58, &__str);
}
v24 = GJAccountManager::sharedState((__int64)&v58, v19);
GameToolbox::intToString((size_t *)&v70, *(_DWORD *)(v24 + 352) - *(_DWORD *)(v24 + 356));
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
{
v25 = v70.__r_.__value_.__l.__data_;
v26 = v70.__r_.__value_.__l.__size_;
}
else
{
v26 = *(_BYTE *)&v70.__r_.__value_.__l.0 >> 1;
v25 = v70.__r_.__value_.__s.__data_;
}
std::string::append(&v58, v25, v26);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v70.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 )
v27 = v58.__r_.__value_.__l.__data_;
else
v27 = v58.__r_.__value_.__s.__data_;
v28 = strlen(v27);
sub_100872DB0(v27, v28, v74);
sub_100873590(v74, __src);
v29 = strlen(__src);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v30 = v29;
if ( v29 >= 0x17 )
{
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = (v29 | 7) + 1;
v31 = (char *)operator new(v32);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v31;
__dst.__r_.__value_.__r.__words[0] = v32 | 1;
__dst.__r_.__value_.__l.__size_ = v30;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v29);
v31 = __dst.__r_.__value_.__s.__data_;
if ( !v29 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
if ( (v61 & 1) == 0 )
{
LABEL_72:
v52 = v62;
v51 = v61;
goto LABEL_78;
}
LABEL_77:
sub_10001AD30(&v51, v62, *((unsigned __int64 *)&v61 + 1));
LABEL_78:
cocos2d::ZipUtils::base64EncodeEnc(&v70, &__dst, &v51);
if ( (v51 & 1) != 0 )
{
operator delete(v52);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_83:
v33 = sub_10088E820("&seed=%s&seed2=%s¬ify=%i", v44);
v34 = (const std::string::value_type *)cocos2d::CCString::getCString(v33);
std::string::append(&v59, v34);
std::string::append(&v59, "&secret=");
v35 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
v36 = (const std::string::value_type *)cocos2d::CCString::getCString(v35);
std::string::append(&v59, v36);
v47.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v47.__r_.__value_.__r.__words[0] = 65;
v47.__r_.__value_.__l.__size_ = 56;
strcpy(v47.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/uploadGJLevelList.php");
if ( (*(_BYTE *)&v59.__r_.__value_.__s.0 & 1) != 0 )
v37 = v59.__r_.__value_.__l.__data_;
else
v37 = v59.__r_.__value_.__s.__data_;
v38 = strlen(v37);
if ( v38 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v39 = v38;
if ( v38 >= 0x17 )
{
v42 = 26;
if ( (v38 | 7) != 0x17 )
v42 = (v38 | 7) + 1;
v40 = (char *)operator new(v42);
v57 = v40;
v56[0] = v42 | 1;
v56[1] = v39;
}
else
{
LOBYTE(v56[0]) = 2 * v38;
v40 = (char *)v56 + 1;
if ( !v38 )
{
BYTE1(v56[0]) = 0;
if ( (v63 & 1) == 0 )
{
LABEL_90:
v54 = __s1;
v53 = v63;
v41 = (__int64)v60;
goto LABEL_96;
}
LABEL_95:
sub_10001AD30(&v53, __s1, *((unsigned __int64 *)&v63 + 1));
v41 = (__int64)v60;
LABEL_96:
GameLevelManager::ProcessHttpRequest(v41, &v47, (__int64)v56, &v53, 0x43u);
if ( (v53 & 1) != 0 )
{
operator delete(v54);
if ( (v56[0] & 1) == 0 )
{
LABEL_98:
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_99;
goto LABEL_112;
}
}
else if ( (v56[0] & 1) == 0 )
{
goto LABEL_98;
}
operator delete(v57);
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_99:
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_100;
goto LABEL_113;
}
LABEL_112:
operator delete(v47.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v70.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_100:
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_101;
goto LABEL_114;
}
LABEL_113:
operator delete(v70.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_101:
if ( (v61 & 1) == 0 )
goto LABEL_102;
goto LABEL_115;
}
LABEL_114:
operator delete(v58.__r_.__value_.__l.__data_);
if ( (v61 & 1) == 0 )
{
LABEL_102:
if ( (*(_BYTE *)&v59.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_103;
goto LABEL_116;
}
LABEL_115:
operator delete(v62);
if ( (*(_BYTE *)&v59.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_103:
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_104;
goto LABEL_117;
}
LABEL_116:
operator delete(v59.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_104:
if ( (v68 & 1) == 0 )
goto LABEL_105;
goto LABEL_118;
}
LABEL_117:
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v68 & 1) == 0 )
{
LABEL_105:
if ( (v66 & 1) == 0 )
goto LABEL_107;
goto LABEL_106;
}
LABEL_118:
operator delete(v69);
if ( (v66 & 1) == 0 )
{
LABEL_107:
if ( (v63 & 1) != 0 )
goto LABEL_108;
return __stack_chk_guard;
}
LABEL_106:
operator delete(v67);
goto LABEL_107;
}
}
memmove(v40, v37, v39);
v40[v39] = 0;
if ( (v63 & 1) == 0 )
goto LABEL_90;
goto LABEL_95;
}
}
else if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_83;
}
operator delete(__dst.__r_.__value_.__l.__data_);
goto LABEL_83;
}
}
memcpy(v31, __src, v30);
v31[v30] = 0;
if ( (v61 & 1) == 0 )
goto LABEL_72;
goto LABEL_77;
}
v72 = v63 & 1;
if ( (v63 & 1) != 0 )
{
v3 = *((_QWORD *)&v63 + 1);
v4 = (char *)__s1;
}
else
{
v3 = (unsigned __int8)v63 >> 1;
v4 = (char *)&v63 + 1;
}
v45 = v4;
while ( 1 )
{
v5 = *((unsigned __int8 *)size + 32);
if ( (v5 & 1) != 0 )
{
v6 = (size_t)size[5];
v7 = size[6];
}
else
{
v6 = v5 >> 1;
v7 = (__int64 *)((char *)size + 33);
}
v8 = v3;
if ( v6 < v3 )
v8 = v6;
v65 = v7;
v9 = memcmp(v4, v7, v8);
v10 = v3 < v6;
if ( v9 )
v10 = v9 < 0;
if ( v10 )
goto LABEL_6;
v11 = memcmp(v65, v4, v8);
v12 = v6 < v3;
if ( v11 )
v12 = v11 < 0;
if ( !v12 )
break;
++size;
LABEL_6:
size = (__int64 **)*size;
v4 = v45;
if ( !size )
goto LABEL_19;
}
if ( !v72 )
return __stack_chk_guard;
LABEL_108:
operator delete(__s1);
return __stack_chk_guard;
}