//
// GJMultiplayerManager::uploadComment from 0x10065b3e0 to 0x10065bb82 (1954 bytes)
//
// 2 xrefs:
// > MPLobbyLayer::postComment @ 0x100493f7d
// > ShareCommentLayer::onShare @ 0x1005e10e7
//
// 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
//
char __fastcall GJMultiplayerManager::uploadComment(cocos2d::CCObject *a1, __int64 a2, unsigned int a3, __m128 a4)
{
__m128 v5; // xmm0
cocos2d::CCString *v6; // rax
const char *CString; // r12
GameLevelManager *v8; // r15
cocos2d::CCString *v9; // rax
cocos2d::CCString *v10; // rax
const char *v11; // rax
cocos2d::CCString *v12; // rax
const char *v13; // r13
size_t v14; // rax
size_t v15; // r15
char *v16; // r12
char *v17; // rbx
size_t v18; // rbx
unsigned int v19; // eax
size_t v20; // rax
std::string::size_type v21; // r13
char *data; // r15
size_t v23; // rbx
const std::string::value_type *v24; // rsi
std::string::size_type size; // rdx
double v26; // xmm0_8
size_t v27; // rax
size_t v28; // r15
char *v29; // r12
cocos2d::CCObject *v30; // rbx
size_t v31; // rbx
__int64 v32; // r15
GJMultiplayerManager *v33; // r15
char v35; // [rsp+0h] [rbp-1E0h]
char v36; // [rsp+0h] [rbp-1E0h]
char v37; // [rsp+0h] [rbp-1E0h]
char *v38; // [rsp+8h] [rbp-1D8h]
__int128 v39; // [rsp+10h] [rbp-1D0h] BYREF
void *v40; // [rsp+20h] [rbp-1C0h]
std::string v41; // [rsp+28h] [rbp-1B8h] BYREF
std::string v42; // [rsp+40h] [rbp-1A0h] BYREF
std::string v43; // [rsp+60h] [rbp-180h] BYREF
__int128 v44; // [rsp+80h] [rbp-160h] BYREF
void *v45; // [rsp+90h] [rbp-150h]
__m128 v46; // [rsp+A0h] [rbp-140h] BYREF
void *v47; // [rsp+B0h] [rbp-130h]
std::string v48; // [rsp+C0h] [rbp-120h] BYREF
cocos2d::CCObject *v49; // [rsp+D8h] [rbp-108h]
size_t v50[3]; // [rsp+E0h] [rbp-100h] BYREF
std::string v51; // [rsp+F8h] [rbp-E8h] BYREF
_QWORD v52[2]; // [rsp+110h] [rbp-D0h] BYREF
void *v53; // [rsp+120h] [rbp-C0h]
_QWORD __dst[2]; // [rsp+128h] [rbp-B8h] BYREF
char *__s; // [rsp+138h] [rbp-A8h]
std::string v56; // [rsp+140h] [rbp-A0h] BYREF
unsigned int v57; // [rsp+15Ch] [rbp-84h]
std::string __src[2]; // [rsp+160h] [rbp-80h] BYREF
_BYTE v59[32]; // [rsp+190h] [rbp-50h] BYREF
v57 = a3;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_100006B70(&v42, *(const void **)(a2 + 16), *(_QWORD *)(a2 + 8), *(double *)a4.i64);
}
else
{
v42.__r_.__value_.__r.__words[2] = *(_QWORD *)(a2 + 16);
a4 = *(__m128 *)a2;
*(_OWORD *)&v42.__r_.__value_.__l.0 = *(_OWORD *)a2;
}
LevelTools::base64EncodeString(__src, &v42, *(double *)a4.i64);
if ( (*(_BYTE *)a2 & 1) != 0 )
operator delete(*(void **)(a2 + 16));
*(_QWORD *)(a2 + 16) = __src[0].__r_.__value_.__l.__data_;
v5 = *(__m128 *)&__src[0].__r_.__value_.__l.0;
*(_OWORD *)a2 = *(_OWORD *)&__src[0].__r_.__value_.__l.0;
*(_WORD *)&__src[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v42.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v42.__r_.__value_.__l.__data_);
v6 = (cocos2d::CCString *)sub_1007AB580("%i_comment", v35);
CString = cocos2d::CCString::getCString(v6);
v8 = GameLevelManager::sharedState();
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_100006B70(&v43, *(const void **)(a2 + 16), *(_QWORD *)(a2 + 8), *(double *)v5.i64);
}
else
{
v43.__r_.__value_.__r.__words[2] = *(_QWORD *)(a2 + 16);
v5 = *(__m128 *)a2;
*(_OWORD *)&v43.__r_.__value_.__l.0 = *(_OWORD *)a2;
}
GameLevelManager::removeDelimiterChars((__int64)v8, &v43, 1);
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v43.__r_.__value_.__l.__data_);
GameToolbox::gen_random(v50, 10, *(double *)v5.i64);
GJMultiplayerManager::getBasePostString(&v56, v5);
v38 = (char *)CString;
v49 = a1;
v9 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"9");
cocos2d::CCString::getCString(v9);
v10 = (cocos2d::CCString *)sub_1007AB580("&comment=%s&gameID=%i&extra=%s&secret=%s", v36);
v11 = cocos2d::CCString::getCString(v10);
std::string::append(&v56, v11);
GJAccountManager::sharedState();
v12 = (cocos2d::CCString *)sub_1007AB580("%i%s%i%s", v37);
v13 = cocos2d::CCString::getCString(v12);
v14 = strlen(v13);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)v5.i64);
v15 = v14;
if ( v14 >= 0x17 )
{
v18 = 26;
if ( (v14 | 7) != 0x17 )
v18 = (v14 | 7) + 1;
v16 = (char *)operator new(v18);
__s = v16;
__dst[0] = v18 | 1;
__dst[1] = v15;
LABEL_21:
memmove(v16, v13, v15);
v16[v15] = 0;
if ( (__dst[0] & 1) != 0 )
goto LABEL_17;
goto LABEL_22;
}
LOBYTE(__dst[0]) = 2 * v14;
v16 = (char *)__dst + 1;
if ( v14 )
goto LABEL_21;
BYTE1(__dst[0]) = 0;
if ( (__dst[0] & 1) != 0 )
{
LABEL_17:
v17 = __s;
goto LABEL_23;
}
LABEL_22:
v17 = (char *)__dst + 1;
LABEL_23:
v19 = strlen(v17);
sub_100792420(v17, v19, v59);
sub_100792C00(v59, __src);
v20 = strlen((const char *)__src);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)v5.i64);
v21 = v20;
if ( v20 >= 0x17 )
{
v23 = 26;
if ( (v20 | 7) != 0x17 )
v23 = (v20 | 7) + 1;
data = (char *)operator new(v23);
v51.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
v51.__r_.__value_.__r.__words[0] = v23 | 1;
v51.__r_.__value_.__l.__size_ = v21;
goto LABEL_30;
}
v51.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v20);
data = v51.__r_.__value_.__s.__data_;
if ( v20 )
LABEL_30:
memcpy(data, __src, v21);
data[v21] = 0;
strcpy((char *)&v39, "\n52832");
cocos2d::ZipUtils::base64EncodeEnc(&v48, &v51, &v39, *(double *)v5.i64);
if ( (v39 & 1) != 0 )
operator delete(v40);
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v51.__r_.__value_.__l.__data_);
std::string::append(&v56, "&chk=");
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
{
v24 = v48.__r_.__value_.__l.__data_;
size = v48.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v48.__r_.__value_.__l.0 >> 1;
v24 = v48.__r_.__value_.__s.__data_;
}
std::string::append(&v56, v24, size);
v41.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v41.__r_.__value_.__r.__words[0] = 65;
v41.__r_.__value_.__l.__size_ = 57;
v26 = *(double *)"https://www.geometrydash.com/database/uploadMPComment.php";
strcpy(v41.__r_.__value_.__l.__data_, "https://www.geometrydash.com/database/uploadMPComment.php");
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v44, v56.__r_.__value_.__l.__data_, v56.__r_.__value_.__l.__size_, 2.057594829120962e-81);
}
else
{
v45 = v56.__r_.__value_.__l.__data_;
v26 = *(double *)v56.__r_.__value_.__r.__words;
v44 = *(_OWORD *)&v56.__r_.__value_.__l.0;
}
v27 = strlen(v38);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v26);
v28 = v27;
if ( v27 >= 0x17 )
{
v31 = 26;
if ( (v27 | 7) != 0x17 )
v31 = (v27 | 7) + 1;
v29 = (char *)operator new(v31);
v53 = v29;
v52[0] = v31 | 1;
v52[1] = v28;
v30 = v49;
goto LABEL_48;
}
LOBYTE(v52[0]) = 2 * v27;
v29 = (char *)v52 + 1;
v30 = v49;
if ( v27 )
LABEL_48:
memmove(v29, v38, v28);
v29[v28] = 0;
GJMultiplayerManager::ProcessHttpRequest(v30, &v41, (__int64)&v44, (__int64)v52, 13);
if ( (v52[0] & 1) != 0 )
{
operator delete(v53);
if ( (v44 & 1) == 0 )
{
LABEL_51:
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_52;
goto LABEL_57;
}
}
else if ( (v44 & 1) == 0 )
{
goto LABEL_51;
}
operator delete(v45);
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_52:
v32 = qword_1009A37E0;
if ( qword_1009A37E0 )
goto LABEL_53;
LABEL_58:
v33 = (GJMultiplayerManager *)operator new(0x170u);
cocos2d::CCNode::CCNode((__int64)v33);
v33->__vftable = (GJMultiplayerManager_vtbl *)off_100986780;
v26 = 0.0;
*(_OWORD *)&v33->m_activeDownloads = 0;
*(_OWORD *)&v33->m_scoreArrays = 0;
*(_OWORD *)&v33->m_mpDelegate = 0;
qword_1009A37E0 = (__int64)v33;
GJMultiplayerManager::init(v33);
v32 = qword_1009A37E0;
if ( (*(_BYTE *)a2 & 1) == 0 )
goto LABEL_54;
goto LABEL_59;
}
LABEL_57:
operator delete(v41.__r_.__value_.__l.__data_);
v32 = qword_1009A37E0;
if ( !qword_1009A37E0 )
goto LABEL_58;
LABEL_53:
if ( (*(_BYTE *)a2 & 1) == 0 )
{
LABEL_54:
v47 = *(void **)(a2 + 16);
v46 = *(__m128 *)a2;
goto LABEL_60;
}
LABEL_59:
sub_100006B70(&v46, *(const void **)(a2 + 16), *(_QWORD *)(a2 + 8), v26);
LABEL_60:
GJMultiplayerManager::createAndAddComment(v32, &v46, v57);
if ( (v46.i8[0] & 1) != 0 )
{
operator delete(v47);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_62:
if ( (__dst[0] & 1) == 0 )
goto LABEL_63;
goto LABEL_68;
}
}
else if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_62;
}
operator delete(v48.__r_.__value_.__l.__data_);
if ( (__dst[0] & 1) == 0 )
{
LABEL_63:
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_64;
LABEL_69:
operator delete(v56.__r_.__value_.__l.__data_);
if ( (v50[0] & 1) == 0 )
return 1;
LABEL_70:
operator delete((void *)v50[2]);
return 1;
}
LABEL_68:
operator delete(__s);
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_69;
LABEL_64:
if ( (v50[0] & 1) != 0 )
goto LABEL_70;
return 1;
}