//
// GJMultiplayerManager::uploadComment from 0x510b38 to 0x510d8e (598 bytes)
//
// 2 xrefs:
// > ShareCommentLayer::onShare @ 0x431a4a
// > MPLobbyLayer::postComment @ 0x5358ea
//
// 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
//
int __fastcall GJMultiplayerManager::uploadComment(char *a1, const char **a2, char *a3)
{
cocos2d::CCString *v5; // r0
GameLevelManager *v6; // r6
char *v7; // r2
const char *v8; // r10
int v9; // r8
cocos2d::CCString *v10; // r0
const char *v11; // r0
cocos2d::CCString *v12; // r0
char *v13; // r0
GJAccountManager *v14; // r0
cocos2d::CCString *v15; // r0
char *v16; // r0
const void *v17; // r0
unsigned __int8 *v18; // r3
char *v19; // r2
GJMultiplayerManager *v20; // r5
int v21; // r3
char *CString; // [sp+20h] [bp-7Ch]
int v25; // [sp+2Ch] [bp-70h] BYREF
char v26; // [sp+30h] [bp-6Ch] BYREF
char *v27; // [sp+34h] [bp-68h] BYREF
cocos2d::ZipUtils v28; // [sp+38h] [bp-64h] BYREF
std::string v29; // [sp+3Ch] [bp-60h] BYREF
_BYTE v30[4]; // [sp+40h] [bp-5Ch] BYREF
char *v31; // [sp+44h] [bp-58h] BYREF
const char *v32; // [sp+48h] [bp-54h] BYREF
std::string v33; // [sp+4Ch] [bp-50h] BYREF
const char *v34; // [sp+50h] [bp-4Ch] BYREF
unsigned __int8 v35[20]; // [sp+54h] [bp-48h] BYREF
unsigned __int8 v36[44]; // [sp+68h] [bp-34h] BYREF
sub_775C20(&v33);
LevelTools::base64EncodeString((cocos2d::ZipUtils *)&v34, &v33);
sub_774794(a2, &v34);
sub_774008(&v34);
sub_774008(&v33);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i_comment", a3);
CString = (char *)cocos2d::CCString::getCString(v5);
v6 = GameLevelManager::sharedState();
sub_775C20(&v34);
GameLevelManager::removeDelimiterChars((int)v6, (int)&v34, 1);
sub_774008(&v34);
GameToolbox::gen_random((GameToolbox *)&v25, 10, v7, (char *)&v25);
GJMultiplayerManager::getBasePostString((GJMultiplayerManager *)&v26, a1);
v8 = *a2;
v9 = v25;
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfv",
"3899",
103,
99,
&aO1i2r3e45s7t89[13]);
v11 = cocos2d::CCString::getCString(v10);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&comment=%s&gameID=%i&extra=%s&secret=%s",
v8,
a3,
v9,
v11);
v13 = (char *)cocos2d::CCString::getCString(v12);
sub_774544((int)&v26, v13);
v14 = GJAccountManager::sharedState();
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%s%i%s",
(const char *)(v14->m_accountID - v14->m_unkInt1),
*a2,
a3,
v25);
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_776584((int)&v27, v16);
v17 = (const void *)strlen(v27);
rtsha1::calc((rtsha1 *)v27, v17, (int)v35, v18);
rtsha1::toHexString((rtsha1 *)v35, v36, v19);
sub_776584((int)&v29, (char *)v36);
sub_776584((int)v30, "52832");
cocos2d::ZipUtils::base64EncodeEnc(&v28, &v29, (std::string)v30);
sub_774008(v30);
sub_774008(&v29);
sub_774544((int)&v26, "&chk=");
sub_77441C(&v26, &v28);
sub_776584((int)&v31, "https://www.geometrydash.com/database/uploadMPComment.php");
sub_775C20(&v32);
sub_776584((int)&v33, CString);
GJMultiplayerManager::ProcessHttpRequest((cocos2d::CCObject *)a1, &v31, &v32, (char **)&v33, 13);
sub_774008(&v33);
sub_774008(&v32);
sub_774008(&v31);
v20 = GJMultiplayerManager::sharedState();
sub_775C20(&v34);
GJMultiplayerManager::createAndAddComment((int)v20, &v34, a3, v21);
sub_774008(&v34);
sub_774008(&v28);
sub_774008(&v27);
sub_774008(&v26);
sub_774008(&v25);
return 1;
}