//
// FRequestProfilePage::deleteSelected from 0x14013ea40 to 0x14013ecad (621 bytes)
//
// 2 xrefs:
// > FRequestProfilePage::FLAlert_Clicked @ 0x14013ecd2
// > ??> @ 0x1406ca1dc
//
// 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=5
void FRequestProfilePage::deleteSelected(FRequestProfilePage *a1)
{
std::string *p_m_key; // rbx
GameLevelManager *v3; // rcx
__int64 v4; // rcx
cocos2d::CCArray *StoredOnlineLevels; // rbx
cocos2d::CCArray *v6; // r14
int v7; // esi
cocos2d::ccArray *data; // rdi
__int64 num; // rax
struct cocos2d::CCObject **arr; // rdi
struct cocos2d::CCObject **i; // rbp
struct cocos2d::CCObject *v12; // rbx
FriendRequestDelegate *v13; // rbx
GameLevelManager *v14; // rcx
UploadActionDelegate *v15; // rax
UploadPopupDelegate *v16; // rcx
UploadActionPopup *v17; // rax
GJAccountManager *v18; // rax
int v19; // ebx
__int64 v20; // rcx
struct cocos2d::CCObject *v21; // rax
int v22; // ecx
__int128 v23; // [rsp+20h] [rbp-48h] BYREF
__int64 v24; // [rsp+30h] [rbp-38h]
__int64 v25; // [rsp+38h] [rbp-30h]
void *v26; // [rsp+70h] [rbp+8h]
void *v27; // [rsp+70h] [rbp+8h]
void *v28; // [rsp+70h] [rbp+8h]
p_m_key = &a1->m_key;
if ( a1->m_key.m_data.m_capacity > 0xF )
p_m_key = (std::string *)p_m_key->m_data.m_bigStorage;
v3 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v26 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v3 = (GameLevelManager *)qword_1406C2EC0;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v3, p_m_key->m_data.m_smallStorage._Elems);
if ( StoredOnlineLevels )
{
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v7 = 0;
data = StoredOnlineLevels->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v12 = *arr;
if ( !*arr )
break;
if ( BYTE1(v12[13].m_uIndexInArray) )
{
cocos2d::CCArray::addObject(v6, *arr);
if ( LOBYTE(v12[13].m_uIndexInArray) )
{
LOBYTE(v12[13].m_uIndexInArray) = 0;
++v7;
}
}
}
}
if ( cocos2d::CCArray::count(v6) )
{
v13 = &a1->FriendRequestDelegate;
if ( !a1 )
v13 = nullptr;
v14 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v27 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v14 = (GameLevelManager *)qword_1406C2EC0;
}
v14->m_friendRequestDelegate = v13;
v15 = &a1->UploadActionDelegate;
if ( !a1 )
v15 = nullptr;
v14->m_uploadActionDelegate = v15;
if ( GameLevelManager::deleteFriendRequests(v14, 0, v6, 0) )
{
v23 = 0;
*(_QWORD *)&v23 = sub_14003AA10(0x20u);
v24 = 20;
v25 = 31;
strcpy((char *)v23, "Deleting Requests...");
v16 = &a1->UploadPopupDelegate;
if ( !a1 )
v16 = nullptr;
v17 = (UploadActionPopup *)UploadActionPopup::create(v16, &v23);
a1->m_uploadPopup = v17;
v17->show(v17);
}
if ( v7 > 0 )
{
v18 = GJAccountManager::sharedState();
v19 = v18->m_accountID - v18->m_unkInt1;
v20 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v28 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v20 = qword_1406C2EC0;
}
v21 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v20 + 600), v19);
if ( v21 )
{
v22 = v21[13].m_uAutoReleaseCount - v7;
if ( v22 < 0 )
v22 = 0;
v21[13].m_uAutoReleaseCount = v22;
}
}
}
}
}