//
// GJMultiplayerManager::uploadComment from 0x9839f0 to 0x9842fc (2316 bytes)
//
// 3 xrefs:
// > ShareCommentLayer::onShare @ 0x7e65b8
// > MPLobbyLayer::postComment @ 0x9ca6a0
// > ??> @ 0x81168
//
// 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
//
__int64 __fastcall GJMultiplayerManager::uploadComment(GJMultiplayerManager *a1, const char **a2, unsigned int a3)
{
void *v5; // x0
char *v6; // x0
cocos2d::CCString *v7; // x0
GameLevelManager *v8; // x23
void *v9; // x0
const char *v10; // x26
__int64 v11; // x25
cocos2d::CCString *v12; // x0
const char *v13; // x0
cocos2d::CCString *v14; // x0
size_t v15; // x0
GJAccountManager *v16; // x0
cocos2d::CCString *v17; // x0
char *v18; // x0
char *v19; // x26
unsigned int v20; // w0
unsigned __int8 *v21; // x3
char *v22; // x2
char *v23; // x0
void *v24; // x0
char *v25; // x0
char *v26; // x0
char *v27; // x0
GJMultiplayerManager *v28; // x23
void *v29; // x0
void *v30; // x0
char *v31; // x0
void *v32; // x0
void *v33; // x0
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // 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
const char *v61; // [xsp+68h] [xbp+68h]
char *CString; // [xsp+70h] [xbp+70h]
__int64 v64; // [xsp+90h] [xbp+90h] BYREF
__int64 v65; // [xsp+98h] [xbp+98h] BYREF
char *v66; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v67; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v68; // [xsp+B0h] [xbp+B0h] BYREF
std::string v69; // [xsp+B8h] [xbp+B8h] BYREF
const char *v70; // [xsp+C0h] [xbp+C0h] BYREF
const char *v71; // [xsp+C8h] [xbp+C8h] BYREF
const char *v72; // [xsp+D0h] [xbp+D0h] BYREF
int v73[2]; // [xsp+D8h] [xbp+D8h] BYREF
unsigned __int8 v74[24]; // [xsp+E0h] [xbp+E0h] BYREF
unsigned __int8 v75[48]; // [xsp+F8h] [xbp+F8h] BYREF
std::string v76; // 0:x2.8
sub_D18D28(&v72);
LevelTools::base64EncodeString((cocos2d::ZipUtils *)&v72, v73);
sub_D163D4(a2, v73);
v5 = (void *)(*(_QWORD *)v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(*(_QWORD *)v73 - 8LL);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(*(_QWORD *)v73 - 8LL);
*(_DWORD *)(*(_QWORD *)v73 - 8LL) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v5);
}
v6 = (char *)(v72 - 24);
if ( v72 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v72 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *((_DWORD *)v72 - 2);
*((_DWORD *)v72 - 2) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v6);
}
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i_comment", (const char *)a3);
CString = (char *)cocos2d::CCString::getCString(v7);
v8 = GameLevelManager::sharedState();
sub_D18D28(v73);
GameLevelManager::removeDelimiterChars((__int64)v8, (unsigned __int8 **)v73, 1);
v9 = (void *)(*(_QWORD *)v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(*(_QWORD *)v73 - 8LL);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(*(_QWORD *)v73 - 8LL);
*(_DWORD *)(*(_QWORD *)v73 - 8LL) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v9);
}
GameToolbox::gen_random((GameToolbox *)&byte_9[1], (__int64)&v64);
GJMultiplayerManager::getBasePostString(a1, (__int64)&v65);
v10 = *a2;
v11 = v64;
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfv",
"3899",
103,
99,
"9");
v13 = cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&comment=%s&gameID=%i&extra=%s&secret=%s",
v10,
a3,
v11,
v13);
v61 = cocos2d::CCString::getCString(v14);
v15 = strlen(v61);
sub_D15FD4(&v65, v61, v15);
v16 = GJAccountManager::sharedState();
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%s%i%s",
(const char *)(unsigned int)(v16->m_accountID - v16->m_unkInt1),
*a2,
a3,
v64);
v18 = (char *)cocos2d::CCString::getCString(v17);
sub_D153B8((int)&v66, v18);
v19 = v66;
v20 = strlen(v66);
rtsha1::calc((rtsha1 *)v19, (const void *)v20, (__int64)v74, v21);
rtsha1::toHexString((rtsha1 *)v74, v75, v22);
sub_D153B8((int)&v68, (char *)v75);
sub_D153B8((int)&v69, "52832");
cocos2d::ZipUtils::base64EncodeEnc((cocos2d::ZipUtils *)&v68, &v69, v76);
v23 = (char *)v69.m_data.m_data - 24;
if ( (__int64 *)v69.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)((char *)v69.m_data.m_data - 8);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *((_DWORD *)v69.m_data.m_data - 2);
*((_DWORD *)v69.m_data.m_data - 2) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v23);
}
v24 = (void *)(v68 - 24);
if ( (__int64 *)(v68 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(v68 - 8);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(v68 - 8);
*(_DWORD *)(v68 - 8) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v24);
}
sub_D15FD4(&v65, "&chk=", 5);
sub_D15E14(&v65, &v67);
sub_D153B8((int)&v70, "https://www.geometrydash.com/database/uploadMPComment.php");
sub_D18D28(&v71);
sub_D153B8((int)&v72, CString);
GJMultiplayerManager::ProcessHttpRequest(a1, &v70, &v71, &v72, 13);
v25 = (char *)(v72 - 24);
if ( v72 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(v72 - 8);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *((_DWORD *)v72 - 2);
*((_DWORD *)v72 - 2) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v25);
}
v26 = (char *)(v71 - 24);
if ( v71 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)(v71 - 8);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *((_DWORD *)v71 - 2);
*((_DWORD *)v71 - 2) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v26);
}
v27 = (char *)(v70 - 24);
if ( v70 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v70 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v70 - 2);
*((_DWORD *)v70 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v27);
}
v28 = GJMultiplayerManager::sharedState();
sub_D18D28(v73);
GJMultiplayerManager::createAndAddComment((__int64)v28, (char **)v73, a3);
v29 = (void *)(*(_QWORD *)v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(*(_QWORD *)v73 - 8LL);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(*(_QWORD *)v73 - 8LL);
*(_DWORD *)(*(_QWORD *)v73 - 8LL) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v29);
}
v30 = (void *)(v67 - 24);
if ( (__int64 *)(v67 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v67 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(v67 - 8);
*(_DWORD *)(v67 - 8) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v30);
}
v31 = v66 - 24;
if ( v66 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v66 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v66 - 2);
*((_DWORD *)v66 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v31);
}
v32 = (void *)(v65 - 24);
if ( (__int64 *)(v65 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v65 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *(_DWORD *)(v65 - 8);
*(_DWORD *)(v65 - 8) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v32);
}
v33 = (void *)(v64 - 24);
if ( (__int64 *)(v64 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(v64 - 8);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(v64 - 8);
*(_DWORD *)(v64 - 8) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v33);
}
return 1;
}