//
// GameLevelManager::deleteUserMessages from 0x7231fc to 0x723778 (1404 bytes)
//
// 4 xrefs:
// > GJMessageCell::FLAlert_Clicked @ 0x61d918
// > GJMessagePopup::FLAlert_Clicked @ 0x8cf188
// > MessagesProfilePage::deleteSelected @ 0x8f275c
// > ??> @ 0x340b0
//
// 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 GameLevelManager::deleteUserMessages(GameLevelManager *a1, GJUserMessage *a2, cocos2d::CCArray *a3, bool a4)
{
_BOOL4 v6; // w25
const char *v8; // x0
size_t v9; // x0
bool v10; // w21
char *v11; // x0
unsigned int *v13; // x1
int v14; // w2
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x26
cocos2d::CCNode *v16; // x0
cocos2d::CCString *v17; // x0
const char *CString; // x0
cocos2d::CCString *v19; // x0
size_t v20; // x0
cocos2d::CCString *v21; // x0
size_t v22; // x0
int *p_m_unknown2; // x0
char *v24; // x0
char *v25; // x0
char *v26; // x0
unsigned int *v27; // x1
int v28; // w2
unsigned int i; // w23
__int64 v30; // x28
cocos2d::CCString *v31; // x0
size_t v32; // x0
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
const char *v39; // [xsp+68h] [xbp+68h]
const char *v40; // [xsp+68h] [xbp+68h]
const char *v41; // [xsp+68h] [xbp+68h]
const char *v42; // [xsp+68h] [xbp+68h]
std::string v43; // [xsp+90h] [xbp+90h] BYREF
char *v44; // [xsp+98h] [xbp+98h] BYREF
const char *v45; // [xsp+A0h] [xbp+A0h] BYREF
const char *v46; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::extension::CCHttpClient *v47; // [xsp+B0h] [xbp+B0h] BYREF
v6 = a4;
sub_D153B8((int)&v43, &byte_F288A0);
if ( !a3 )
{
if ( !a2 )
goto LABEL_6;
goto LABEL_4;
}
if ( (unsigned int)cocos2d::CCArray::count(a3) == 1 )
{
a2 = (GJUserMessage *)cocos2d::CCArray::objectAtIndex(a3, 0);
a3 = nullptr;
if ( !a2 )
goto LABEL_6;
goto LABEL_4;
}
if ( a2 )
{
LABEL_4:
v8 = GameLevelManager::getDeleteMessageKey(a1, a2->m_messageID, v6);
goto LABEL_5;
}
v8 = GameLevelManager::getDeleteMessageKey(a1, -1, v6);
LABEL_5:
v39 = v8;
v9 = strlen(v8);
sub_D1798C(&v43, v39, v9);
if ( cocos2d::CCDictionary::objectForKey(a1->m_friendReqAndUserBlocks, &v43) )
{
LABEL_6:
v10 = 0;
goto LABEL_7;
}
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
v16 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject((int)m_friendReqAndUserBlocks, v16);
GameLevelManager::getBasePostString(a1, (__int64)&v44);
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
CString = cocos2d::CCString::getCString(v17);
v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&secret=%s", CString);
v40 = cocos2d::CCString::getCString(v19);
v20 = strlen(v40);
sub_D15FD4(&v44, v40, v20);
if ( v6 )
sub_D15FD4(&v44, "&isSender=1", 11);
if ( a2 )
{
sub_D15FD4(&v44, "&messageID=", 11);
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a2->m_messageID);
v41 = cocos2d::CCString::getCString(v21);
v22 = strlen(v41);
sub_D15FD4(&v44, v41, v22);
}
else
{
sub_D15FD4(&v44, "&messages=", 10);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(a3); ++i )
{
v30 = cocos2d::CCArray::objectAtIndex(a3, i);
if ( i )
sub_D15FD4(&v44, &byte_F804F8, 1);
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)*(unsigned int *)(v30 + 316));
v42 = cocos2d::CCString::getCString(v31);
v32 = strlen(v42);
sub_D15FD4(&v44, v42, v32);
}
}
sub_D153B8((int)&v45, "https://www.boomlings.com/database/deleteGJMessages20.php");
sub_D153B8((int)&v46, v44);
sub_D18D28(&v47);
GameLevelManager::ProcessHttpRequest(a1, &v45, &v46, &v47, 39);
p_m_unknown2 = &v47[-1].m_unknown2;
if ( &v47[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v47[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v47[-1]._timeoutForConnect;
v47[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v24 = (char *)(v46 - 24);
if ( v46 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v46 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v46 - 2);
*((_DWORD *)v46 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v24);
}
v25 = (char *)(v45 - 24);
if ( v45 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v45 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v45 - 2);
*((_DWORD *)v45 - 2) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v25);
}
v26 = v44 - 24;
if ( v44 - 24 == (char *)&qword_124B6B0 )
goto LABEL_27;
if ( &pthread_create )
{
v27 = (unsigned int *)(v44 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v44 - 2);
*((_DWORD *)v44 - 2) = v28 - 1;
}
if ( v28 > 0 )
{
LABEL_27:
v10 = 1;
}
else
{
v10 = 1;
operator delete(v26);
}
LABEL_7:
v11 = (char *)v43.m_data.m_data - 24;
if ( (__int64 *)v43.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)((char *)v43.m_data.m_data - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v43.m_data.m_data - 2);
*((_DWORD *)v43.m_data.m_data - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v11);
}
return v10;
}