//
// GameLevelManager::downloadUserMessage from 0x100568d20 to 0x100568fe2 (706 bytes)
//
// 1 xrefs:
// > GJMessagePopup::init @ 0x100293d96
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:32:12 +0000
//
void __fastcall GameLevelManager::downloadUserMessage(__int64 a1, __int64 a2, char a3)
{
__int64 v4; // rbx
__int64 v5; // rax
const char *CString; // r14
__int64 v7; // rax
__int64 v8; // rax
const std::string::value_type *v9; // rax
const char *data; // r15
size_t v11; // rax
size_t v12; // r12
char *v13; // r13
size_t v14; // rbx
size_t v15; // rax
size_t v16; // r15
char *v17; // r12
__int64 v18; // r13
size_t v19; // rbx
char v20; // [rsp+0h] [rbp-A0h]
char v21; // [rsp+0h] [rbp-A0h]
std::string v22; // [rsp+18h] [rbp-88h] BYREF
std::string v23; // [rsp+30h] [rbp-70h] BYREF
_QWORD __dst[2]; // [rsp+48h] [rbp-58h] BYREF
void *v25; // [rsp+58h] [rbp-48h]
__int128 v26; // [rsp+60h] [rbp-40h] BYREF
void *__p; // [rsp+70h] [rbp-30h]
v4 = a1;
v5 = sub_10088E820("message_%i", v20);
CString = (const char *)cocos2d::CCString::getCString(v5);
if ( GameLevelManager::isDLActive(a1, CString) )
return;
GameLevelManager::addDLToActive(a1, CString);
GameLevelManager::getBasePostString(&v23);
v7 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v7);
v8 = sub_10088E820("&messageID=%i&secret=%s", v21);
v9 = (const std::string::value_type *)cocos2d::CCString::getCString(v8);
std::string::append(&v23, v9);
if ( a3 )
std::string::append(&v23, "&isSender=1");
v22.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v22.__r_.__value_.__r.__words[0] = 65;
v22.__r_.__value_.__l.__size_ = 58;
strcpy(v22.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/downloadGJMessage20.php");
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
data = v23.__r_.__value_.__l.__data_;
else
data = v23.__r_.__value_.__s.__data_;
v11 = strlen(data);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
v25 = v13;
__dst[0] = v14 | 1;
__dst[1] = v12;
v4 = a1;
goto LABEL_14;
}
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( v11 )
LABEL_14:
memmove(v13, data, v12);
v13[v12] = 0;
v15 = strlen(CString);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v16 = v15;
if ( v15 >= 0x17 )
{
v18 = v4;
v19 = 26;
if ( (v15 | 7) != 0x17 )
v19 = (v15 | 7) + 1;
v17 = (char *)operator new(v19);
__p = v17;
*(_QWORD *)&v26 = v19 | 1;
*((_QWORD *)&v26 + 1) = v16;
v4 = v18;
goto LABEL_22;
}
LOBYTE(v26) = 2 * v15;
v17 = (char *)&v26 + 1;
if ( v15 )
LABEL_22:
memmove(v17, CString, v16);
v17[v16] = 0;
GameLevelManager::ProcessHttpRequest(v4, &v22, (__int64)__dst, &v26, 0x2Cu);
if ( (v26 & 1) == 0 )
{
if ( (__dst[0] & 1) == 0 )
goto LABEL_25;
LABEL_30:
operator delete(v25);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_26:
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_27;
}
goto LABEL_31;
}
operator delete(__p);
if ( (__dst[0] & 1) != 0 )
goto LABEL_30;
LABEL_25:
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_26;
LABEL_31:
operator delete(v22.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
LABEL_27:
operator delete(v23.__r_.__value_.__l.__data_);
}