//
// GameLevelManager::uploadLevel from 0x8551a4 to 0x8560cc (3880 bytes)
//
// 2 xrefs:
// > UploadPopup::init @ 0x7f4fbc
// > ??> @ 0xda008
//
// 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 12:55:29 +0000
//
__int64 __fastcall GameLevelManager::uploadLevel(GameLevelManager *this, GJGameLevel *a2)
{
GameManager *v4; // x0
cocos2d::CCString *v5; // x0
const char *CString; // x0
char *v7; // x27
size_t v8; // x0
__int64 v9; // x19
__int64 v10; // x19
cocos2d::CCNode *v11; // x0
__int64 v13; // x20
cocos2d::CCObject *v14; // x19
size_t v15; // x0
GameManager *v16; // x0
__int64 v17; // x2
char v18; // w0
GameManager *v19; // x0
size_t v20; // x1
__int64 v21; // x2
char v22; // w0
__int64 v23; // x0
__int64 v24; // x1
char v25; // w0
__int64 v26; // x0
size_t v27; // x1
char v28; // w0
__int64 v29; // x0
size_t v30; // x1
int v31; // w11
int v32; // w13
__int64 v33; // x7
const char *v34; // x1
char *v35; // x3
char *v36; // x4
cocos2d::CCString *v37; // x0
size_t v38; // x0
const char *v39; // x0
cocos2d::CCString *v40; // x0
size_t v41; // x0
const char *v42; // x1
cocos2d::CCString *v43; // x0
size_t v44; // x0
char v45; // w0
__int64 v46; // x0
__int64 v47; // x1
__int64 v48; // x1
__int64 v49; // x0
__int64 v50; // x0
char v51; // w0
__int64 v52; // x0
size_t v53; // x1
unsigned __int8 v54; // w19
int v55; // w0
char *v56; // x1
size_t v57; // x2
cocos2d::CCString *v58; // x0
size_t v59; // x0
char *v60; // x19
unsigned int v61; // w0
unsigned __int8 *v62; // x3
char *v63; // x2
size_t v64; // x0
char *v65; // x1
char *v66; // x2
cocos2d::CCString *v67; // x0
size_t v68; // x0
char v69; // w0
__int64 v70; // x0
__int64 v71; // x1
const char *v72; // x1
size_t v73; // x0
char v74; // w0
char *v75; // x22
__int64 v76; // x0
__int64 v77; // x1
const char *v78; // x1
size_t v79; // x0
cocos2d::CCString *v80; // x0
size_t v81; // x0
const char *v82; // x1
size_t v83; // x0
size_t v84; // x0
unsigned __int8 v85; // w2
__int64 v86; // x20
int v87; // w19
__int64 v88; // x28
char *v89; // x0
GameManager *v90; // x0
const char *v91; // x1
size_t v92; // x0
const char *v93; // x1
size_t v94; // x0
const char *v95; // x1
size_t v96; // x0
char *v97; // [xsp+D0h] [xbp+60h]
char *v98; // [xsp+D0h] [xbp+60h]
char *v99; // [xsp+D0h] [xbp+60h]
__int64 *v100; // [xsp+E0h] [xbp+70h]
char *v101; // [xsp+E0h] [xbp+70h]
char *v102; // [xsp+E0h] [xbp+70h]
char *v103; // [xsp+E0h] [xbp+70h]
char *v104; // [xsp+E0h] [xbp+70h]
char *v105; // [xsp+E0h] [xbp+70h]
char *v106; // [xsp+E0h] [xbp+70h]
char *v107; // [xsp+E0h] [xbp+70h]
char *v108; // [xsp+E8h] [xbp+78h]
char *v109; // [xsp+E8h] [xbp+78h]
char *v110; // [xsp+E8h] [xbp+78h]
GameManager *v111; // [xsp+118h] [xbp+A8h] BYREF
size_t v112; // [xsp+120h] [xbp+B0h]
void *v113; // [xsp+128h] [xbp+B8h]
__int64 v114; // [xsp+130h] [xbp+C0h] BYREF
__int64 v115; // [xsp+138h] [xbp+C8h]
void *v116; // [xsp+140h] [xbp+D0h]
__int64 v117; // [xsp+148h] [xbp+D8h] BYREF
size_t v118; // [xsp+150h] [xbp+E0h]
char *v119; // [xsp+158h] [xbp+E8h]
__int64 v120; // [xsp+160h] [xbp+F0h] BYREF
size_t v121; // [xsp+168h] [xbp+F8h]
char *v122; // [xsp+170h] [xbp+100h]
GameManager *v123; // [xsp+178h] [xbp+108h] BYREF
size_t v124; // [xsp+180h] [xbp+110h]
void *v125; // [xsp+188h] [xbp+118h]
__int64 v126; // [xsp+190h] [xbp+120h] BYREF
size_t v127; // [xsp+198h] [xbp+128h]
void *v128; // [xsp+1A0h] [xbp+130h]
__int64 v129; // [xsp+1A8h] [xbp+138h] BYREF
size_t v130; // [xsp+1B0h] [xbp+140h]
void *v131; // [xsp+1B8h] [xbp+148h]
__int64 v132[2]; // [xsp+1C0h] [xbp+150h] BYREF
char *v133; // [xsp+1D0h] [xbp+160h]
__int64 v134[2]; // [xsp+1D8h] [xbp+168h] BYREF
char *v135; // [xsp+1E8h] [xbp+178h]
__int64 v136; // [xsp+1F0h] [xbp+180h] BYREF
__int64 v137; // [xsp+1F8h] [xbp+188h]
char *v138; // [xsp+200h] [xbp+190h]
__int64 v139; // [xsp+208h] [xbp+198h] BYREF
size_t v140; // [xsp+210h] [xbp+1A0h]
char *v141; // [xsp+218h] [xbp+1A8h]
__int64 v142[2]; // [xsp+220h] [xbp+1B0h] BYREF
char *v143; // [xsp+230h] [xbp+1C0h]
_QWORD v144[2]; // [xsp+238h] [xbp+1C8h] BYREF
char *v145; // [xsp+248h] [xbp+1D8h]
__int64 v146[2]; // [xsp+250h] [xbp+1E0h] BYREF
void *v147; // [xsp+260h] [xbp+1F0h]
__int64 v148[2]; // [xsp+268h] [xbp+1F8h] BYREF
void *v149; // [xsp+278h] [xbp+208h]
__int64 v150[2]; // [xsp+280h] [xbp+210h] BYREF
char *v151; // [xsp+290h] [xbp+220h]
__int64 v152; // [xsp+298h] [xbp+228h] BYREF
__int64 v153; // [xsp+2A0h] [xbp+230h]
void *v154; // [xsp+2A8h] [xbp+238h]
__int64 v155; // [xsp+2B0h] [xbp+240h] BYREF
__int64 v156; // [xsp+2B8h] [xbp+248h]
void *v157; // [xsp+2C0h] [xbp+250h]
__int64 v158[2]; // [xsp+2C8h] [xbp+258h] BYREF
void *v159; // [xsp+2D8h] [xbp+268h]
__int64 v160[2]; // [xsp+2E0h] [xbp+270h] BYREF
void *v161; // [xsp+2F0h] [xbp+280h]
cocos2d::CCNode *v162; // [xsp+2F8h] [xbp+288h] BYREF
__int64 v163; // [xsp+300h] [xbp+290h]
void *v164; // [xsp+308h] [xbp+298h]
unsigned __int8 v165[24]; // [xsp+310h] [xbp+2A0h] BYREF
unsigned __int8 v166[48]; // [xsp+328h] [xbp+2B8h] BYREF
v4 = (GameManager *)GameManager::sharedState(_stack_chk_guard);
GameManager::reportAchievementWithID(v4, "geometry.ach.submit", 100, 0);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)*((unsigned int *)a2 + 286));
CString = (const char *)cocos2d::CCString::getCString(v5);
v162 = nullptr;
v7 = (char *)CString;
v163 = 0;
v164 = nullptr;
v8 = strlen(CString);
v9 = *((_QWORD *)this + 136);
std::string::__init((__int64 *)&v162, v7, v8);
v10 = cocos2d::CCDictionary::objectForKey(v9, &v162);
v11 = (cocos2d::CCNode *)(unsigned __int8)v162;
if ( ((unsigned __int8)v162 & 1) != 0 )
operator delete(v164);
if ( !v10 )
{
v13 = *((_QWORD *)this + 136);
v14 = (cocos2d::CCObject *)cocos2d::CCNode::create(v11);
v162 = nullptr;
v163 = 0;
v164 = nullptr;
v15 = strlen(v7);
std::string::__init((__int64 *)&v162, v7, v15);
cocos2d::CCDictionary::setObject(v13, v14);
v16 = (GameManager *)(unsigned __int8)v162;
if ( ((unsigned __int8)v162 & 1) != 0 )
operator delete(v164);
v17 = GameManager::sharedState(v16) + 632;
v18 = *(_BYTE *)v17;
v111 = nullptr;
v112 = 0;
v113 = nullptr;
if ( (v18 & 1) != 0 )
{
v19 = (GameManager *)std::string::__init((__int64 *)&v111, *(void **)(v17 + 16), *(_QWORD *)(v17 + 8));
}
else
{
v19 = *(GameManager **)v17;
v20 = *(_QWORD *)(v17 + 8);
v113 = *(void **)(v17 + 16);
v111 = v19;
v112 = v20;
}
v21 = GameManager::sharedState(v19) + 608;
v22 = *(_BYTE *)v21;
v114 = 0;
v115 = 0;
v116 = nullptr;
if ( (v22 & 1) != 0 )
{
std::string::__init(&v114, *(void **)(v21 + 16), *(_QWORD *)(v21 + 8));
}
else
{
v23 = *(_QWORD *)v21;
v24 = *(_QWORD *)(v21 + 8);
v116 = *(void **)(v21 + 16);
v114 = v23;
v115 = v24;
}
v25 = *((_BYTE *)a2 + 344);
v117 = 0;
v118 = 0;
v119 = nullptr;
if ( (v25 & 1) != 0 )
{
std::string::__init(&v117, *((void **)a2 + 45), *((_QWORD *)a2 + 44));
}
else
{
v26 = *((_QWORD *)a2 + 43);
v27 = *((_QWORD *)a2 + 44);
v119 = *((char **)a2 + 45);
v117 = v26;
v118 = v27;
}
v28 = *((_BYTE *)a2 + 368);
v120 = 0;
v121 = 0;
v122 = nullptr;
if ( (v28 & 1) != 0 )
{
std::string::__init(&v120, *((void **)a2 + 48), *((_QWORD *)a2 + 47));
}
else
{
v29 = *((_QWORD *)a2 + 46);
v30 = *((_QWORD *)a2 + 47);
v122 = *((char **)a2 + 48);
v120 = v29;
v121 = v30;
}
v123 = nullptr;
v124 = 0;
v125 = nullptr;
if ( ((unsigned __int8)v111 & 1) != 0 )
{
std::string::__init((__int64 *)&v123, v113, v112);
}
else
{
v125 = v113;
v123 = v111;
v124 = v112;
}
GameLevelManager::removeDelimiterChars((__int64)this, (__int64)&v123, 0);
if ( ((unsigned __int8)v123 & 1) != 0 )
operator delete(v125);
v126 = 0;
v127 = 0;
v128 = nullptr;
if ( (v117 & 1) != 0 )
{
std::string::__init(&v126, v119, v118);
}
else
{
v128 = v119;
v126 = v117;
v127 = v118;
}
GameLevelManager::removeDelimiterChars((__int64)this, (__int64)&v126, 0);
if ( (v126 & 1) != 0 )
operator delete(v128);
v129 = 0;
v130 = 0;
v131 = nullptr;
if ( (v120 & 1) != 0 )
{
std::string::__init(&v129, v122, v121);
}
else
{
v131 = v122;
v129 = v120;
v130 = v121;
}
GameLevelManager::removeDelimiterChars((__int64)this, (__int64)&v129, 0);
if ( (v129 & 1) != 0 )
operator delete(v131);
GameLevelManager::getBasePostString(v132);
if ( *((_BYTE *)a2 + 616) )
{
if ( *((_BYTE *)a2 + 617) )
v31 = 1;
else
v31 = 2;
}
else
{
v90 = (GameManager *)GameManager::sharedState((GameManager *)*((unsigned __int8 *)a2 + 616));
if ( !(unsigned __int8)GameManager::safeModeEnabled(v90) )
{
v32 = *((unsigned __int8 *)a2 + 618);
if ( *((_BYTE *)a2 + 619) )
v32 |= 2u;
v31 = 0;
LABEL_32:
v33 = 0;
if ( *((int *)a2 + 152) <= 0 )
v33 = *((unsigned int *)a2 + 151);
v34 = (char *)&v111 + 1;
if ( ((unsigned __int8)v111 & 1) != 0 )
v34 = (const char *)v113;
v35 = (char *)&v117 + 1;
if ( (v117 & 1) != 0 )
v35 = v119;
v36 = (char *)&v120 + 1;
if ( (v120 & 1) != 0 )
v36 = v122;
v37 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&userName=%s&levelID=%i&levelName=%s&levelDesc=%s&levelVersion"
"=%i&levelLength=%i&audioTrack=%i&auto=%i&password=%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",
v34,
(unsigned int)(*((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83)),
v35,
v36,
*((unsigned int *)a2 + 197),
*((unsigned int *)a2 + 225),
v33,
*((unsigned __int8 *)a2 + 960),
*((_DWORD *)a2 + 245) - *((_DWORD *)a2 + 246),
*((_DWORD *)a2 + 247) - *((_DWORD *)a2 + 248),
*((unsigned __int8 *)a2 + 1000),
*((_DWORD *)a2 + 152),
*((_DWORD *)a2 + 155) - *((_DWORD *)a2 + 156),
*((_DWORD *)a2 + 241),
*((_DWORD *)a2 + 261),
v31,
*((_DWORD *)a2 + 163),
*((_DWORD *)a2 + 164),
*((unsigned __int8 *)a2 + 768),
*((_DWORD *)a2 + 308),
v32);
v108 = (char *)cocos2d::CCString::getCString(v37);
v38 = strlen(v108);
std::string::append((__int64)v132, v108, v38);
v39 = (const char *)time(nullptr);
v40 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&ct=%lld", v39);
v109 = (char *)cocos2d::CCString::getCString(v40);
v41 = strlen(v109);
std::string::append((__int64)v132, v109, v41);
EditorBuildStats::toString((GJGameLevel *)((char *)a2 + 664), v134);
v42 = (char *)v134 + 1;
if ( (v134[0] & 1) != 0 )
v42 = v135;
v43 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&bs=%s", v42);
v110 = (char *)cocos2d::CCString::getCString(v43);
v44 = strlen(v110);
std::string::append((__int64)v132, v110, v44);
if ( (v134[0] & 1) != 0 )
operator delete(v135);
v45 = *((_BYTE *)a2 + 1176);
v136 = 0;
v137 = 0;
v138 = nullptr;
if ( (v45 & 1) != 0 )
{
std::string::__init(&v136, *((void **)a2 + 149), *((_QWORD *)a2 + 148));
}
else
{
v46 = *((_QWORD *)a2 + 147);
v47 = *((_QWORD *)a2 + 148);
v138 = *((char **)a2 + 149);
v136 = v46;
v137 = v47;
}
v48 = (unsigned __int8)v136 >> 1;
if ( (v136 & 1) != 0 )
v48 = v137;
if ( v48 )
{
std::string::append((__int64)v132, "&extraString=", 0xDu);
v95 = (char *)&v136 + 1;
if ( (v136 & 1) != 0 )
v95 = v138;
v107 = (char *)v95;
v96 = strlen(v95);
std::string::append((__int64)v132, v107, v96);
}
if ( (*((_BYTE *)a2 + 1240) & 1) != 0 )
v49 = *((_QWORD *)a2 + 156);
else
v49 = *((_BYTE *)a2 + 1240) >> 1;
if ( v49 )
{
std::string::append((__int64)v132, "&songIDs=", 9u);
v93 = (char *)a2 + 1241;
if ( (*((_BYTE *)a2 + 1240) & 1) != 0 )
v93 = *((const char **)a2 + 157);
v106 = (char *)v93;
v94 = strlen(v93);
std::string::append((__int64)v132, v106, v94);
}
if ( (*((_BYTE *)a2 + 1264) & 1) != 0 )
v50 = *((_QWORD *)a2 + 159);
else
v50 = *((_BYTE *)a2 + 1264) >> 1;
if ( v50 )
{
std::string::append((__int64)v132, "&sfxIDs=", 8u);
v91 = (char *)a2 + 1265;
if ( (*((_BYTE *)a2 + 1264) & 1) != 0 )
v91 = *((const char **)a2 + 160);
v105 = (char *)v91;
v92 = strlen(v91);
std::string::append((__int64)v132, v105, v92);
}
v51 = *((_BYTE *)a2 + 392);
v139 = 0;
v100 = (__int64 *)((char *)a2 + 392);
v140 = 0;
v141 = nullptr;
if ( (v51 & 1) != 0 )
{
std::string::__init(&v139, *((void **)a2 + 51), *((_QWORD *)a2 + 50));
}
else
{
v52 = *v100;
v53 = *((_QWORD *)a2 + 50);
v141 = *((char **)a2 + 51);
v139 = v52;
v140 = v53;
}
v142[0] = 0;
v142[1] = 0;
v143 = nullptr;
std::string::__init(v142, &byte_11B8890, 0);
v54 = v139;
if ( (v139 & 1) != 0 )
{
v97 = v141;
v55 = strlen(v141);
v56 = v97;
if ( v55 <= 49 )
{
v57 = v140;
LABEL_60:
std::string::assign(v142, v56, v57);
LABEL_61:
v58 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"I25",
"fpAa",
112,
67,
"Qg");
v98 = (char *)cocos2d::CCString::getCString(v58);
v59 = strlen(v98);
std::string::append((__int64)v142, v98, v59);
v60 = (char *)v142 + 1;
if ( (v142[0] & 1) != 0 )
v60 = v143;
v61 = strlen(v60);
rtsha1::calc((rtsha1 *)v60, (const void *)v61, (__int64)v165, v62);
rtsha1::toHexString((rtsha1 *)v165, v166, v63);
v146[0] = 0;
v146[1] = 0;
v147 = nullptr;
v64 = strlen((const char *)v166);
std::string::__init(v146, v166, v64);
v148[0] = 0;
v148[1] = 0;
v149 = nullptr;
std::string::__init(v148, "41274", 5u);
cocos2d::ZipUtils::base64EncodeEnc(v144, v146, v148);
if ( (v148[0] & 1) != 0 )
operator delete(v149);
if ( (v146[0] & 1) != 0 )
operator delete(v147);
gen_random(10, v150);
v65 = (char *)v150 + 1;
if ( (v150[0] & 1) != 0 )
v65 = v151;
v66 = (char *)v144 + 1;
if ( (v144[0] & 1) != 0 )
v66 = v145;
v67 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&seed=%s&seed2=%s",
v65,
v66);
v99 = (char *)cocos2d::CCString::getCString(v67);
v68 = strlen(v99);
std::string::append((__int64)v132, v99, v68);
std::string::append((__int64)v132, "&levelString=", 0xDu);
v69 = *((_BYTE *)a2 + 392);
v152 = 0;
v153 = 0;
v154 = nullptr;
if ( (v69 & 1) != 0 )
{
std::string::__init(&v152, *((void **)a2 + 51), *((_QWORD *)a2 + 50));
}
else
{
v70 = *v100;
v71 = *((_QWORD *)a2 + 50);
v154 = *((void **)a2 + 51);
v152 = v70;
v153 = v71;
}
v72 = (char *)&v152 + 1;
if ( (v152 & 1) != 0 )
v72 = (const char *)v154;
v101 = (char *)v72;
v73 = strlen(v72);
std::string::append((__int64)v132, v101, v73);
if ( (v152 & 1) != 0 )
operator delete(v154);
std::string::append((__int64)v132, "&lrs=", 5u);
v74 = *((_BYTE *)a2 + 440);
v155 = 0;
v75 = (char *)a2 + 440;
v156 = 0;
v157 = nullptr;
if ( (v74 & 1) != 0 )
{
std::string::__init(&v155, *((void **)v75 + 2), *((_QWORD *)v75 + 1));
}
else
{
v76 = *(_QWORD *)v75;
v77 = *((_QWORD *)v75 + 1);
v157 = *((void **)v75 + 2);
v155 = v76;
v156 = v77;
}
v78 = (char *)&v155 + 1;
if ( (v155 & 1) != 0 )
v78 = (const char *)v157;
v102 = (char *)v78;
v79 = strlen(v78);
std::string::append((__int64)v132, v102, v79);
if ( (v155 & 1) != 0 )
operator delete(v157);
std::string::append((__int64)v132, "&secret=", 8u);
v80 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v103 = (char *)cocos2d::CCString::getCString(v80);
v81 = strlen(v103);
std::string::append((__int64)v132, v103, v81);
v158[0] = 0;
v158[1] = 0;
v159 = nullptr;
std::string::__init(v158, "https://www.boomlings.com/database/uploadGJLevel21.php", 0x36u);
v82 = (char *)v132 + 1;
if ( (v132[0] & 1) != 0 )
v82 = v133;
v104 = (char *)v82;
v160[0] = 0;
v160[1] = 0;
v161 = nullptr;
v83 = strlen(v82);
std::string::__init(v160, v104, v83);
v162 = nullptr;
v163 = 0;
v164 = nullptr;
v84 = strlen(v7);
std::string::__init((__int64 *)&v162, v7, v84);
GameLevelManager::ProcessHttpRequest(this, v158, (__int64)v160, (char *)&v162, 1);
if ( ((unsigned __int8)v162 & 1) != 0 )
operator delete(v164);
if ( (v160[0] & 1) != 0 )
operator delete(v161);
if ( (v158[0] & 1) != 0 )
operator delete(v159);
if ( (v150[0] & 1) != 0 )
operator delete(v151);
if ( (v144[0] & 1) != 0 )
operator delete(v145);
if ( (v142[0] & 1) != 0 )
operator delete(v143);
if ( (v139 & 1) != 0 )
operator delete(v141);
if ( (v136 & 1) != 0 )
operator delete(v138);
if ( (v132[0] & 1) != 0 )
operator delete(v133);
if ( (v120 & 1) != 0 )
operator delete(v122);
if ( (v117 & 1) != 0 )
operator delete(v119);
if ( (v114 & 1) != 0 )
operator delete(v116);
if ( ((unsigned __int8)v111 & 1) != 0 )
operator delete(v113);
return _stack_chk_guard;
}
}
else
{
v55 = strlen((const char *)&v139 + 1);
if ( v55 <= 49 )
{
v57 = v54 >> 1;
v56 = (char *)&v139 + 1;
goto LABEL_60;
}
}
v85 = v54;
v86 = 0;
v87 = 50;
v88 = (int)(float)((float)v55 / 50.0);
while ( 1 )
{
v89 = (char *)&v139 + 1;
if ( (v85 & 1) != 0 )
v89 = v141;
std::string::push_back(v142, v89[v86]);
--v87;
v86 += v88;
if ( !v87 )
break;
v85 = v139;
}
goto LABEL_61;
}
v31 = 0;
}
v32 = 0;
goto LABEL_32;
}
return _stack_chk_guard;
}