//
// GameLevelManager::uploadLevel from 0x4d7548 to 0x4d7bd0 (1672 bytes)
//
// 1 xrefs:
// > UploadPopup::init @ 0x4a3b32
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:53 +0000
//
cocos2d::CCNode *__fastcall GameLevelManager::uploadLevel(GameLevelManager *this, const char **a2)
{
GameManager *v4; // r0
cocos2d::CCString *v5; // r0
const char *CString; // r0
int v7; // r5
const char *v8; // r9
size_t v9; // r0
int v10; // r5
cocos2d::CCNode *result; // r0
int v12; // r10
cocos2d::CCObject *v13; // r0
cocos2d::CCObject *v14; // r6
size_t v15; // r0
GameManager *v16; // r0
int v17; // r0
int *v18; // r0
int v19; // r0
GameManager *BasePostString; // r0
int v21; // r0
GameManager *v22; // r0
int v23; // r5
int v24; // lr
const char *v25; // r12
const char *v26; // r1
char *v27; // r3
char *v28; // r6
cocos2d::CCString *v29; // r0
char *v30; // r0
time_t v31; // r0
const char *v32; // r1
cocos2d::CCString *v33; // r0
char *v34; // r0
char *v35; // r1
cocos2d::CCString *v36; // r0
char *v37; // r0
int v38; // r3
int v39; // r3
int v40; // r3
char *v41; // r1
int v42; // r3
int v43; // r3
char *v44; // r1
char *v45; // r1
char *v46; // r0
signed int v47; // r0
cocos2d::CCString *v48; // r0
char *v49; // r0
int v50; // r5
int v51; // r7
int v52; // r10
char *v53; // r3
char *v54; // r7
const void *v55; // r0
unsigned __int8 *v56; // r3
char *v57; // r2
size_t v58; // r0
int v59; // r2
int v60; // r3
const char *v61; // r1
char *v62; // r2
cocos2d::CCString *v63; // r0
char *v64; // r0
char *v65; // r1
char *v66; // r1
cocos2d::CCString *v67; // r0
char *v68; // r0
const char *v69; // r1
size_t v70; // r0
size_t v71; // r0
const char *v72; // [sp+5Ch] [bp-F4h]
int v73[3]; // [sp+60h] [bp-F0h] BYREF
int v74[3]; // [sp+6Ch] [bp-E4h] BYREF
int v75[3]; // [sp+78h] [bp-D8h] BYREF
int v76[3]; // [sp+84h] [bp-CCh] BYREF
int v77[3]; // [sp+90h] [bp-C0h] BYREF
int v78[3]; // [sp+9Ch] [bp-B4h] BYREF
int v79[3]; // [sp+A8h] [bp-A8h] BYREF
char *v80[3]; // [sp+B4h] [bp-9Ch] BYREF
char v81; // [sp+C0h] [bp-90h] BYREF
char v82; // [sp+C1h] [bp-8Fh] BYREF
char *v83; // [sp+C8h] [bp-88h]
int v84[3]; // [sp+CCh] [bp-84h] BYREF
int v85[2]; // [sp+D8h] [bp-78h] BYREF
char *v86; // [sp+E0h] [bp-70h]
int v87[2]; // [sp+E4h] [bp-6Ch] BYREF
char *v88; // [sp+ECh] [bp-64h]
unsigned __int8 v89; // [sp+F0h] [bp-60h] BYREF
char v90; // [sp+F1h] [bp-5Fh] BYREF
char *v91; // [sp+F8h] [bp-58h]
int v92[3]; // [sp+FCh] [bp-54h] BYREF
int v93[3]; // [sp+108h] [bp-48h] BYREF
int v94[3]; // [sp+114h] [bp-3Ch] BYREF
int v95[3]; // [sp+120h] [bp-30h] BYREF
int v96[3]; // [sp+12Ch] [bp-24h] BYREF
int v97[3]; // [sp+138h] [bp-18h] BYREF
int v98[3]; // [sp+144h] [bp-Ch] BYREF
int v99; // [sp+150h] [bp+0h] BYREF
int v100; // [sp+154h] [bp+4h]
char *v101; // [sp+158h] [bp+8h]
unsigned __int8 v102[20]; // [sp+15Ch] [bp+Ch] BYREF
unsigned __int8 v103[44]; // [sp+170h] [bp+20h] BYREF
v4 = (GameManager *)GameManager::sharedState(this);
GameManager::reportAchievementWithID(v4, "geometry.ach.submit", (const char *)&dword_64, 0);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a2[239]);
CString = (const char *)cocos2d::CCString::getCString(v5);
v99 = 0;
v100 = 0;
v101 = nullptr;
v7 = *((_DWORD *)this + 187);
v8 = CString;
v9 = strlen(CString);
std::string::__init(&v99, v8, v9);
v10 = cocos2d::CCDictionary::objectForKey(v7, &v99);
result = (cocos2d::CCNode *)std::string::~string((int)&v99);
if ( v10 )
return result;
v12 = *((_DWORD *)this + 187);
v13 = (cocos2d::CCObject *)cocos2d::CCNode::create(result);
v99 = 0;
v100 = 0;
v101 = nullptr;
v14 = v13;
v15 = strlen(v8);
std::string::__init(&v99, v8, v15);
cocos2d::CCDictionary::setObject(v12, v14);
v16 = (GameManager *)std::string::~string((int)&v99);
v17 = GameManager::sharedState(v16);
v18 = std::string::basic_string(v73, v17 + 448);
v19 = GameManager::sharedState((GameManager *)v18);
std::string::basic_string(v74, v19 + 436);
std::string::basic_string(v75, (int)(a2 + 70));
std::string::basic_string(v76, (int)(a2 + 73));
std::string::basic_string(v77, (int)v73);
GameLevelManager::removeDelimiterChars((int)this, (unsigned __int8 *)v77, 0);
std::string::~string((int)v77);
std::string::basic_string(v78, (int)v75);
GameLevelManager::removeDelimiterChars((int)this, (unsigned __int8 *)v78, 0);
std::string::~string((int)v78);
std::string::basic_string(v79, (int)v76);
GameLevelManager::removeDelimiterChars((int)this, (unsigned __int8 *)v79, 0);
std::string::~string((int)v79);
BasePostString = GameLevelManager::getBasePostString((GameLevelManager *)v80);
if ( *((_BYTE *)a2 + 444) )
{
if ( *((_BYTE *)a2 + 445) )
v21 = 1;
else
v21 = 2;
goto LABEL_8;
}
v22 = (GameManager *)GameManager::sharedState(BasePostString);
v21 = GameManager::safeModeEnabled(v22);
if ( v21 )
{
v21 = 0;
LABEL_8:
v23 = 0;
goto LABEL_9;
}
v23 = *((unsigned __int8 *)a2 + 446);
if ( *((_BYTE *)a2 + 447) )
v23 |= 2u;
else
v21 = *((unsigned __int8 *)a2 + 447);
LABEL_9:
v24 = (int)a2[109];
if ( v24 > 0 )
v25 = nullptr;
else
v25 = a2[108];
if ( (v73[0] & 1) != 0 )
v26 = (const char *)v73[2];
else
v26 = (char *)v73 + 1;
if ( (v75[0] & 1) != 0 )
v27 = (char *)v75[2];
else
v27 = (char *)v75 + 1;
if ( (v76[0] & 1) != 0 )
v28 = (char *)v76[2];
else
v28 = (char *)v76 + 1;
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&userName=%s&levelID=%i&levelName=%s&levelDesc=%s&levelVersion=%i&le"
"velLength=%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",
v26,
a2[67] - a2[68],
v27,
v28,
a2[153],
a2[181],
v25,
*((unsigned __int8 *)a2 + 784),
a2[201] - a2[202],
a2[203] - a2[204],
*((unsigned __int8 *)a2 + 824),
v24,
a2[112] - a2[113],
a2[197],
a2[217],
v21,
a2[120],
a2[121],
*((unsigned __int8 *)a2 + 592),
a2[250],
v23);
v30 = (char *)cocos2d::CCString::getCString(v29);
std::string::append(v80, v30);
v31 = time(nullptr);
v33 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&ct=%lld", v32, (__int64)v31);
v34 = (char *)cocos2d::CCString::getCString(v33);
std::string::append(v80, v34);
EditorBuildStats::toString((EditorBuildStats *)&v81, (int)(a2 + 122));
if ( (v81 & 1) != 0 )
v35 = v83;
else
v35 = &v82;
v36 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&bs=%s", v35);
v37 = (char *)cocos2d::CCString::getCString(v36);
std::string::append(v80, v37);
std::string::~string((int)&v81);
std::string::basic_string(v84, (int)(a2 + 243));
if ( (v84[0] & 1) != 0 )
v38 = v84[1];
else
v38 = (int)LOBYTE(v84[0]) >> 1;
if ( v38 )
{
std::string::append(v80, "&extraString=");
if ( (v84[0] & 1) != 0 )
v41 = (char *)v84[2];
else
v41 = (char *)v84 + 1;
std::string::append(v80, v41);
}
v39 = *((unsigned __int8 *)a2 + 1008);
if ( (v39 & 1) != 0 )
v40 = (int)a2[253];
else
v40 = v39 >> 1;
if ( v40 )
{
std::string::append(v80, "&songIDs=");
if ( ((_BYTE)a2[252] & 1) != 0 )
v44 = (char *)a2[254];
else
v44 = (char *)a2 + 1009;
std::string::append(v80, v44);
}
v42 = *((unsigned __int8 *)a2 + 1020);
if ( (v42 & 1) != 0 )
v43 = (int)a2[256];
else
v43 = v42 >> 1;
if ( v43 )
{
std::string::append(v80, "&sfxIDs=");
if ( ((_BYTE)a2[255] & 1) != 0 )
v45 = (char *)a2[257];
else
v45 = (char *)a2 + 1021;
std::string::append(v80, v45);
}
std::string::basic_string(v85, (int)(a2 + 76));
v87[0] = 0;
v87[1] = 0;
v88 = nullptr;
std::string::__init(v87, &unk_B6B226, 0);
if ( (v85[0] & 1) != 0 )
v46 = v86;
else
v46 = (char *)v85 + 1;
v47 = strlen(v46);
if ( v47 > 49 )
{
v50 = 50;
v51 = 0;
v52 = (int)(float)((float)v47 / 50.0);
do
{
if ( (v85[0] & 1) != 0 )
v53 = v86;
else
v53 = (char *)v85 + 1;
std::string::push_back(v87, v53[v51]);
--v50;
v51 += v52;
}
while ( v50 );
}
else
{
std::string::operator=((unsigned __int8 *)v87, (unsigned __int8 *)v85);
}
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"I25",
"fpAa",
112,
67,
"Qg");
v49 = (char *)cocos2d::CCString::getCString(v48);
std::string::append(v87, v49);
if ( (v87[0] & 1) != 0 )
v54 = v88;
else
v54 = (char *)v87 + 1;
v55 = (const void *)strlen(v54);
rtsha1::calc((rtsha1 *)v54, v55, (int)v102, v56);
rtsha1::toHexString((rtsha1 *)v102, v103, v57);
memset(v92, 0, sizeof(v92));
v58 = strlen((const char *)v103);
std::string::__init(v92, v103, v58);
memset(v93, 0, sizeof(v93));
std::string::__init(v93, "41274", 5u);
cocos2d::ZipUtils::base64EncodeEnc(&v89, v92, v93);
std::string::~string((int)v93);
std::string::~string((int)v92);
gen_random(v94, 10, v59, v60);
if ( (v94[0] & 1) != 0 )
v61 = (const char *)v94[2];
else
v61 = (char *)v94 + 1;
if ( (v89 & 1) != 0 )
v62 = v91;
else
v62 = &v90;
v63 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&seed=%s&seed2=%s",
v61,
v62,
v89);
v64 = (char *)cocos2d::CCString::getCString(v63);
std::string::append(v80, v64);
std::string::append(v80, "&levelString=");
std::string::basic_string(v95, (int)(a2 + 76));
if ( (v95[0] & 1) != 0 )
v65 = (char *)v95[2];
else
v65 = (char *)v95 + 1;
std::string::append(v80, v65);
std::string::~string((int)v95);
std::string::append(v80, "&lrs=");
std::string::basic_string(v96, (int)(a2 + 82));
if ( (v96[0] & 1) != 0 )
v66 = (char *)v96[2];
else
v66 = (char *)v96 + 1;
std::string::append(v80, v66);
std::string::~string((int)v96);
std::string::append(v80, "&secret=");
v67 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfd",
"2893",
103,
98,
&a1i2r3e45s789g[9]);
v68 = (char *)cocos2d::CCString::getCString(v67);
std::string::append(v80, v68);
memset(v97, 0, sizeof(v97));
std::string::__init(v97, "https://www.boomlings.com/database/uploadGJLevel21.php", 0x36u);
v98[0] = 0;
v98[1] = 0;
if ( ((int)v80[0] & 1) == 0 )
v69 = (char *)v80 + 1;
v98[2] = 0;
if ( ((int)v80[0] & 1) != 0 )
v69 = v80[2];
v72 = v69;
v70 = strlen(v69);
std::string::__init(v98, v72, v70);
v99 = 0;
v100 = 0;
v101 = nullptr;
v71 = strlen(v8);
std::string::__init(&v99, v8, v71);
GameLevelManager::ProcessHttpRequest(this, v97, (int)v98, (int)&v99, 1);
std::string::~string((int)&v99);
std::string::~string((int)v98);
std::string::~string((int)v97);
std::string::~string((int)v94);
std::string::~string((int)&v89);
std::string::~string((int)v87);
std::string::~string((int)v85);
std::string::~string((int)v84);
std::string::~string((int)v80);
std::string::~string((int)v76);
std::string::~string((int)v75);
std::string::~string((int)v74);
return (cocos2d::CCNode *)std::string::~string((int)v73);
}