//
// GJMultiplayerManager::uploadComment from 0x1402835d0 to 0x140283b28 (1368 bytes)
//
// 2 xrefs:
// > ShareCommentLayer::onShare @ 0x14048e3f0
// > ??> @ 0x1406d14c0
//
// 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=12
char __fastcall GJMultiplayerManager::uploadComment(cocos2d::CCObject *a1, const char *a2, unsigned int a3)
{
__int64 v6; // rax
__int64 v7; // rbx
void *v8; // rcx
cocos2d::CCString *v9; // rax
const char *CString; // rsi
__int64 v11; // rcx
_QWORD *v12; // rbx
__int64 v13; // rcx
const char *v14; // rbx
const char *v15; // r14
cocos2d::CCString *v16; // rax
const char *v17; // rax
cocos2d::CCString *v18; // rax
char *v19; // rax
size_t v20; // rbx
size_t v21; // r8
const char *v22; // r14
const char *v23; // r15
GJAccountManager *v24; // rax
cocos2d::CCString *v25; // rax
const char *v26; // rax
size_t v27; // r8
void **v28; // rax
void **v29; // rcx
__int64 v30; // rdx
size_t v31; // r8
void *v32; // rcx
void **v33; // rdx
const char *v34; // rbx
__int64 v35; // rbx
GJMultiplayerManager *v36; // rax
void *v37; // rcx
void *v39; // [rsp+48h] [rbp-B8h]
__int128 v40; // [rsp+50h] [rbp-B0h] BYREF
__int64 v41; // [rsp+60h] [rbp-A0h]
__int64 v42; // [rsp+68h] [rbp-98h]
_BYTE *v43; // [rsp+70h] [rbp-90h]
__int128 v44; // [rsp+78h] [rbp-88h] BYREF
__int64 v45; // [rsp+88h] [rbp-78h]
__int64 v46; // [rsp+90h] [rbp-70h]
const char *v47; // [rsp+98h] [rbp-68h]
void *Block[2]; // [rsp+A0h] [rbp-60h] BYREF
__int128 v49; // [rsp+B0h] [rbp-50h]
void *v50[2]; // [rsp+C0h] [rbp-40h] BYREF
__int64 v51; // [rsp+D0h] [rbp-30h]
unsigned __int64 v52; // [rsp+D8h] [rbp-28h]
void *v53[2]; // [rsp+E0h] [rbp-20h] BYREF
__int64 v54; // [rsp+F0h] [rbp-10h]
unsigned __int64 v55; // [rsp+F8h] [rbp-8h]
_QWORD v56[3]; // [rsp+100h] [rbp+0h] BYREF
unsigned __int64 v57; // [rsp+118h] [rbp+18h]
void *v58[4]; // [rsp+120h] [rbp+20h] BYREF
_QWORD Src[4]; // [rsp+140h] [rbp+40h] BYREF
_BYTE v60[48]; // [rsp+160h] [rbp+60h] BYREF
v47 = a2;
v6 = sub_14003BDB0((__int64)&v40, (__int64)a2);
v7 = v6;
if ( *(_QWORD *)(v6 + 16) )
{
cocos2d::ZipUtils::base64URLEncode(Block, v6);
}
else
{
*(_OWORD *)Block = 0;
v49 = 0u;
*(_OWORD *)Block = *(_OWORD *)v6;
v49 = *(_OWORD *)(v6 + 16);
*(_QWORD *)(v6 + 16) = 0;
*(_QWORD *)(v6 + 24) = 15;
*(_BYTE *)v6 = 0;
}
sub_14003A830(v7);
sub_140051590((__int64)a2, (__int64)Block);
if ( *((_QWORD *)&v49 + 1) > 0xFu )
{
v8 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v49 + 1) + 1LL) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v9 = cocos2d::CCString::createWithFormat("%i_comment", a3);
CString = cocos2d::CCString::getCString(v9);
v12 = (_QWORD *)sub_14003BDB0((__int64)&v40, (__int64)a2);
if ( !qword_1406C2EC0 )
{
v39 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v39);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
GameLevelManager::removeDelimiterChars(v11, v12, 1);
GameToolbox::gen_random(v56);
GJMultiplayerManager::getBasePostString(v13, Src);
v14 = (const char *)v56;
if ( v57 > 0xF )
v14 = (const char *)v56[0];
v15 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v15 = *(const char **)a2;
v16 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfv", "3899", 103, 99, "9");
v17 = cocos2d::CCString::getCString(v16);
v18 = cocos2d::CCString::createWithFormat("&comment=%s&gameID=%i&extra=%s&secret=%s", v15, a3, v14, v17);
v19 = (char *)cocos2d::CCString::getCString(v18);
v20 = -1;
v21 = -1;
do
++v21;
while ( v19[v21] );
sub_140041270(Src, v19, v21);
v22 = (const char *)v56;
if ( v57 > 0xF )
v22 = (const char *)v56[0];
v23 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v23 = *(const char **)a2;
v24 = GJAccountManager::sharedState();
v25 = cocos2d::CCString::createWithFormat("%i%s%i%s", v24->m_accountID - v24->m_unkInt1, v23, a3, v22);
v26 = cocos2d::CCString::getCString(v25);
*(_OWORD *)v53 = 0;
v54 = 0;
v55 = 0;
v27 = -1;
do
++v27;
while ( v26[v27] );
sub_14003A930(v53, v26, v27);
v28 = v53;
if ( v55 <= 0xF )
{
v29 = v53;
}
else
{
v29 = (void **)v53[0];
v28 = (void **)v53[0];
}
v30 = -1;
do
++v30;
while ( *((_BYTE *)v28 + v30) );
sub_140070860((__int64)v29, v30, v50);
sub_140070B30((unsigned __int8 *)v50, v60);
*(_OWORD *)v50 = 0;
v51 = 0;
v52 = 0;
v31 = -1;
do
++v31;
while ( v60[v31] );
sub_14003A930(v50, v60, v31);
*(_OWORD *)Block = 0;
*(_QWORD *)&v49 = 5;
*((_QWORD *)&v49 + 1) = 15;
strcpy((char *)Block, "52832");
cocos2d::ZipUtils::base64EncodeEnc(v58, v50, Block);
if ( v52 > 0xF )
{
v32 = v50[0];
if ( v52 + 1 >= 0x1000 )
{
v32 = *((void **)v50[0] - 1);
if ( (unsigned __int64)((char *)v50[0] - (char *)v32 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v32);
}
v51 = 0;
v52 = 15;
LOBYTE(v50[0]) = 0;
sub_140041270(Src, "&chk=", 5u);
v33 = v58;
if ( v58[3] > (void *)0xF )
v33 = (void **)v58[0];
sub_140041270(Src, v33, (size_t)v58[2]);
v40 = 0;
v41 = 0;
v42 = 0;
do
++v20;
while ( CString[v20] );
sub_14003A930(&v40, CString, v20);
v34 = (const char *)sub_14003BDB0((__int64)v60, (__int64)Src);
v44 = 0;
v45 = 0;
v46 = 15;
*(_QWORD *)&v44 = sub_14003AA10(0x40u);
v45 = 57;
v46 = 63;
strcpy((char *)v44, "https://www.geometrydash.com/database/uploadMPComment.php");
GJMultiplayerManager::ProcessHttpRequest(a1, (char *)&v44, v34, (const char *)&v40, 13);
v43 = v60;
v35 = sub_14003BDB0((__int64)v60, (__int64)a2);
v36 = GJMultiplayerManager::sharedState();
GJMultiplayerManager::createAndAddComment(v36, v35, a3);
sub_14003A830((__int64)v58);
if ( v55 > 0xF )
{
v37 = v53[0];
if ( v55 + 1 >= 0x1000 )
{
v37 = *((void **)v53[0] - 1);
if ( (unsigned __int64)((char *)v53[0] - (char *)v37 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v37);
}
sub_14003A830((__int64)Src);
sub_14003A830((__int64)v56);
sub_14003A830((__int64)a2);
return 1;
}