//
// GameLevelManager::uploadLevel from 0x1005551c0 to 0x100556213 (4179 bytes)
//
// 1 xrefs:
// > UploadPopup::init @ 0x10026ea86
//
// 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:05 +0000
//
__int64 __fastcall GameLevelManager::uploadLevel(__int64 a1, char *a2)
{
char *v2; // r15
__int64 v3; // rax
__int64 v4; // rax
char *CString; // r13
char *v6; // r12
size_t v7; // rax
size_t v8; // rbx
char *v9; // r14
char *v10; // r15
size_t v11; // r13
__int64 v12; // rbx
__int64 v13; // r13
size_t v14; // rax
size_t v15; // rbx
char *v16; // r14
size_t v17; // r12
__int128 *v18; // rdi
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
char v24; // al
int v25; // eax
int v26; // eax
char *v27; // rcx
char *v28; // rax
int v29; // r14d
__int64 v30; // rax
const std::string::value_type *v31; // rax
__int64 v32; // rax
const std::string::value_type *v33; // rax
char *v34; // rbx
__int64 v35; // rax
const std::string::value_type *v36; // rax
const std::string::value_type *v37; // rsi
unsigned int v38; // eax
const std::string::value_type *v39; // rsi
unsigned int v40; // eax
const std::string::value_type *v41; // rsi
bool v42; // zf
const char *data; // rdi
int v44; // eax
__int64 v45; // r12
int v46; // r13d
__int64 v47; // r15
std::string::pointer v48; // rax
__int64 v49; // rax
const std::string::value_type *v50; // rax
const char *v51; // rbx
unsigned int v52; // eax
size_t v53; // rax
std::string::size_type v54; // rbx
char *v55; // r13
char *v56; // r15
char *v57; // r14
size_t v58; // r12
char *v59; // rbx
__int64 v60; // rax
const std::string::value_type *v61; // rax
const std::string::value_type *v62; // rsi
char *v63; // r15
const std::string::value_type *v64; // rsi
__int64 v65; // rax
const std::string::value_type *v66; // rax
const char *v67; // r15
size_t v68; // rax
size_t v69; // rbx
char *v70; // r14
size_t v71; // r12
size_t v72; // rax
size_t v73; // rbx
char *v74; // r14
__int64 v75; // r15
size_t v76; // r15
char v78; // [rsp+0h] [rbp-340h]
char v79; // [rsp+0h] [rbp-340h]
char v80; // [rsp+0h] [rbp-340h]
char v81; // [rsp+0h] [rbp-340h]
__int128 v82; // [rsp+80h] [rbp-2C0h] BYREF
void *v83; // [rsp+90h] [rbp-2B0h]
std::string v84; // [rsp+98h] [rbp-2A8h] BYREF
__int128 v85; // [rsp+B0h] [rbp-290h] BYREF
void *v86; // [rsp+C0h] [rbp-280h]
std::string v87; // [rsp+C8h] [rbp-278h] BYREF
__int128 v88; // [rsp+E0h] [rbp-260h] BYREF
void *v89; // [rsp+F0h] [rbp-250h]
__int128 v90; // [rsp+100h] [rbp-240h] BYREF
void *v91; // [rsp+110h] [rbp-230h]
__int128 v92; // [rsp+120h] [rbp-220h] BYREF
void *v93; // [rsp+130h] [rbp-210h]
char *v94; // [rsp+138h] [rbp-208h]
char *v95; // [rsp+140h] [rbp-200h]
char *v96; // [rsp+148h] [rbp-1F8h]
_QWORD v97[2]; // [rsp+150h] [rbp-1F0h] BYREF
void *v98; // [rsp+160h] [rbp-1E0h]
__int128 v99; // [rsp+168h] [rbp-1D8h] BYREF
void *v100; // [rsp+178h] [rbp-1C8h]
std::string v101; // [rsp+180h] [rbp-1C0h] BYREF
int v102; // [rsp+19Ch] [rbp-1A4h]
int v103; // [rsp+1A0h] [rbp-1A0h]
int v104; // [rsp+1A4h] [rbp-19Ch]
__int64 v105; // [rsp+1A8h] [rbp-198h]
std::string::value_type v106[16]; // [rsp+1B0h] [rbp-190h] BYREF
void *v107; // [rsp+1C0h] [rbp-180h]
std::string __str; // [rsp+1D0h] [rbp-170h] BYREF
char *v109; // [rsp+1F0h] [rbp-150h]
char *v110; // [rsp+1F8h] [rbp-148h]
__int128 v111; // [rsp+200h] [rbp-140h] BYREF
void *v112; // [rsp+210h] [rbp-130h]
__int128 v113; // [rsp+220h] [rbp-120h] BYREF
void *v114; // [rsp+230h] [rbp-110h]
__int128 v115; // [rsp+240h] [rbp-100h] BYREF
void *v116; // [rsp+250h] [rbp-F0h]
std::string v117; // [rsp+260h] [rbp-E0h] BYREF
char *__s; // [rsp+278h] [rbp-C8h]
std::string::value_type v119[16]; // [rsp+280h] [rbp-C0h] BYREF
void *v120; // [rsp+290h] [rbp-B0h]
int v121; // [rsp+2A4h] [rbp-9Ch]
std::string v122; // [rsp+2A8h] [rbp-98h] BYREF
__int64 __dst; // [rsp+2C0h] [rbp-80h] BYREF
size_t v124; // [rsp+2C8h] [rbp-78h]
void *__p; // [rsp+2D0h] [rbp-70h]
_BYTE v126[32]; // [rsp+2F0h] [rbp-50h] BYREF
v2 = a2;
v3 = GameManager::sharedState();
GameManager::reportAchievementWithID(v3, "geometry.ach.submit", 100, 0);
v4 = sub_10088E820("%i", v78);
CString = (char *)cocos2d::CCString::getCString(v4);
v105 = a1;
v6 = *(char **)(a1 + 1088);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
{
__s = *(char **)(a1 + 1088);
v10 = CString;
v11 = 26;
if ( (v7 | 7) != 0x17 )
v11 = (v7 | 7) + 1;
v9 = (char *)operator new(v11);
__p = v9;
__dst = v11 + 1;
CString = v10;
v2 = a2;
v6 = __s;
v124 = v8;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
LABEL_8:
memmove(v9, CString, v8);
v9[v8] = 0;
v12 = cocos2d::CCDictionary::objectForKey((__int64)v6, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v12 )
return __stack_chk_guard;
__s = CString;
v13 = *(_QWORD *)(v105 + 1088);
v109 = (char *)cocos2d::CCNode::create();
v14 = strlen(__s);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v15 = v14;
if ( v14 >= 0x17 )
{
v17 = 26;
if ( (v14 | 7) != 0x17 )
v17 = (v14 | 7) + 1;
v16 = (char *)operator new(v17);
__p = v16;
__dst = v17 | 1;
v124 = v15;
goto LABEL_19;
}
LOBYTE(__dst) = 2 * v14;
v16 = (char *)&__dst + 1;
if ( v14 )
LABEL_19:
memmove(v16, __s, v15);
v16[v15] = 0;
v18 = (__int128 *)v13;
cocos2d::CCDictionary::setObject(v13, (__int64)v109, (char *)&__dst);
if ( (__dst & 1) != 0 )
{
v18 = (__int128 *)__p;
operator delete(__p);
}
v19 = GameManager::sharedState();
if ( (*(_BYTE *)(v19 + 632) & 1) != 0 )
{
v18 = &v111;
sub_10001AD30(&v111, *(const void **)(v19 + 648), *(_QWORD *)(v19 + 640));
}
else
{
v20 = v19 + 632;
v112 = *(void **)(v20 + 16);
v111 = *(_OWORD *)v20;
}
v21 = GameManager::sharedState();
if ( (*(_BYTE *)(v21 + 608) & 1) != 0 )
{
v18 = &v82;
sub_10001AD30(&v82, *(const void **)(v21 + 624), *(_QWORD *)(v21 + 616));
}
else
{
v22 = v21 + 608;
v83 = *(void **)(v22 + 16);
v82 = *(_OWORD *)v22;
}
if ( (v2[344] & 1) != 0 )
{
v18 = &v113;
sub_10001AD30(&v113, *((const void **)v2 + 45), *((_QWORD *)v2 + 44));
}
else
{
v114 = *((void **)v2 + 45);
v113 = *(_OWORD *)(v2 + 344);
}
if ( (v2[368] & 1) != 0 )
{
v18 = &v115;
sub_10001AD30(&v115, *((const void **)v2 + 48), *((_QWORD *)v2 + 47));
}
else
{
v116 = *((void **)v2 + 48);
v115 = *((_OWORD *)v2 + 23);
}
if ( (v111 & 1) != 0 )
{
v18 = &v88;
sub_10001AD30(&v88, v112, *((unsigned __int64 *)&v111 + 1));
}
else
{
v89 = v112;
v88 = v111;
}
GameLevelManager::removeDelimiterChars(v18, &v88, 0);
if ( (v88 & 1) != 0 )
{
v18 = (__int128 *)v89;
operator delete(v89);
}
if ( (v113 & 1) != 0 )
{
v18 = &v90;
sub_10001AD30(&v90, v114, *((unsigned __int64 *)&v113 + 1));
}
else
{
v91 = v114;
v90 = v113;
}
GameLevelManager::removeDelimiterChars(v18, &v90, 0);
if ( (v90 & 1) != 0 )
{
v18 = (__int128 *)v91;
operator delete(v91);
}
if ( (v115 & 1) != 0 )
{
v18 = &v92;
sub_10001AD30(&v92, v116, *((unsigned __int64 *)&v115 + 1));
}
else
{
v93 = v116;
v92 = v115;
}
GameLevelManager::removeDelimiterChars(v18, &v92, 0);
if ( (v92 & 1) != 0 )
operator delete(v93);
GameLevelManager::getBasePostString(&v122);
if ( v2[616] == 1 )
{
LODWORD(v110) = 2 - (unsigned __int8)v2[617];
v121 = 0;
}
else
{
v23 = GameManager::sharedState();
v24 = GameManager::safeModeEnabled(v23);
LODWORD(v110) = 0;
if ( v24 )
{
v121 = 0;
}
else
{
v25 = (unsigned __int8)v2[618] + 2;
if ( !v2[619] )
v25 = (unsigned __int8)v2[618];
v121 = v25;
}
}
v26 = 0;
v103 = *((_DWORD *)v2 + 152);
if ( v103 > 0 )
{
if ( (v111 & 1) != 0 )
goto LABEL_58;
LABEL_61:
v94 = (char *)&v111 + 1;
if ( (v113 & 1) == 0 )
goto LABEL_59;
goto LABEL_62;
}
v26 = *((_DWORD *)v2 + 151);
if ( (v111 & 1) == 0 )
goto LABEL_61;
LABEL_58:
v94 = (char *)v112;
if ( (v113 & 1) == 0 )
{
LABEL_59:
v27 = (char *)&v113 + 1;
goto LABEL_63;
}
LABEL_62:
v27 = (char *)v114;
LABEL_63:
v95 = v27;
v102 = v26;
if ( (v115 & 1) != 0 )
v28 = (char *)v116;
else
v28 = (char *)&v115 + 1;
v96 = v28;
v104 = *((_DWORD *)v2 + 197);
v29 = *((_DWORD *)v2 + 225);
v109 = v2;
v30 = sub_10088E820(
"&userName=%s&levelID=%i&levelName=%s&levelDesc=%s&levelVersion=%i&levelLength=%i&audioTrack=%i&auto=%i&passwor"
"d=%i&original=%i&twoPlayer=%i&songID=%i&objects=%i&coins=%i&requestedStars=%i&unlisted=%i&wt=%i&wt2=%i&ldm=%i&ts=%i¬ify=%i",
v29);
v31 = (const std::string::value_type *)cocos2d::CCString::getCString(v30);
std::string::append(&v122, v31);
time(nullptr);
v32 = sub_10088E820("&ct=%lld", v79);
v33 = (const std::string::value_type *)cocos2d::CCString::getCString(v32);
std::string::append(&v122, v33);
v34 = v109;
sub_100556730(&__dst, v109 + 664);
v35 = sub_10088E820("&bs=%s", v80);
v36 = (const std::string::value_type *)cocos2d::CCString::getCString(v35);
std::string::append(&v122, v36);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (v34[1176] & 1) != 0 )
{
sub_10001AD30(v106, *((const void **)v34 + 149), *((_QWORD *)v34 + 148));
}
else
{
v107 = *((void **)v34 + 149);
*(_OWORD *)v106 = *(_OWORD *)(v34 + 1176);
}
if ( (v106[0] & 1) != 0 )
{
if ( !*(_QWORD *)&v106[8] )
goto LABEL_79;
}
else if ( !((unsigned __int8)v106[0] >> 1) )
{
goto LABEL_79;
}
std::string::append(&v122, "&extraString=");
if ( (v106[0] & 1) != 0 )
v37 = (const std::string::value_type *)v107;
else
v37 = &v106[1];
std::string::append(&v122, v37);
LABEL_79:
v38 = (unsigned __int8)v34[1240];
if ( (v38 & 1) != 0 )
{
if ( !*((_QWORD *)v34 + 156) )
goto LABEL_87;
}
else if ( !(v38 >> 1) )
{
goto LABEL_87;
}
std::string::append(&v122, "&songIDs=");
if ( (v34[1240] & 1) != 0 )
v39 = *((const std::string::value_type **)v34 + 157);
else
v39 = v34 + 1241;
std::string::append(&v122, v39);
LABEL_87:
v40 = (unsigned __int8)v34[1264];
if ( (v40 & 1) != 0 )
{
if ( !*((_QWORD *)v34 + 159) )
goto LABEL_95;
}
else if ( !(v40 >> 1) )
{
goto LABEL_95;
}
std::string::append(&v122, "&sfxIDs=");
if ( (v34[1264] & 1) != 0 )
v41 = *((const std::string::value_type **)v34 + 160);
else
v41 = v34 + 1265;
std::string::append(&v122, v41);
LABEL_95:
v42 = (v34[392] & 1) == 0;
v110 = v34 + 392;
if ( v42 )
__str = *(std::string *)(v34 + 392);
else
sub_10001AD30(&__str, *((const void **)v34 + 51), *((_QWORD *)v34 + 50));
*(_WORD *)&v101.__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_;
v44 = strlen(data);
if ( v44 > 49 )
{
v45 = (int)(float)((float)v44 / 50.0);
v46 = 50;
v47 = 0;
do
{
v48 = __str.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
v48 = __str.__r_.__value_.__l.__data_;
std::string::push_back(&v101, v48[v47]);
v47 += v45;
--v46;
}
while ( v46 );
}
else
{
std::string::operator=(&v101, &__str);
}
v49 = sub_10088E820("%c%s%s%c%c%s", (char)"Qg");
v50 = (const std::string::value_type *)cocos2d::CCString::getCString(v49);
std::string::append(&v101, v50);
if ( (*(_BYTE *)&v101.__r_.__value_.__s.0 & 1) != 0 )
v51 = v101.__r_.__value_.__l.__data_;
else
v51 = v101.__r_.__value_.__s.__data_;
v52 = strlen(v51);
sub_100872DB0(v51, v52, v126);
sub_100873590(v126, &__dst);
v53 = strlen((const char *)&__dst);
if ( v53 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v54 = v53;
v55 = __s;
v56 = v109;
if ( v53 >= 0x17 )
{
v58 = 26;
if ( (v53 | 7) != 0x17 )
v58 = (v53 | 7) + 1;
v57 = (char *)operator new(v58);
v117.__r_.__value_.__r.__words[2] = (std::string::size_type)v57;
v117.__r_.__value_.__r.__words[0] = v58 | 1;
v117.__r_.__value_.__l.__size_ = v54;
goto LABEL_116;
}
v117.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v53);
v57 = v117.__r_.__value_.__s.__data_;
if ( v53 )
LABEL_116:
memcpy(v57, &__dst, v54);
v57[v54] = 0;
strcpy((char *)&v85, "\n41274");
cocos2d::ZipUtils::base64EncodeEnc(&v84, &v117, &v85);
v59 = v110;
if ( (v85 & 1) != 0 )
operator delete(v86);
if ( (*(_BYTE *)&v117.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v117.__r_.__value_.__l.__data_);
sub_10051B980(&v117, 10);
v60 = sub_10088E820("&seed=%s&seed2=%s", v81);
v61 = (const std::string::value_type *)cocos2d::CCString::getCString(v60);
std::string::append(&v122, v61);
std::string::append(&v122, "&levelString=");
if ( (*v59 & 1) != 0 )
{
sub_10001AD30(v119, *((const void **)v56 + 51), *((_QWORD *)v56 + 50));
}
else
{
v120 = *((void **)v59 + 2);
*(_OWORD *)v119 = *(_OWORD *)v59;
}
if ( (v119[0] & 1) != 0 )
v62 = (const std::string::value_type *)v120;
else
v62 = &v119[1];
std::string::append(&v122, v62);
if ( (v119[0] & 1) != 0 )
operator delete(v120);
std::string::append(&v122, "&lrs=");
if ( (v56[440] & 1) != 0 )
{
sub_10001AD30(v119, *((const void **)v56 + 57), *((_QWORD *)v56 + 56));
}
else
{
v63 = v56 + 440;
v120 = *((void **)v63 + 2);
*(_OWORD *)v119 = *(_OWORD *)v63;
}
if ( (v119[0] & 1) != 0 )
v64 = (const std::string::value_type *)v120;
else
v64 = &v119[1];
std::string::append(&v122, v64);
if ( (v119[0] & 1) != 0 )
operator delete(v120);
std::string::append(&v122, "&secret=");
v65 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
v66 = (const std::string::value_type *)cocos2d::CCString::getCString(v65);
std::string::append(&v122, v66);
v87.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v87.__r_.__value_.__r.__words[0] = 57;
v87.__r_.__value_.__l.__size_ = 54;
strcpy(v87.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/uploadGJLevel21.php");
if ( (*(_BYTE *)&v122.__r_.__value_.__s.0 & 1) != 0 )
v67 = v122.__r_.__value_.__l.__data_;
else
v67 = v122.__r_.__value_.__s.__data_;
v68 = strlen(v67);
if ( v68 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v69 = v68;
if ( v68 >= 0x17 )
{
v71 = 26;
if ( (v68 | 7) != 0x17 )
v71 = (v68 | 7) + 1;
v70 = (char *)operator new(v71);
v98 = v70;
v97[0] = v71 | 1;
v97[1] = v69;
goto LABEL_147;
}
LOBYTE(v97[0]) = 2 * v68;
v70 = (char *)v97 + 1;
if ( v68 )
LABEL_147:
memmove(v70, v67, v69);
v70[v69] = 0;
v72 = strlen(v55);
if ( v72 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v73 = v72;
if ( v72 >= 0x17 )
{
v76 = 26;
if ( (v72 | 7) != 0x17 )
v76 = (v72 | 7) + 1;
v74 = (char *)operator new(v76);
v100 = v74;
*(_QWORD *)&v99 = v76 | 1;
*((_QWORD *)&v99 + 1) = v73;
v75 = v105;
goto LABEL_155;
}
LOBYTE(v99) = 2 * v72;
v74 = (char *)&v99 + 1;
v75 = v105;
if ( v72 )
LABEL_155:
memmove(v74, v55, v73);
v74[v73] = 0;
GameLevelManager::ProcessHttpRequest(v75, &v87, (__int64)v97, &v99, 1u);
if ( (v99 & 1) != 0 )
{
operator delete(v100);
if ( (v97[0] & 1) == 0 )
{
LABEL_158:
if ( (*(_BYTE *)&v87.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_159;
goto LABEL_173;
}
}
else if ( (v97[0] & 1) == 0 )
{
goto LABEL_158;
}
operator delete(v98);
if ( (*(_BYTE *)&v87.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_159:
if ( (*(_BYTE *)&v117.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_160;
goto LABEL_174;
}
LABEL_173:
operator delete(v87.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v117.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_160:
if ( (*(_BYTE *)&v84.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_161;
goto LABEL_175;
}
LABEL_174:
operator delete(v117.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v84.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_161:
if ( (*(_BYTE *)&v101.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_162;
goto LABEL_176;
}
LABEL_175:
operator delete(v84.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v101.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_162:
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_163;
goto LABEL_177;
}
LABEL_176:
operator delete(v101.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_163:
if ( (v106[0] & 1) == 0 )
goto LABEL_164;
goto LABEL_178;
}
LABEL_177:
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v106[0] & 1) == 0 )
{
LABEL_164:
if ( (*(_BYTE *)&v122.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_165;
goto LABEL_179;
}
LABEL_178:
operator delete(v107);
if ( (*(_BYTE *)&v122.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_165:
if ( (v115 & 1) == 0 )
goto LABEL_166;
goto LABEL_180;
}
LABEL_179:
operator delete(v122.__r_.__value_.__l.__data_);
if ( (v115 & 1) == 0 )
{
LABEL_166:
if ( (v113 & 1) == 0 )
goto LABEL_167;
goto LABEL_181;
}
LABEL_180:
operator delete(v116);
if ( (v113 & 1) == 0 )
{
LABEL_167:
if ( (v82 & 1) == 0 )
goto LABEL_168;
LABEL_182:
operator delete(v83);
if ( (v111 & 1) == 0 )
return __stack_chk_guard;
goto LABEL_169;
}
LABEL_181:
operator delete(v114);
if ( (v82 & 1) != 0 )
goto LABEL_182;
LABEL_168:
if ( (v111 & 1) != 0 )
LABEL_169:
operator delete(v112);
return __stack_chk_guard;
}