//
// GameLevelManager::uploadComment from 0x3d20b0 to 0x3d245e (942 bytes)
//
// 2 xrefs:
// > GameLevelManager::uploadLevelComment @ 0x3d24e2
// > GameLevelManager::uploadAccountComment @ 0x3d252c
//
// 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 GameLevelManager::uploadComment(
GameLevelManager *a1,
int *a2,
const char *a3,
const char *a4,
const char *a5)
{
char *PostCommentKey; // r11
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // r4
int v10; // r4
int result; // r0
int v12; // r4
cocos2d::CCNode *v13; // r10
int v14; // r6
char *v15; // r7
cocos2d::CCString *v16; // r0
const char *CString; // r0
cocos2d::CCString *v18; // r0
char *v19; // r0
cocos2d::CCString *v20; // r0
char *v21; // r0
cocos2d::CCString *v22; // r0
char *v23; // r0
cocos2d::CCString *v24; // r0
char *v25; // r0
cocos2d::CCString *v26; // r0
char *v27; // r0
const void *v28; // r0
unsigned __int8 *v29; // r3
char *v30; // r2
char **v31; // r0
char *v33; // [sp+28h] [bp-34h] BYREF
_BYTE v34[4]; // [sp+2Ch] [bp-30h] BYREF
_BYTE v35[4]; // [sp+30h] [bp-2Ch] BYREF
_BYTE v36[4]; // [sp+34h] [bp-28h] BYREF
char *v37; // [sp+38h] [bp-24h] BYREF
char *v38; // [sp+3Ch] [bp-20h] BYREF
cocos2d::ZipUtils v39; // [sp+40h] [bp-1Ch] BYREF
std::string v40; // [sp+44h] [bp-18h] BYREF
_BYTE v41[4]; // [sp+48h] [bp-14h] BYREF
char *v42; // [sp+4Ch] [bp-10h] BYREF
const char *v43; // [sp+50h] [bp-Ch] BYREF
char *v44; // [sp+54h] [bp-8h] BYREF
char *v45; // [sp+58h] [bp-4h] BYREF
std::string v46; // [sp+5Ch] [bp+0h] BYREF
std::string v47; // [sp+60h] [bp+4h] BYREF
_BYTE v48[20]; // [sp+64h] [bp+8h] BYREF
unsigned __int8 v49[44]; // [sp+78h] [bp+1Ch] BYREF
sub_775C20(&v46);
LevelTools::base64EncodeString((cocos2d::ZipUtils *)&v47, &v46);
sub_774794(a2, &v47);
sub_774008(&v47);
sub_774008(&v46);
if ( a3 )
PostCommentKey = "acc_comment";
else
PostCommentKey = (char *)GameLevelManager::getPostCommentKey(a1, (int)a4);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_776584((int)&v47, PostCommentKey);
v10 = cocos2d::CCDictionary::objectForKey(m_friendReqAndUserBlocks, &v47);
result = sub_774008(&v47);
if ( !v10 )
{
v12 = (int)a1->m_friendReqAndUserBlocks;
v13 = cocos2d::CCNode::create();
sub_776584((int)&v47, PostCommentKey);
cocos2d::CCDictionary::setObject(v12, v13);
sub_774008(&v47);
GameLevelManager::makeTimeStamp(a1, PostCommentKey);
GameManager::sharedState();
sub_775C20(&v33);
GameManager::sharedState();
sub_775C20(v34);
sub_775C20(v35);
GameLevelManager::removeDelimiterChars((int)a1, (int)v35, 0);
sub_774008(v35);
sub_775C20(v36);
GameLevelManager::removeDelimiterChars((int)a1, (int)v36, 1);
sub_774008(v36);
GameLevelManager::getBasePostString((GameLevelManager *)&v37);
v14 = *a2;
v15 = v33;
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfd",
"2893",
103,
98,
&aO1i2r3e45s7t89[10]);
CString = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&userName=%s&comment=%s&secret=%s",
v15,
v14,
CString);
v19 = (char *)cocos2d::CCString::getCString(v18);
sub_774544((int)&v37, v19);
if ( a3 )
{
sub_774544((int)&v37, "&cType=");
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a3);
}
else
{
sub_774544((int)&v37, "&levelID=");
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a4);
v21 = (char *)cocos2d::CCString::getCString(v20);
sub_774544((int)&v37, v21);
if ( (int)a5 <= 0 )
goto LABEL_7;
sub_774544((int)&v37, "&percent=");
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a5);
}
v25 = (char *)cocos2d::CCString::getCString(v24);
sub_774544((int)&v37, v25);
LABEL_7:
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s%s%i%i%i",
v33,
*a2,
a4,
a5,
a3);
v23 = (char *)cocos2d::CCString::getCString(v22);
sub_776584((int)&v38, v23);
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"PT6",
"iUrt",
119,
115,
"0J");
v27 = (char *)cocos2d::CCString::getCString(v26);
sub_774544((int)&v38, v27);
v28 = (const void *)strlen(v38);
rtsha1::calc((rtsha1 *)v38, v28, (int)v48, v29);
rtsha1::toHexString((rtsha1 *)v48, v49, v30);
sub_776584((int)&v40, (char *)v49);
sub_776584((int)v41, "29481");
cocos2d::ZipUtils::base64EncodeEnc(&v39, &v40, (std::string)v41);
sub_774008(v41);
sub_774008(&v40);
sub_774544((int)&v37, "&chk=");
sub_77441C(&v37, &v39);
if ( a3 )
{
sub_776584((int)&v45, "https://www.boomlings.com/database/uploadGJAccComment20.php");
sub_776584((int)&v46, v37);
sub_776584((int)&v47, PostCommentKey);
GameLevelManager::ProcessHttpRequest(a1, &v45, (const char **)&v46, (char **)&v47, 13);
sub_774008(&v47);
sub_774008(&v46);
v31 = &v45;
}
else
{
sub_776584((int)&v42, "https://www.boomlings.com/database/uploadGJComment21.php");
sub_776584((int)&v43, v37);
sub_776584((int)&v44, PostCommentKey);
GameLevelManager::ProcessHttpRequest(a1, &v42, &v43, &v44, 13);
sub_774008(&v44);
sub_774008(&v43);
v31 = &v42;
}
sub_774008(v31);
sub_774008(&v39);
sub_774008(&v38);
sub_774008(&v37);
sub_774008(v34);
return sub_774008(&v33);
}
return result;
}