//
// GameLevelManager::deleteUserMessages from 0x10054eec0 to 0x10054f2cd (1037 bytes)
//
// 3 xrefs:
// > MessagesProfilePage::deleteSelected @ 0x10022ee4e
// > GJMessageCell::FLAlert_Clicked @ 0x100258977
// > GJMessagePopup::FLAlert_Clicked @ 0x1002a8b30
//
// 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
//
bool __fastcall GameLevelManager::deleteUserMessages(
GameLevelManager *a1,
GJUserMessage *a2,
cocos2d::CCArray *a3,
bool a4)
{
__m128 v4; // xmm0
cocos2d::CCArray *v7; // r14
cocos2d::CCString *v8; // rax
const char *CString; // rax
bool v10; // bl
__int64 m_friendReqAndUserBlocks; // rbx
cocos2d::CCNode *v13; // rax
cocos2d::CCString *v14; // rax
cocos2d::CCString *v15; // rax
const char *v16; // rax
cocos2d::CCString *v17; // rax
const char *v18; // rax
const char *data; // rbx
size_t v20; // rax
size_t v21; // r14
char *v22; // r15
size_t v23; // r12
cocos2d::CCString *v24; // rax
const char *v25; // rax
unsigned int i; // r15d
cocos2d::CCString *v27; // rax
const char *v28; // rax
char v29; // [rsp+0h] [rbp-B0h]
char v30; // [rsp+0h] [rbp-B0h]
char v31; // [rsp+0h] [rbp-B0h]
char v32; // [rsp+0h] [rbp-B0h]
std::string v33; // [rsp+8h] [rbp-A8h] BYREF
__int128 v34; // [rsp+20h] [rbp-90h] BYREF
void *__p; // [rsp+30h] [rbp-80h]
_QWORD __dst[2]; // [rsp+38h] [rbp-78h] BYREF
void *v37; // [rsp+48h] [rbp-68h]
GameLevelManager *v38; // [rsp+50h] [rbp-60h]
std::string v39; // [rsp+58h] [rbp-58h] BYREF
std::string v40; // [rsp+70h] [rbp-40h] BYREF
v38 = a1;
*(_WORD *)&v39.__r_.__value_.__l.0 = 0;
if ( a3 )
{
v7 = a3;
if ( (unsigned int)sub_100720070(a3) != 1 )
goto LABEL_5;
a2 = (GJUserMessage *)sub_1007200C0(v7, 0);
}
v7 = nullptr;
LABEL_5:
if ( a2 || v7 )
{
v8 = (cocos2d::CCString *)sub_1007AB580("delMsg_%i_%i", v29);
CString = cocos2d::CCString::getCString(v8);
std::string::assign(&v39, CString);
if ( !cocos2d::CCDictionary::objectForKey_1((__int64)v38->m_friendReqAndUserBlocks, (char *)&v39) )
{
m_friendReqAndUserBlocks = (__int64)v38->m_friendReqAndUserBlocks;
v13 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject_1(m_friendReqAndUserBlocks, v13, (char *)&v39);
GameLevelManager::getBasePostString(&v40, v4);
v14 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v14);
v15 = (cocos2d::CCString *)sub_1007AB580("&secret=%s", v30);
v16 = cocos2d::CCString::getCString(v15);
std::string::append(&v40, v16);
if ( a4 )
std::string::append(&v40, "&isSender=1");
if ( a2 )
{
std::string::append(&v40, "&messageID=");
v17 = (cocos2d::CCString *)sub_1007AB580("%i", v31);
v18 = cocos2d::CCString::getCString(v17);
std::string::append(&v40, v18);
}
else
{
std::string::append(&v40, "&messages=");
if ( (unsigned int)sub_100720070(v7) )
{
sub_1007200C0(v7, 0);
v24 = (cocos2d::CCString *)sub_1007AB580("%i", v31);
v25 = cocos2d::CCString::getCString(v24);
std::string::append(&v40, v25);
for ( i = 1; i < (unsigned int)sub_100720070(v7); ++i )
{
sub_1007200C0(v7, i);
std::string::append(&v40, ",");
v27 = (cocos2d::CCString *)sub_1007AB580("%i", v32);
v28 = cocos2d::CCString::getCString(v27);
std::string::append(&v40, v28);
}
}
}
v33.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v33.__r_.__value_.__r.__words[0] = 65;
v33.__r_.__value_.__l.__size_ = 57;
strcpy(v33.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/deleteGJMessages20.php");
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
data = v40.__r_.__value_.__l.__data_;
else
data = v40.__r_.__value_.__s.__data_;
v20 = strlen(data);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.057594829120962e-81);
v21 = v20;
if ( v20 >= 0x17 )
{
v23 = 26;
if ( (v20 | 7) != 0x17 )
v23 = (v20 | 7) + 1;
v22 = (char *)operator new(v23);
v37 = v22;
__dst[0] = v23 | 1;
__dst[1] = v21;
}
else
{
LOBYTE(__dst[0]) = 2 * v20;
v22 = (char *)__dst + 1;
if ( !v20 )
{
BYTE1(__dst[0]) = 0;
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_22:
__p = v39.__r_.__value_.__l.__data_;
v34 = *(_OWORD *)&v39.__r_.__value_.__l.0;
goto LABEL_28;
}
LABEL_27:
sub_100006B70(&v34, v39.__r_.__value_.__l.__data_, v39.__r_.__value_.__l.__size_, 2.057594829120962e-81);
LABEL_28:
GameLevelManager::ProcessHttpRequest(v38, &v33, (__int64)__dst, (__int64)&v34, 39);
if ( (v34 & 1) != 0 )
{
operator delete(__p);
if ( (__dst[0] & 1) == 0 )
{
LABEL_30:
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_31;
goto LABEL_37;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_30;
}
operator delete(v37);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_31:
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_33;
goto LABEL_32;
}
LABEL_37:
operator delete(v33.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_33:
v10 = 1;
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) == 0 )
return v10;
goto LABEL_9;
}
LABEL_32:
operator delete(v40.__r_.__value_.__l.__data_);
goto LABEL_33;
}
}
memmove(v22, data, v21);
v22[v21] = 0;
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_22;
goto LABEL_27;
}
}
v10 = 0;
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) != 0 )
LABEL_9:
operator delete(v39.__r_.__value_.__l.__data_);
return v10;
}