//
// GameLevelManager::uploadUserMessage from 0x14015ae40 to 0x14015b285 (1093 bytes)
//
// 2 xrefs:
// > GJWriteMessagePopup::onSend @ 0x14029a33d
// > ??> @ 0x1406caa1c
//
// 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=7
void __fastcall GameLevelManager::uploadUserMessage(GameLevelManager *a1, int a2, const char *a3, const char *a4)
{
cocos2d::CCString *v7; // rax
const char *CString; // rax
const char *v9; // rbx
size_t v10; // rdi
size_t v11; // r8
__int64 v12; // rsi
void *v13; // rcx
size_t v14; // r8
__int64 v15; // rax
void *v16; // rcx
__int64 v17; // rax
__int64 v18; // rsi
void *v19; // rcx
__int64 v20; // rax
__int64 v21; // rcx
const char *v22; // r12
const char *v23; // rsi
cocos2d::CCString *v24; // rax
const char *v25; // rax
cocos2d::CCString *v26; // rax
char *v27; // rax
size_t v28; // r8
size_t v29; // r8
_QWORD *v30; // rdx
__int128 v32; // [rsp+50h] [rbp-89h] BYREF
__int64 v33; // [rsp+60h] [rbp-79h]
__int64 v34; // [rsp+68h] [rbp-71h]
const char *v35; // [rsp+78h] [rbp-61h]
const char *v36; // [rsp+80h] [rbp-59h]
void *Block[2]; // [rsp+88h] [rbp-51h] BYREF
__int128 v38; // [rsp+98h] [rbp-41h]
__int128 v39; // [rsp+A8h] [rbp-31h] BYREF
__int64 v40; // [rsp+B8h] [rbp-21h]
__int64 v41; // [rsp+C0h] [rbp-19h]
_QWORD Src[4]; // [rsp+C8h] [rbp-11h] BYREF
v35 = a3;
v36 = a4;
v7 = cocos2d::CCString::createWithFormat("uMsg_%i", a2);
CString = cocos2d::CCString::getCString(v7);
v9 = CString;
*(_OWORD *)Block = 0;
v38 = 0;
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003A930(Block, CString, v11);
v12 = cocos2d::CCDictionary::objectForKey(a1->m_friendReqAndUserBlocks, Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v13 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
if ( !v12 )
{
*(_OWORD *)Block = 0;
v38 = 0;
v14 = -1;
do
++v14;
while ( v9[v14] );
sub_14003A930(Block, v9, v14);
v15 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(a1->m_friendReqAndUserBlocks, v15, Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v16 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
GameLevelManager::makeTimeStamp(a1, v9);
v17 = sub_14003BDB0((__int64)&v39, (__int64)a3);
v18 = v17;
if ( *(_QWORD *)(v17 + 16) )
{
cocos2d::ZipUtils::base64URLEncode(Block, v17);
}
else
{
*(_OWORD *)Block = 0;
v38 = 0;
*(_OWORD *)Block = *(_OWORD *)v17;
v38 = *(_OWORD *)(v17 + 16);
*(_QWORD *)(v17 + 16) = 0;
*(_QWORD *)(v17 + 24) = 15;
*(_BYTE *)v17 = 0;
}
sub_14003A830(v18);
sub_140051590((__int64)a3, (__int64)Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v19 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v19);
}
*(_OWORD *)Block = 0;
*(_QWORD *)&v38 = 5;
*((_QWORD *)&v38 + 1) = 15;
strcpy((char *)Block, "14251");
v20 = cocos2d::ZipUtils::base64EncodeEnc(&v39, a4, Block);
sub_140051590((__int64)a4, v20);
sub_14003A830((__int64)&v39);
GameLevelManager::getBasePostString(v21, Src);
v22 = a4;
if ( *((_QWORD *)a4 + 3) > 0xFu )
v22 = *(const char **)a4;
v23 = a3;
if ( *((_QWORD *)a3 + 3) > 0xFu )
v23 = *(const char **)a3;
v24 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_140531E88);
v25 = cocos2d::CCString::getCString(v24);
v26 = cocos2d::CCString::createWithFormat("&toAccountID=%i&subject=%s&body=%s&secret=%s", a2, v23, v22, v25);
v27 = (char *)cocos2d::CCString::getCString(v26);
v28 = -1;
do
++v28;
while ( v27[v28] );
sub_140041270(Src, v27, v28);
v32 = 0;
v33 = 0;
v34 = 0;
v29 = -1;
do
++v29;
while ( v9[v29] );
sub_14003A930(&v32, v9, v29);
v30 = Src;
if ( Src[3] > 0xFu )
v30 = (_QWORD *)Src[0];
v39 = 0;
v40 = 0;
v41 = 0;
do
++v10;
while ( *((_BYTE *)v30 + v10) );
sub_14003A930(&v39, v30, v10);
*(_OWORD *)Block = 0;
*(_QWORD *)&v38 = 0;
*((_QWORD *)&v38 + 1) = 15;
Block[0] = sub_14003AA10(0x40u);
*(_QWORD *)&v38 = 56;
*((_QWORD *)&v38 + 1) = 63;
strcpy((char *)Block[0], "https://www.boomlings.com/database/uploadGJMessage20.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)Block, (const char *)&v39, (const char *)&v32, 40);
sub_14003A830((__int64)Src);
}
sub_14003A830((__int64)a3);
sub_14003A830((__int64)a4);
}