//
// GameLevelManager::uploadLevelList from 0x14014fdf0 to 0x14015041e (1582 bytes)
//
// 2 xrefs:
// > UploadListPopup::init @ 0x14030b628
// > ??> @ 0x1406ca824
//
// 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
//
// Hidden C++ exception states: #wind=13
void GameLevelManager::uploadLevelList(GameLevelManager *a1, GJLevelList *a2)
{
std::_Tree_val>::_Nodeptr Myhead; // rdi
std::_Tree_node::_Nodeptr Parent; // rbx
int v6; // ebx
__int64 v7; // rax
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rcx
__int64 v13; // rcx
void **v14; // rcx
const char *v15; // r9
const char *v16; // r8
cocos2d::CCString *v17; // rax
char *CString; // rax
size_t v19; // rbx
size_t v20; // r8
void **v21; // rdx
void **v22; // rcx
unsigned __int64 v23; // r8
__int64 v24; // rax
void **v25; // rdx
GJAccountManager *v26; // rax
void **v27; // rax
void *v28; // rdx
__int128 *p_Src; // r8
__int128 *v30; // r9
__int64 v31; // rdx
size_t v32; // r8
__int64 v33; // rax
void *v34; // rcx
__int64 v35; // r14
__int64 v36; // rdi
__int64 v37; // rsi
void **v38; // rdx
const char *v39; // r8
const char *v40; // rdx
cocos2d::CCString *v41; // rax
char *v42; // rax
size_t v43; // r8
cocos2d::CCString *v44; // rax
char *v45; // rax
size_t v46; // r8
const char *v47; // rdi
_QWORD *v48; // rdx
__int64 v49; // [rsp+20h] [rbp-E0h]
__int64 v50; // [rsp+28h] [rbp-D8h]
__int128 v51; // [rsp+58h] [rbp-A8h] BYREF
__int64 v52; // [rsp+68h] [rbp-98h]
__int64 v53; // [rsp+70h] [rbp-90h]
__int128 *v54; // [rsp+78h] [rbp-88h]
_BYTE v55[16]; // [rsp+80h] [rbp-80h] BYREF
_BYTE v56[32]; // [rsp+90h] [rbp-70h] BYREF
void *v57[3]; // [rsp+B0h] [rbp-50h] BYREF
unsigned __int64 v58; // [rsp+C8h] [rbp-38h]
__int128 v59; // [rsp+D0h] [rbp-30h] BYREF
__int64 v60; // [rsp+E0h] [rbp-20h]
__int64 v61; // [rsp+E8h] [rbp-18h]
__int128 Src; // [rsp+F0h] [rbp-10h] BYREF
__int64 v63; // [rsp+100h] [rbp+0h]
unsigned __int64 v64; // [rsp+108h] [rbp+8h]
void *Block[2]; // [rsp+110h] [rbp+10h] BYREF
__m128i si128; // [rsp+120h] [rbp+20h]
_QWORD v67[4]; // [rsp+130h] [rbp+30h] BYREF
_QWORD v68[4]; // [rsp+150h] [rbp+50h] BYREF
_QWORD v69[4]; // [rsp+170h] [rbp+70h] BYREF
_QWORD v70[4]; // [rsp+190h] [rbp+90h] BYREF
_QWORD Buf2[4]; // [rsp+1B0h] [rbp+B0h] BYREF
_QWORD v72[4]; // [rsp+1D0h] [rbp+D0h] BYREF
_BYTE v73[48]; // [rsp+1F0h] [rbp+F0h] BYREF
GameToolbox::intToString(Buf2, a2->m_M_ID);
Myhead = a1->m_queuedLists._Mypair._Myval2._Myval2._Myhead;
Parent = Myhead->_Parent;
while ( !Parent->_Isnil )
{
if ( sub_14003A760(&Parent->_Myval.m_data.m_bigStorage, Buf2) >= 0 )
{
Myhead = Parent;
Parent = Parent->_Left;
}
else
{
Parent = Parent->_Right;
}
}
if ( Myhead->_Isnil || sub_14003A760(Buf2, &Myhead->_Myval.m_data.m_bigStorage) < 0 )
{
sub_140178E90(&a1->m_queuedLists, v55, Buf2);
sub_14003BDB0((__int64)v70, (__int64)&a2->m_listName);
sub_14003BDB0((__int64)v69, (__int64)&a2->m_listDesc);
sub_14003BDB0((__int64)v57, (__int64)&a2->m_levelsString);
v6 = 0;
if ( a2->m_unlisted )
v6 = 2 - a2->m_friendsOnly;
v7 = sub_14003BDB0((__int64)&v59, (__int64)v70);
GameLevelManager::removeDelimiterChars(v8, v7, 0);
v9 = sub_14003BDB0((__int64)&v59, (__int64)v69);
GameLevelManager::removeDelimiterChars(v10, v9, 0);
v11 = sub_14003BDB0((__int64)&v59, (__int64)v57);
GameLevelManager::removeDelimiterChars(v12, v11, 0);
GameLevelManager::getBasePostString(v13, v67);
v14 = v57;
if ( v58 > 0xF )
v14 = (void **)v57[0];
v15 = (const char *)v69;
if ( v69[3] > 0xFu )
v15 = (const char *)v69[0];
v16 = (const char *)v70;
if ( v70[3] > 0xFu )
v16 = (const char *)v70[0];
v17 = cocos2d::CCString::createWithFormat(
"&listID=%i&listName=%s&listDesc=%s&listLevels=%s&difficulty=%i&listVersion=%i&original=%i&unlisted=%i",
a2->m_listID,
v16,
v15,
(const char *)v14,
a2->m_difficulty,
a2->m_listVersion,
a2->m_original,
v6);
CString = (char *)cocos2d::CCString::getCString(v17);
v19 = -1;
v20 = -1;
do
++v20;
while ( CString[v20] );
sub_140041270(v67, CString, v20);
sub_140142B90(v68, 5u);
Src = 0;
v63 = 0;
v64 = 15;
LOBYTE(Src) = 0;
v21 = v57;
v22 = (void **)v57[0];
v23 = v58;
if ( v58 > 0xF )
v21 = (void **)v57[0];
v24 = -1;
do
++v24;
while ( *((_BYTE *)v21 + v24) );
if ( (int)v24 >= 50 )
{
v35 = (int)(float)((float)(int)v24 / 50.0);
v36 = 0;
v37 = 50;
while ( 1 )
{
v38 = v57;
if ( v23 > 0xF )
v38 = v22;
sub_14003B190((void **)&Src, *((_BYTE *)v38 + v36));
v36 += v35;
if ( !--v37 )
break;
v23 = v58;
v22 = (void **)v57[0];
}
}
else
{
v25 = v57;
if ( v58 > 0xF )
v25 = (void **)v57[0];
sub_14003CCE0((void **)&Src, v25, (size_t)v57[2]);
}
v26 = GJAccountManager::sharedState();
v27 = (void **)GameToolbox::intToString(&v59, v26->m_accountID - v26->m_unkInt1);
v28 = v27;
if ( (unsigned __int64)v27[3] > 0xF )
v28 = *v27;
sub_140041270(&Src, v28, (size_t)v27[2]);
sub_14003A830((__int64)&v59);
p_Src = &Src;
if ( v64 > 0xF )
p_Src = (__int128 *)Src;
v30 = &Src;
if ( v64 > 0xF )
v30 = (__int128 *)Src;
v31 = -1;
do
++v31;
while ( *((_BYTE *)p_Src + v31) );
sub_140070860((__int64)v30, v31, Block);
sub_140070B30((unsigned __int8 *)Block, v73);
*(_OWORD *)Block = 0;
si128 = 0;
v32 = -1;
do
++v32;
while ( v73[v32] );
sub_14003A930(Block, v73, v32);
v33 = sub_14003BDB0((__int64)v56, (__int64)v68);
cocos2d::ZipUtils::base64EncodeEnc(v72, Block, v33);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v34 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v34 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v34 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v34);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
v39 = (const char *)v68;
if ( v68[3] > 0xFu )
v39 = (const char *)v68[0];
v40 = (const char *)v72;
if ( v72[3] > 0xFu )
v40 = (const char *)v72[0];
v41 = cocos2d::CCString::createWithFormat("&seed=%s&seed2=%s", v40, v39);
v42 = (char *)cocos2d::CCString::getCString(v41);
v43 = -1;
do
++v43;
while ( v42[v43] );
sub_140041270(v67, v42, v43);
sub_140041270(v67, "&secret=", 8u);
LODWORD(v50) = 98;
LODWORD(v49) = 103;
v44 = cocos2d::CCString::createWithFormat(
"%c%s%s%c%c%s",
87,
"mfd",
"2893",
v49,
v50,
(const char *)&word_140531E88);
v45 = (char *)cocos2d::CCString::getCString(v44);
v46 = -1;
do
++v46;
while ( v45[v46] );
sub_140041270(v67, v45, v46);
v54 = &v59;
v47 = (const char *)sub_14003BDB0((__int64)v73, (__int64)Buf2);
v48 = v67;
if ( v67[3] > 0xFu )
v48 = (_QWORD *)v67[0];
v59 = 0;
v60 = 0;
v61 = 0;
do
++v19;
while ( *((_BYTE *)v48 + v19) );
sub_14003A930(&v59, v48, v19);
v51 = 0;
*(_QWORD *)&v51 = sub_14003AA10(0x40u);
v52 = 56;
v53 = 63;
strcpy((char *)v51, "https://www.boomlings.com/database/uploadGJLevelList.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)&v51, (const char *)&v59, v47, 61);
sub_14003A830((__int64)v72);
sub_14003A830((__int64)&Src);
sub_14003A830((__int64)v68);
sub_14003A830((__int64)v67);
sub_14003A830((__int64)v57);
sub_14003A830((__int64)v69);
sub_14003A830((__int64)v70);
}
sub_14003A830((__int64)Buf2);
}