//
// GameLevelManager::uploadUserMessage from 0x1000a5494 to 0x1000a5750 (700 bytes)
//
// 1 xrefs:
// > GJWriteMessagePopup::onSend @ 0x1002dcb58
//
// 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
//
void __fastcall GameLevelManager::uploadUserMessage(GameLevelManager *a1, int a2, char *a3, void **a4)
{
cocos2d::CCString *v8; // x0
char *CString; // x20
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x24
__int64 v11; // x0
__int64 v12; // x24
cocos2d::CCDictionary *v13; // x24
cocos2d::CCNode *v14; // x25
cocos2d::CCString *v15; // x0
const char *v16; // x0
cocos2d::CCString *v17; // x0
const char *v18; // x0
std::string *v19; // x1
void *v20[2]; // [xsp+30h] [xbp-D0h] BYREF
char v21; // [xsp+47h] [xbp-B9h]
void *v22[2]; // [xsp+48h] [xbp-B8h] BYREF
char v23; // [xsp+5Fh] [xbp-A1h]
std::string v24; // [xsp+60h] [xbp-A0h] BYREF
void *__p[2]; // [xsp+78h] [xbp-88h] BYREF
char v26; // [xsp+8Fh] [xbp-71h]
__int128 __dst; // [xsp+90h] [xbp-70h] BYREF
__int64 v28; // [xsp+A0h] [xbp-60h]
std::string v29; // [xsp+A8h] [xbp-58h] BYREF
v8 = (cocos2d::CCString *)sub_100268F4C("uMsg_%i", a2);
CString = (char *)cocos2d::CCString::getCString(v8);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_100009900(&v29, CString);
v11 = cocos2d::CCDictionary::objectForKey_1(m_friendReqAndUserBlocks, &v29);
v12 = v11;
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v29.__r_.__value_.__l.__data_);
if ( v12 )
return;
}
else if ( v11 )
{
return;
}
v13 = a1->m_friendReqAndUserBlocks;
v14 = cocos2d::CCNode::create();
sub_100009900(&v29, CString);
cocos2d::CCDictionary::setObject_1(v13, v14, &v29);
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
GameLevelManager::makeTimeStamp(a1, CString);
if ( a3[23] < 0 )
{
sub_1000097D0(&__dst, *(void **)a3, *((_QWORD *)a3 + 1));
}
else
{
__dst = *(_OWORD *)a3;
v28 = *((_QWORD *)a3 + 2);
}
LevelTools::base64EncodeString(&v29, &__dst);
if ( a3[23] < 0 )
operator delete(*(void **)a3);
*(std::string *)a3 = v29;
*((_BYTE *)&v29.__r_.__value_.__s + 23) = 0;
v29.__r_.__value_.__s.__data_[0] = 0;
if ( SHIBYTE(v28) < 0 )
operator delete((void *)__dst);
sub_100009900(__p, "14251");
cocos2d::ZipUtils::base64EncodeEnc(&v29, a4, __p);
if ( *((char *)a4 + 23) < 0 )
operator delete(*a4);
*(std::string *)a4 = v29;
*((_BYTE *)&v29.__r_.__value_.__s + 23) = 0;
v29.__r_.__value_.__s.__data_[0] = 0;
if ( v26 < 0 )
operator delete(__p[0]);
GameLevelManager::getBasePostString(&v29);
if ( a3[23] < 0 )
a3 = *(char **)a3;
if ( *((char *)a4 + 23) < 0 )
a4 = (void **)*a4;
v15 = (cocos2d::CCString *)sub_100268F4C("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, "7");
v16 = cocos2d::CCString::getCString(v15);
v17 = (cocos2d::CCString *)sub_100268F4C(
"&toAccountID=%i&subject=%s&body=%s&secret=%s",
a2,
a3,
(const char *)a4,
v16);
v18 = cocos2d::CCString::getCString(v17);
std::string::append(&v29, v18);
sub_100009900(&v24, "https://www.boomlings.com/database/uploadGJMessage20.php");
if ( (v29.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v19 = &v29;
else
v19 = (std::string *)v29.__r_.__value_.__r.__words[0];
sub_100009900(v22, (char *)v19);
sub_100009900(v20, CString);
GameLevelManager::ProcessHttpRequest(a1, &v24, (char *)v22, (const std::string::value_type *)v20, 40);
if ( v21 < 0 )
operator delete(v20[0]);
if ( v23 < 0 )
operator delete(v22[0]);
if ( SHIBYTE(v24.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v24.__r_.__value_.__l.__data_);
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
}