//
// FRequestProfilePage::deleteSelected from 0x8f4b5c to 0x8f4d8c (560 bytes)
//
// 2 xrefs:
// > FRequestProfilePage::FLAlert_Clicked @ 0x8f4dd4
// > ??> @ 0x84ff0
//
// 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
//
void FRequestProfilePage::deleteSelected(FRequestProfilePage *a1)
{
GameLevelManager *v2; // x0
cocos2d::CCArray *StoredOnlineLevels; // x0
cocos2d::CCArray *v4; // x19
cocos2d::CCArray *v5; // x23
cocos2d::ccArray *data; // x1
int v7; // w25
cocos2d::CCObject **arr; // x19
cocos2d::CCObject **i; // x21
cocos2d::CCObject *v10; // x20
GameLevelManager *v11; // x0
GameLevelManager *v12; // x19
GJAccountManager *v13; // x0
GJUserScore *v14; // x0
int v15; // w1
UploadActionPopup *m_uploadPopup; // x0
void *v17; // x3
unsigned int *v18; // x2
int v19; // w0
__int64 v20; // [xsp+60h] [xbp+60h] BYREF
v2 = GameLevelManager::sharedState();
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v2, (const char *)a1->m_key.m_data.m_data);
v4 = StoredOnlineLevels;
if ( StoredOnlineLevels )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(StoredOnlineLevels);
data = v4->data;
v7 = 0;
if ( data->num )
{
arr = data->arr;
for ( i = &arr[data->num - 1]; i >= arr; ++arr )
{
v10 = *arr;
if ( !*arr )
break;
if ( BYTE1(v10[9].m_unknown2) )
{
cocos2d::CCArray::addObject(v5, *arr);
if ( LOBYTE(v10[9].m_unknown2) )
{
LOBYTE(v10[9].m_unknown2) = 0;
++v7;
}
}
}
}
if ( (unsigned int)cocos2d::CCArray::count(v5) )
{
GameLevelManager::sharedState()->m_friendRequestDelegate = &a1->FriendRequestDelegate;
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v11 = GameLevelManager::sharedState();
if ( GameLevelManager::deleteFriendRequests(v11, 0, v5, 0) )
{
sub_D153B8((int)&v20, "Deleting Requests...");
m_uploadPopup = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate);
a1->m_uploadPopup = m_uploadPopup;
v17 = (void *)(v20 - 24);
if ( (__int64 *)(v20 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v20 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v20 - 8);
*(_DWORD *)(v20 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v17);
m_uploadPopup = a1->m_uploadPopup;
}
m_uploadPopup->show(m_uploadPopup);
if ( !v7 )
return;
}
else if ( !v7 )
{
return;
}
v12 = GameLevelManager::sharedState();
v13 = GJAccountManager::sharedState();
v14 = GameLevelManager::userInfoForAccountID(v12, v13->m_accountID - v13->m_unkInt1);
if ( v14 )
{
v15 = v14->m_friendReqCount - v7;
if ( v15 < 0 )
v15 = 0;
v14->m_friendReqCount = v15;
}
}
}
}