//
// MessagesProfilePage::deleteSelected from 0x1002132a0 to 0x100213473 (467 bytes)
//
// 2 xrefs:
// > MessagesProfilePage::FLAlert_Clicked @ 0x1002134b4
// > sub_1002134C0 @ 0x1002134eb
//
// 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:26:59 +0000
//
_QWORD *__fastcall MessagesProfilePage::deleteSelected(__int64 a1, double a2)
{
__int64 v3; // rax
__int64 v4; // rsi
__int64 v5; // rdi
_QWORD *result; // rax
__int64 v7; // rsi
_QWORD *v8; // r15
__int64 v9; // r14
unsigned int *v10; // rax
_QWORD *v11; // r13
_QWORD *v12; // rbx
int v13; // r12d
__int64 v14; // r15
__int64 v15; // rdi
void **v16; // rsi
__int64 v17; // rax
__int64 v18; // r14
__int64 v19; // rax
__int64 v20; // rax
int v21; // edx
__int64 v22; // [rsp+8h] [rbp-48h]
void *v23[8]; // [rsp+10h] [rbp-40h] BYREF
v3 = GameLevelManager::sharedState(a2);
if ( (*(_BYTE *)(a1 + 704) & 1) != 0 )
{
v7 = *(_QWORD *)(a1 + 720);
v5 = v3;
result = (_QWORD *)GameLevelManager::getStoredOnlineLevels(v3, v7);
if ( !result )
return result;
}
else
{
v4 = a1 + 705;
v5 = v3;
result = (_QWORD *)GameLevelManager::getStoredOnlineLevels(v3, v4);
if ( !result )
return result;
}
v8 = result;
v22 = a1;
v9 = sub_1007FE900(v5);
v10 = (unsigned int *)v8[7];
if ( *v10 )
{
v11 = *((_QWORD **)v10 + 2);
v12 = &v11[*v10 - 1];
v13 = 0;
do
{
v14 = *v11;
if ( !*v11 )
break;
if ( *(_BYTE *)(v14 + 426) == 1 )
{
sub_1007FEBF0(v9, *v11);
if ( !*(_BYTE *)(v14 + 424) )
{
*(_BYTE *)(v14 + 424) = 1;
++v13;
}
}
++v11;
}
while ( v11 <= v12 );
}
else
{
v13 = 0;
}
result = (_QWORD *)sub_1007FEF90(v9);
if ( (_DWORD)result )
{
*(_QWORD *)(GameLevelManager::sharedState(a2) + 1384) = v22 + 688;
*(_QWORD *)(GameLevelManager::sharedState(a2) + 1360) = v22 + 672;
v15 = GameLevelManager::sharedState(a2);
v16 = nullptr;
if ( (unsigned __int8)GameLevelManager::deleteUserMessages(v15, 0, v9, *(unsigned __int8 *)(v22 + 696)) )
{
strcpy((char *)v23, "(Deleting Messages...");
a2 = *(double *)"Deleting Messages...";
v16 = v23;
v17 = UploadActionPopup::create(v22 + 680, v23);
*(_QWORD *)(v22 + 760) = v17;
if ( ((__int64)v23[0] & 1) != 0 )
{
operator delete(v23[2]);
v17 = *(_QWORD *)(v22 + 760);
}
v15 = v17;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1312LL))(v17);
}
if ( v13 > 0 )
{
v18 = GameLevelManager::sharedState(a2);
v19 = GJAccountManager::sharedState(v15, (__int64)v16);
v20 = GameLevelManager::userInfoForAccountID(v18, (unsigned int)(*(_DWORD *)(v19 + 352) - *(_DWORD *)(v19 + 356)));
if ( v20 )
{
v21 = 0;
if ( *(_DWORD *)(v20 + 692) - v13 > 0 )
v21 = *(_DWORD *)(v20 + 692) - v13;
*(_DWORD *)(v20 + 692) = v21;
}
}
return sub_100212C00(v22, a2);
}
return result;
}