//
// MessagesProfilePage::onDeleteSelected from 0x8f2418 to 0x8f2660 (584 bytes)
//
// 3 xrefs:
// > ??> @ 0xc6f78
// > MessagesProfilePage::init @ 0x8f35bc
// > ??> @ 0x122eea8
//
// 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 MessagesProfilePage::onDeleteSelected(MessagesProfilePage *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
cocos2d::CCArray *StoredOnlineLevels; // x0
cocos2d::ccArray *data; // x0
unsigned int num; // w1
FLAlertLayer *v7; // x20
void *v8; // x0
cocos2d::CCObject **arr; // x0
cocos2d::CCObject **v10; // x2
void *v11; // x0
unsigned int *v12; // x2
int v13; // w1
unsigned int *v14; // x2
int v15; // w1
__int64 v16; // [xsp+40h] [xbp+40h] BYREF
v3 = GameLevelManager::sharedState();
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v3, (const char *)a1->m_messageKey.m_data.m_data);
if ( StoredOnlineLevels )
{
data = StoredOnlineLevels->data;
num = data->num;
if ( data->num )
{
arr = data->arr;
v10 = &arr[num - 1];
if ( arr <= v10 )
{
while ( *arr )
{
if ( BYTE2((*arr)[6].m_uAutoReleaseCount) )
{
sub_D153B8((int)&v16, "Are you sure you want to delete the selected messages?");
v7 = FLAlertLayer::create((int)a1 + 632, (__int64)"Delete", (__int64)&v16);
v11 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v16 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v11);
}
ButtonSprite::updateBGImage(v7->m_button2, "GJ_button_06.png");
v7->setTag(v7, 1);
goto LABEL_4;
}
if ( v10 < ++arr )
break;
}
}
}
}
sub_D153B8((int)&v16, "No messages selected.");
v7 = FLAlertLayer::create(0, (__int64)"Nothing here...", (__int64)&v16);
v8 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v16 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v8);
}
LABEL_4:
v7->show(v7);
}