//
// LevelBrowserLayer::FLAlert_Clicked from 0x7fc470 to 0x7fc978 (1288 bytes)
//
// 4 xrefs:
// > `non-virtual thunk to'LevelBrowserLayer::FLAlert_Clicked @ 0x7fc97c
// > LevelListLayer::FLAlert_Clicked @ 0xbb0f94
// > ??> @ 0x7f090
// > ??> @ 0x143e8d8
//
// This function is hookable on this platform (idp: arm, 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:54:41 +0000
//
__int64 __fastcall LevelBrowserLayer::FLAlert_Clicked(LevelBrowserLayer *this, FLAlertLayer *a2, unsigned __int8 a3)
{
int v4; // w21
GameLevelManager *v5; // x0
cocos2d::CCObject *v6; // x22
GameLevelManager *v8; // x0
__int64 v9; // x1
int v10; // w2
cocos2d::CCArray *SavedLevels; // x22
__int64 v12; // x0
__int64 v13; // x1
_BOOL4 v14; // w23
__int64 v15; // x3
__int64 v16; // x1
unsigned int v17; // w21
MusicDownloadManager *v18; // x0
__int64 v19; // x1
GameLevelManager *v20; // x0
GameLevelManager *v21; // x0
__int64 v22; // x1
int v23; // w2
cocos2d::CCArray *ItemsMatchingSearch; // x22
__int64 v25; // x0
__int64 v26; // x1
_BOOL4 v27; // w23
__int64 v28; // x3
__int64 v29; // x1
unsigned int i; // w21
unsigned int v31; // w1
__int64 v32; // x0
GameLevelManager *v33; // x0
MusicDownloadManager *v34; // x0
GameLevelManager *v35; // x0
__int64 v36; // x1
unsigned int v37; // w21
cocos2d::CCArray *SavedLevelLists; // x22
unsigned int v39; // w1
GameLevelManager *v40; // x0
cocos2d::CCDirector *v41; // x0
cocos2d::CCDirector *v42; // x21
GJSearchObject *v43; // x1
AppDelegate *v44; // x0
cocos2d::CCScene *v45; // x1
cocos2d::CCScene *v46; // x0
GameStatsManager *v47; // x0
FMODAudioEngine *v48; // x0
__int64 v49; // x23
LevelCell *v50; // x0
GJGameLevel *v51; // [xsp+48h] [xbp+48h]
GJLevelList *v52; // [xsp+48h] [xbp+48h]
__int64 v53; // [xsp+50h] [xbp+50h] BYREF
__int64 v54; // [xsp+58h] [xbp+58h]
void *v55; // [xsp+60h] [xbp+60h]
v4 = a3;
v5 = (GameLevelManager *)((*(unsigned int (__fastcall **)(FLAlertLayer *))(*(_QWORD *)a2 + 64LL))(a2) - 1);
switch ( (int)v5 )
{
case 0:
if ( v4 )
{
v8 = (GameLevelManager *)GameLevelManager::sharedState(v5);
v9 = *((_QWORD *)this + 83);
if ( v9 )
v10 = *(_DWORD *)(v9 + 420);
else
v10 = 0;
SavedLevels = (cocos2d::CCArray *)GameLevelManager::getSavedLevels(v8, 0, v10);
v12 = *((_QWORD *)this + 83);
if ( v12 )
{
v53 = 0;
v54 = 0;
v55 = nullptr;
if ( (*(_BYTE *)(v12 + 320) & 1) != 0 )
{
std::string::__init(&v53, *(void **)(v12 + 336), *(_QWORD *)(v12 + 328));
}
else
{
v13 = *(_QWORD *)(v12 + 328);
v53 = *(_QWORD *)(v12 + 320);
v54 = v13;
v55 = *(void **)(v12 + 336);
}
if ( (v53 & 1) != 0 )
{
v14 = v54 != 0;
operator delete(v55);
}
else
{
v14 = (int)(unsigned __int8)v53 >> 1 != 0;
}
if ( v14 )
{
v15 = *((_QWORD *)this + 83);
v53 = 0;
v54 = 0;
v55 = nullptr;
if ( (*(_BYTE *)(v15 + 320) & 1) != 0 )
{
std::string::__init(&v53, *(void **)(v15 + 336), *(_QWORD *)(v15 + 328));
}
else
{
v16 = *(_QWORD *)(v15 + 328);
v53 = *(_QWORD *)(v15 + 320);
v54 = v16;
v55 = *(void **)(v15 + 336);
}
SavedLevels = LevelBrowserLayer::getItemsMatchingSearch((__int64)this, (__int64)SavedLevels, (char *)&v53);
if ( (v53 & 1) != 0 )
operator delete(v55);
}
}
v17 = 0;
while ( 1 )
{
v18 = (MusicDownloadManager *)cocos2d::CCArray::count(SavedLevels);
if ( v17 >= (unsigned int)v18 )
break;
v19 = cocos2d::CCArray::objectAtIndex(SavedLevels, v17);
if ( *(_BYTE *)(v19 + 912) )
{
++v17;
}
else
{
v51 = (GJGameLevel *)v19;
v33 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)*(unsigned __int8 *)(v19 + 912));
++v17;
GameLevelManager::deleteLevel(v33, v51);
}
}
v34 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v18);
MusicDownloadManager::clearUnusedSongs(v34);
goto LABEL_41;
}
break;
case 1:
if ( v4 )
{
v20 = *((GameLevelManager **)this + 83);
if ( v20 && (v20 = (GameLevelManager *)*((unsigned int *)v20 + 79), (_DWORD)v20 == 103) )
{
v35 = (GameLevelManager *)GameLevelManager::sharedState(v20);
v36 = *((_QWORD *)this + 83);
if ( v36 )
LODWORD(v36) = *(_DWORD *)(v36 + 420);
v37 = 0;
SavedLevelLists = (cocos2d::CCArray *)GameLevelManager::getSavedLevelLists(v35, v36);
while ( v37 < (unsigned int)cocos2d::CCArray::count(SavedLevelLists) )
{
v39 = v37++;
v52 = (GJLevelList *)cocos2d::CCArray::objectAtIndex(SavedLevelLists, v39);
v40 = (GameLevelManager *)GameLevelManager::sharedState(v52);
GameLevelManager::deleteLevelList(v40, v52);
}
(*(void (__fastcall **)(LevelBrowserLayer *, _QWORD))(*(_QWORD *)this + 1072LL))(this, 0);
v41 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(LevelBrowserLayer *, _QWORD))(*(_QWORD *)this + 1088LL))(
this,
0);
v42 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v41);
v44 = LevelBrowserLayer::scene(*((LevelBrowserLayer **)this + 83), v43);
v46 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v44, 0.5, v45);
cocos2d::CCDirector::replaceScene(v42, v46);
}
else
{
v21 = (GameLevelManager *)GameLevelManager::sharedState(v20);
v22 = *((_QWORD *)this + 83);
v23 = 0;
if ( v22 )
v23 = *(_DWORD *)(v22 + 420);
ItemsMatchingSearch = (cocos2d::CCArray *)GameLevelManager::getSavedLevels(v21, 1, v23);
v25 = *((_QWORD *)this + 83);
if ( v25 )
{
v53 = 0;
v54 = 0;
v55 = nullptr;
if ( (*(_BYTE *)(v25 + 320) & 1) != 0 )
{
std::string::__init(&v53, *(void **)(v25 + 336), *(_QWORD *)(v25 + 328));
}
else
{
v26 = *(_QWORD *)(v25 + 328);
v53 = *(_QWORD *)(v25 + 320);
v54 = v26;
v55 = *(void **)(v25 + 336);
}
if ( (v53 & 1) != 0 )
{
v27 = v54 != 0;
operator delete(v55);
}
else
{
v27 = (int)(unsigned __int8)v53 >> 1 != 0;
}
if ( v27 )
{
v28 = *((_QWORD *)this + 83);
v53 = 0;
v54 = 0;
v55 = nullptr;
if ( (*(_BYTE *)(v28 + 320) & 1) != 0 )
{
std::string::__init(&v53, *(void **)(v28 + 336), *(_QWORD *)(v28 + 328));
}
else
{
v29 = *(_QWORD *)(v28 + 328);
v53 = *(_QWORD *)(v28 + 320);
v54 = v29;
v55 = *(void **)(v28 + 336);
}
ItemsMatchingSearch = LevelBrowserLayer::getItemsMatchingSearch(
(__int64)this,
(__int64)ItemsMatchingSearch,
(char *)&v53);
if ( (v53 & 1) != 0 )
operator delete(v55);
}
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(ItemsMatchingSearch); ++i )
{
v31 = i;
*(_BYTE *)(cocos2d::CCArray::objectAtIndex(ItemsMatchingSearch, v31) + 912) = 0;
}
LABEL_41:
(*(void (__fastcall **)(LevelBrowserLayer *, _QWORD))(*(_QWORD *)this + 1072LL))(this, 0);
(*(void (__fastcall **)(LevelBrowserLayer *, _QWORD))(*(_QWORD *)this + 1088LL))(this, 0);
LevelBrowserLayer::onSaved(this, nullptr);
}
}
break;
case 4:
if ( v4 )
LevelBrowserLayer::deleteSelected(this);
break;
case 5:
if ( v4 )
{
v32 = cocos2d::CCApplication::sharedApplication(v5);
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v32 + 104LL))(
v32,
"https://www.boomlings.com/GDRating");
}
break;
case 6:
v6 = *((cocos2d::CCObject **)this + 104);
if ( v6 )
{
if ( v4 )
{
v47 = (GameStatsManager *)GameStatsManager::sharedState(v5);
v48 = (FMODAudioEngine *)(unsigned __int8)GameStatsManager::unlockDailyRecall(
v47,
*((_DWORD *)v6 + 230) - *((_DWORD *)v6 + 231));
if ( (_BYTE)v48 )
{
v49 = FMODAudioEngine::sharedEngine(v48);
v53 = 0;
v54 = 0;
v55 = nullptr;
std::string::__init(&v53, "buyItem03.ogg", 0xDu);
FMODAudioEngine::playEffect(v49, (char *)&v53);
if ( (v53 & 1) != 0 )
operator delete(v55);
v50 = (LevelCell *)LevelBrowserLayer::recallCell(this, *((_DWORD *)v6 + 230) - *((_DWORD *)v6 + 231));
if ( v50 )
LevelCell::playRecallUnlock(v50);
else
LevelBrowserLayer::reloadPageRows(this);
}
}
*((_QWORD *)this + 104) = 0;
cocos2d::CCObject::release(v6);
}
break;
default:
return _stack_chk_guard;
}
return _stack_chk_guard;
}