//
// LevelBrowserLayer::FLAlert_Clicked from 0x1402cf6d0 to 0x1402cfc82 (1458 bytes)
//
// 3 xrefs:
// > LevelListLayer::FLAlert_Clicked @ 0x1403075a0
// > ??> @ 0x140584d20
// > ??> @ 0x1406d2e34
//
// 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=6
void LevelBrowserLayer::FLAlert_Clicked(LevelBrowserLayer *a1, FLAlertLayer *a2, bool a3)
{
unsigned int v5; // ebx
char v6; // r14
int v7; // eax
__int64 v8; // rdx
__int64 v9; // rcx
int v10; // eax
int v11; // eax
__int64 v12; // rax
LevelBrowserLayer *v13; // rbp
cocos2d::CCArray *v14; // rdi
cocos2d::CCArray *m_levels; // rax
cocos2d::ccArray *data; // rbx
__int64 num; // rax
cocos2d::CCObject **arr; // rbx
cocos2d::CCObject **i; // rsi
cocos2d::CCObject *v20; // rdx
cocos2d::ccArray *v21; // rbx
__int64 v22; // rax
GJGameLevel **v23; // rbx
GJGameLevel **j; // rsi
GJGameLevel *v25; // rdi
GameLevelManager *v26; // rcx
__int64 v27; // rax
int v28; // edi
GameLevelManager *v29; // rcx
cocos2d::CCArray *SavedLevelLists; // rdi
GJLevelList *v31; // rsi
GameLevelManager *v32; // rcx
GJSearchObject *v33; // rbx
__int64 v34; // rcx
struct cocos2d::CCScene *v35; // rdi
__int64 v36; // rdx
__int64 v37; // rcx
LevelBrowserLayer *v38; // rax
struct cocos2d::CCTransitionFade *v39; // rbx
__int64 v40; // rcx
cocos2d::CCDirector *v41; // rax
GameLevelManager *v42; // rcx
cocos2d::CCArray *ItemsMatchingSearch; // rdi
__int64 v44; // rdx
bool v45; // si
__int64 v46; // rax
int v47; // edi
GameLevelManager *v48; // rcx
cocos2d::CCArray *SavedLevels; // rsi
__int64 v50; // rdx
bool v51; // di
GJGameLevel *v52; // rdi
GameLevelManager *v53; // rcx
MusicDownloadManager *v54; // rax
void *v55; // [rsp+20h] [rbp-48h]
void *v56; // [rsp+20h] [rbp-48h]
void *v57; // [rsp+20h] [rbp-48h]
void *v58; // [rsp+20h] [rbp-48h]
void *v59; // [rsp+20h] [rbp-48h]
void *v60; // [rsp+20h] [rbp-48h]
__int128 v61; // [rsp+28h] [rbp-40h] BYREF
__int64 v62; // [rsp+38h] [rbp-30h]
v5 = 0;
v6 = 0;
v7 = ((__int64 (__fastcall *)(FLAlertLayer *))a2->getTag)(a2) - 1;
if ( !v7 )
{
if ( !a3 )
return;
v46 = *(_QWORD *)&a1->m_obContentSize.height;
if ( v46 )
v47 = *(_DWORD *)(v46 + 452);
else
v47 = 0;
v48 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v59 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v59);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v48 = (GameLevelManager *)qword_1406C2EC0;
}
SavedLevels = GameLevelManager::getSavedLevels(v48, 0, v47);
v50 = *(_QWORD *)&a1->m_obContentSize.height;
v51 = false;
if ( v50 )
{
sub_14003BDB0((__int64)&v61, v50 + 328);
v6 = 9;
if ( v62 )
v51 = true;
}
if ( (v6 & 1) != 0 )
sub_14003A830((__int64)&v61);
if ( v51 )
{
sub_14003BDB0((__int64)&v61, *(_QWORD *)&a1->m_obContentSize.height + 328LL);
SavedLevels = LevelBrowserLayer::getItemsMatchingSearch(
(__int64)&a1[-1].m_eGLServerState,
(__int64)SavedLevels,
&v61);
}
if ( cocos2d::CCArray::count(SavedLevels) )
{
do
{
v52 = (GJGameLevel *)cocos2d::CCArray::objectAtIndex(SavedLevels, v5);
if ( !v52->m_levelFavorited )
{
v53 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v60 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v60);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v53 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::deleteLevel(v53, v52);
}
++v5;
}
while ( v5 < cocos2d::CCArray::count(SavedLevels) );
}
v54 = MusicDownloadManager::sharedState();
MusicDownloadManager::clearUnusedSongs(v54);
goto LABEL_70;
}
v10 = v7 - 1;
if ( v10 )
{
v11 = v10 - 3;
if ( v11 )
{
if ( v11 == 1 && a3 )
{
v12 = cocos2d::CCApplication::sharedApplication(v9, v8);
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v12 + 88LL))(
v12,
"https://www.boomlings.com/GDRating");
}
}
else if ( a3 )
{
v13 = (LevelBrowserLayer *)((char *)a1 - 552);
if ( v13->m_levels )
{
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
m_levels = v13->m_levels;
if ( m_levels )
{
data = m_levels->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v20 = *arr;
if ( !*arr )
break;
if ( HIBYTE(v20[12].m_unknown5) )
cocos2d::CCArray::addObject(v14, v20);
}
}
}
if ( cocos2d::CCArray::count(v14) )
{
if ( v14 )
{
v21 = v14->data;
v22 = v21->num;
if ( (_DWORD)v22 )
{
v23 = (GJGameLevel **)v21->arr;
for ( j = &v23[v22 - 1]; v23 <= j; ++v23 )
{
v25 = *v23;
if ( !*v23 )
break;
v26 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v55 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v26 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::deleteLevel(v26, v25);
}
}
}
v13->m_allSelected = 0;
CCMenuItemToggler::toggle(v13->m_allObjectsToggler, 0);
LevelBrowserLayer::loadPage(v13, v13->m_searchObject);
}
}
}
return;
}
if ( !a3 )
return;
v27 = *(_QWORD *)&a1->m_obContentSize.height;
if ( !v27 )
{
v28 = 0;
goto LABEL_36;
}
v28 = *(_DWORD *)(v27 + 452);
if ( *(_DWORD *)(v27 + 320) != 103 )
{
LABEL_36:
v42 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v58 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v58);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v42 = (GameLevelManager *)qword_1406C2EC0;
}
ItemsMatchingSearch = GameLevelManager::getSavedLevels(v42, 1, v28);
v44 = *(_QWORD *)&a1->m_obContentSize.height;
v45 = false;
if ( v44 )
{
sub_14003BDB0((__int64)&v61, v44 + 328);
v6 = 18;
if ( v62 )
v45 = true;
}
if ( (v6 & 2) != 0 )
sub_14003A830((__int64)&v61);
if ( v45 )
{
sub_14003BDB0((__int64)&v61, *(_QWORD *)&a1->m_obContentSize.height + 328LL);
ItemsMatchingSearch = LevelBrowserLayer::getItemsMatchingSearch(
(__int64)&a1[-1].m_eGLServerState,
(__int64)ItemsMatchingSearch,
&v61);
}
if ( cocos2d::CCArray::count(ItemsMatchingSearch) )
{
do
LOBYTE(cocos2d::CCArray::objectAtIndex(ItemsMatchingSearch, v5++)[15].m_eObjType) = 0;
while ( v5 < cocos2d::CCArray::count(ItemsMatchingSearch) );
}
LABEL_70:
(*(void (__fastcall **)(cocos2d::ccGLServerState *, _QWORD))(*(_QWORD *)&a1[-1].m_eGLServerState + 976LL))(
&a1[-1].m_eGLServerState,
0);
(*(void (__fastcall **)(cocos2d::ccGLServerState *, _QWORD))(*(_QWORD *)&a1[-1].m_eGLServerState + 992LL))(
&a1[-1].m_eGLServerState,
0);
LevelBrowserLayer::onSaved((LevelBrowserLayer *)((char *)a1 - 552), nullptr);
return;
}
v29 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v56 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v56);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v29 = (GameLevelManager *)qword_1406C2EC0;
}
SavedLevelLists = GameLevelManager::getSavedLevelLists(v29, v28);
if ( cocos2d::CCArray::count(SavedLevelLists) )
{
do
{
v31 = (GJLevelList *)cocos2d::CCArray::objectAtIndex(SavedLevelLists, v5);
v32 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v57 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v57);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v32 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::deleteLevelList(v32, v31);
++v5;
}
while ( v5 < cocos2d::CCArray::count(SavedLevelLists) );
}
(*(void (__fastcall **)(cocos2d::ccGLServerState *, _QWORD))(*(_QWORD *)&a1[-1].m_eGLServerState + 976LL))(
&a1[-1].m_eGLServerState,
0);
(*(void (__fastcall **)(cocos2d::ccGLServerState *, _QWORD))(*(_QWORD *)&a1[-1].m_eGLServerState + 992LL))(
&a1[-1].m_eGLServerState,
0);
v33 = *(GJSearchObject **)&a1->m_obContentSize.height;
v35 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(v34);
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v37, v36) + 224) = v35;
v38 = LevelBrowserLayer::create(v33);
v35->addChild_1(v35, v38);
v39 = cocos2d::CCTransitionFade::create(0.5, v35);
v41 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v40);
cocos2d::CCDirector::replaceScene(v41, v39);
}