//
// GameLevelManager::uploadLevelList from 0x72d218 to 0x72def4 (3292 bytes)
//
// 2 xrefs:
// > UploadListPopup::init @ 0xa7ae10
// > ??> @ 0xbf5b0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GameLevelManager::uploadLevelList(GameLevelManager *a1, GJLevelList *a2)
{
std::set *p_m_queuedLists; // x20
char *v5; // x0
int v6; // w20
unsigned __int8 *v7; // x0
unsigned __int8 *v8; // x0
unsigned __int8 *v9; // x0
cocos2d::CCString *v10; // x0
size_t v11; // x0
char *v12; // x20
int v13; // w0
__int64 v14; // x22
int v15; // w21
__int64 v16; // x26
char *v17; // x0
char v18; // w24
__int64 v19; // x1
__int64 v20; // x20
char *v21; // x0
GJAccountManager *v22; // x0
void *v23; // x0
char *v24; // x20
unsigned int v25; // w0
unsigned __int8 *v26; // x3
char *v27; // x2
char *v28; // x0
void *v29; // x0
cocos2d::CCString *v30; // x0
size_t v31; // x0
cocos2d::CCString *v32; // x0
size_t v33; // x0
int *p_m_unknown2; // x0
char *v35; // x0
char *v36; // x0
char *v37; // x0
char *v38; // x0
void *v39; // x0
char *v40; // x0
char *v41; // x0
void *v42; // x0
void *v43; // x0
char *v44; // x20
unsigned int *v45; // x19
int v46; // w0
unsigned int *v47; // x2
int v48; // w1
unsigned int *v49; // x1
int v50; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x1
int v58; // w2
unsigned int *v59; // x1
int v60; // w2
unsigned int *v61; // x1
int v62; // w2
unsigned int *v63; // x1
int v64; // w2
unsigned int *v65; // x1
int v66; // w2
unsigned int *v67; // x1
int v68; // w2
unsigned int *v69; // x1
int v70; // w2
unsigned int *v71; // x1
int v72; // w2
unsigned int *v73; // x1
int v74; // w2
unsigned int *v75; // x1
int v76; // w2
unsigned int *v77; // x1
int v78; // w2
unsigned int *v79; // x1
int v80; // w2
const char *v81; // [xsp+78h] [xbp+68h]
const char *v82; // [xsp+80h] [xbp+70h]
const char *CString; // [xsp+88h] [xbp+78h]
_DWORD *v84; // [xsp+98h] [xbp+88h] BYREF
__int64 v85; // [xsp+A0h] [xbp+90h] BYREF
__int64 v86; // [xsp+A8h] [xbp+98h] BYREF
char *v87; // [xsp+B0h] [xbp+A0h] BYREF
unsigned __int8 *v88; // [xsp+B8h] [xbp+A8h] BYREF
unsigned __int8 *v89; // [xsp+C0h] [xbp+B0h] BYREF
unsigned __int8 *v90; // [xsp+C8h] [xbp+B8h] BYREF
char *v91; // [xsp+D0h] [xbp+C0h] BYREF
__int64 v92; // [xsp+D8h] [xbp+C8h] BYREF
char *v93; // [xsp+E0h] [xbp+D0h] BYREF
__int64 v94; // [xsp+E8h] [xbp+D8h] BYREF
char *v95; // [xsp+F0h] [xbp+E0h]
__int64 v96; // [xsp+F8h] [xbp+E8h] BYREF
std::string v97; // [xsp+100h] [xbp+F0h] BYREF
const char *v98; // [xsp+108h] [xbp+F8h] BYREF
const char *v99; // [xsp+110h] [xbp+100h] BYREF
cocos2d::extension::CCHttpClient *v100; // [xsp+118h] [xbp+108h] BYREF
unsigned __int8 v101[24]; // [xsp+120h] [xbp+110h] BYREF
unsigned __int8 v102[48]; // [xsp+138h] [xbp+128h] BYREF
std::string v103; // 0:x2.8
p_m_queuedLists = &a1->m_queuedLists;
GameToolbox::intToString((__int64 *)&v84, (GameToolbox *)(unsigned int)a2->m_M_ID);
if ( &a1->m_queuedLists._M_t._M_impl._M_header == (std::_Rb_tree_node_base *)std::_Rb_tree,std::less,std::allocator>::find(
(__int64)p_m_queuedLists,
(const void **)&v84) )
{
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
p_m_queuedLists,
(const void **)&v84);
sub_D18D28(&v85);
sub_D18D28(&v86);
sub_D18D28(&v87);
v6 = 0;
if ( a2->m_unlisted )
{
if ( a2->m_friendsOnly )
v6 = 1;
else
v6 = 2;
}
sub_D18D28(&v88);
GameLevelManager::removeDelimiterChars((__int64)a1, &v88, 0);
v7 = v88 - 24;
if ( v88 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v71 = (unsigned int *)(v88 - 8);
do
v72 = __ldaxr(v71);
while ( __stlxr(v72 - 1, v71) );
}
else
{
v72 = *((_DWORD *)v88 - 2);
*((_DWORD *)v88 - 2) = v72 - 1;
}
if ( v72 <= 0 )
operator delete(v7);
}
sub_D18D28(&v89);
GameLevelManager::removeDelimiterChars((__int64)a1, &v89, 0);
v8 = v89 - 24;
if ( v89 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v63 = (unsigned int *)(v89 - 8);
do
v64 = __ldaxr(v63);
while ( __stlxr(v64 - 1, v63) );
}
else
{
v64 = *((_DWORD *)v89 - 2);
*((_DWORD *)v89 - 2) = v64 - 1;
}
if ( v64 <= 0 )
operator delete(v8);
}
sub_D18D28(&v90);
GameLevelManager::removeDelimiterChars((__int64)a1, &v90, 0);
v9 = v90 - 24;
if ( v90 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v75 = (unsigned int *)(v90 - 8);
do
v76 = __ldaxr(v75);
while ( __stlxr(v76 - 1, v75) );
}
else
{
v76 = *((_DWORD *)v90 - 2);
*((_DWORD *)v90 - 2) = v76 - 1;
}
if ( v76 <= 0 )
operator delete(v9);
}
GameLevelManager::getBasePostString(a1, (__int64)&v91);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&listID=%i&listName=%s&listDesc=%s&listLevels=%s&difficulty=%i&lis"
"tVersion=%i&original=%i&unlisted=%i",
(const char *)(unsigned int)a2->m_listID,
v85,
v86,
v87,
(unsigned int)a2->m_difficulty,
(unsigned int)a2->m_listVersion,
(unsigned int)a2->m_original,
v6);
CString = cocos2d::CCString::getCString(v10);
v11 = strlen(CString);
sub_D15FD4(&v91, CString, v11);
gen_random(5, (__int64)&v92);
sub_D153B8((int)&v93, &byte_F288A0);
v12 = v87;
v13 = strlen(v87);
if ( v13 > 49 )
{
v14 = 0;
v15 = 50;
v16 = (int)(float)((float)v13 / 50.0);
while ( 1 )
{
if ( (*((_DWORD *)v12 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v87);
v12 = v87;
}
v17 = v93;
v18 = v12[v14];
v19 = *((_QWORD *)v93 - 3);
v20 = v19 + 1;
if ( (unsigned __int64)(v19 + 1) > *((_QWORD *)v93 - 2) || *((int *)v93 - 2) > 0 )
{
sub_D15888(&v93, v19 + 1);
v17 = v93;
v19 = *((_QWORD *)v93 - 3);
}
v17[v19] = v18;
v21 = v93;
if ( v93 - 24 == (char *)&qword_124B6B0 )
{
--v15;
v14 += v16;
if ( !v15 )
goto LABEL_19;
}
else
{
*((_DWORD *)v93 - 2) = 0;
--v15;
*((_QWORD *)v21 - 3) = v20;
v14 += v16;
v21[v20] = 0;
if ( !v15 )
goto LABEL_19;
}
v12 = v87;
}
}
sub_D18EA8(&v93, &v87);
LABEL_19:
v22 = GJAccountManager::sharedState();
GameToolbox::intToString(&v94, (GameToolbox *)(unsigned int)(v22->m_accountID - v22->m_unkInt1));
sub_D15E14(&v93, &v94);
v23 = (void *)(v94 - 24);
if ( (__int64 *)(v94 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)(v94 - 8);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *(_DWORD *)(v94 - 8);
*(_DWORD *)(v94 - 8) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v23);
}
v24 = v93;
v25 = strlen(v93);
rtsha1::calc((rtsha1 *)v24, (const void *)v25, (__int64)v101, v26);
rtsha1::toHexString((rtsha1 *)v101, v102, v27);
sub_D153B8((int)&v96, (char *)v102);
sub_D18D28(&v97);
cocos2d::ZipUtils::base64EncodeEnc((cocos2d::ZipUtils *)&v96, &v97, v103);
v28 = (char *)v97.m_data.m_data - 24;
if ( (__int64 *)v97.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v67 = (unsigned int *)((char *)v97.m_data.m_data - 8);
do
v68 = __ldaxr(v67);
while ( __stlxr(v68 - 1, v67) );
}
else
{
v68 = *((_DWORD *)v97.m_data.m_data - 2);
*((_DWORD *)v97.m_data.m_data - 2) = v68 - 1;
}
if ( v68 <= 0 )
operator delete(v28);
}
v29 = (void *)(v96 - 24);
if ( (__int64 *)(v96 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v96 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(v96 - 8);
*(_DWORD *)(v96 - 8) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v29);
}
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&seed=%s&seed2=%s", v95, v92);
v81 = cocos2d::CCString::getCString(v30);
v31 = strlen(v81);
sub_D15FD4(&v91, v81, v31);
sub_D15FD4(&v91, "&secret=", 8);
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v82 = cocos2d::CCString::getCString(v32);
v33 = strlen(v82);
sub_D15FD4(&v91, v82, v33);
sub_D153B8((int)&v98, "https://www.boomlings.com/database/uploadGJLevelList.php");
sub_D153B8((int)&v99, v91);
sub_D18D28(&v100);
GameLevelManager::ProcessHttpRequest(a1, &v98, &v99, &v100, 61);
p_m_unknown2 = &v100[-1].m_unknown2;
if ( &v100[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v100[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v100[-1]._timeoutForConnect;
v100[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v35 = (char *)(v99 - 24);
if ( v99 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(v99 - 8);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *((_DWORD *)v99 - 2);
*((_DWORD *)v99 - 2) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v35);
}
v36 = (char *)(v98 - 24);
if ( v98 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(v98 - 8);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *((_DWORD *)v98 - 2);
*((_DWORD *)v98 - 2) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v36);
}
v37 = v95 - 24;
if ( v95 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v61 = (unsigned int *)(v95 - 8);
do
v62 = __ldaxr(v61);
while ( __stlxr(v62 - 1, v61) );
}
else
{
v62 = *((_DWORD *)v95 - 2);
*((_DWORD *)v95 - 2) = v62 - 1;
}
if ( v62 <= 0 )
operator delete(v37);
}
v38 = v93 - 24;
if ( v93 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v77 = (unsigned int *)(v93 - 8);
do
v78 = __ldaxr(v77);
while ( __stlxr(v78 - 1, v77) );
}
else
{
v78 = *((_DWORD *)v93 - 2);
*((_DWORD *)v93 - 2) = v78 - 1;
}
if ( v78 <= 0 )
operator delete(v38);
}
v39 = (void *)(v92 - 24);
if ( (__int64 *)(v92 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(v92 - 8);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(v92 - 8);
*(_DWORD *)(v92 - 8) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v39);
}
v40 = v91 - 24;
if ( v91 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v73 = (unsigned int *)(v91 - 8);
do
v74 = __ldaxr(v73);
while ( __stlxr(v74 - 1, v73) );
}
else
{
v74 = *((_DWORD *)v91 - 2);
*((_DWORD *)v91 - 2) = v74 - 1;
}
if ( v74 <= 0 )
operator delete(v40);
}
v41 = v87 - 24;
if ( v87 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v65 = (unsigned int *)(v87 - 8);
do
v66 = __ldaxr(v65);
while ( __stlxr(v66 - 1, v65) );
}
else
{
v66 = *((_DWORD *)v87 - 2);
*((_DWORD *)v87 - 2) = v66 - 1;
}
if ( v66 <= 0 )
operator delete(v41);
}
v42 = (void *)(v86 - 24);
if ( (__int64 *)(v86 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v79 = (unsigned int *)(v86 - 8);
do
v80 = __ldaxr(v79);
while ( __stlxr(v80 - 1, v79) );
}
else
{
v80 = *(_DWORD *)(v86 - 8);
*(_DWORD *)(v86 - 8) = v80 - 1;
}
if ( v80 <= 0 )
operator delete(v42);
}
v43 = (void *)(v85 - 24);
if ( (__int64 *)(v85 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(v85 - 8);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(v85 - 8);
*(_DWORD *)(v85 - 8) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v43);
}
v44 = (char *)(v84 - 6);
if ( v84 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = v84 - 2;
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(v84 - 2);
*(v84 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v44);
}
}
else
{
v5 = (char *)(v84 - 6);
if ( v84 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = v84 - 2;
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(v84 - 2);
*(v84 - 2) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v5);
}
}
}