//
// LevelBrowserLayer::deleteSelected from 0x7fc058 to 0x7fc2e8 (656 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::FLAlert_Clicked @ 0x7fc750
// > ??> @ 0x59b60
//
// 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::deleteSelected(LevelBrowserLayer *this)
{
cocos2d::CCArray *v2; // x0
cocos2d::CCArray *v3; // x22
__int64 v4; // x0
unsigned int *v5; // x1
unsigned int *v6; // x1
GJGameLevel **v7; // x19
GameLevelManager *v8; // x0
char *j; // x21
GameLevelManager *v10; // x0
unsigned int v11; // w0
cocos2d::CCString *v12; // x0
const char *CString; // x1
size_t v14; // x0
__int64 v15; // x1
void (__fastcall *v16)(LevelBrowserLayer *, __int64, __int64); // x22
__int64 v17; // x0
cocos2d::CCObject **v19; // x19
cocos2d::CCObject **i; // x21
cocos2d::CCObject *v21; // x1
GJGameLevel *v22; // [xsp+48h] [xbp+48h]
GJGameLevel *v23; // [xsp+48h] [xbp+48h]
__int64 v24; // [xsp+50h] [xbp+50h] BYREF
size_t v25; // [xsp+58h] [xbp+58h]
void *v26; // [xsp+60h] [xbp+60h]
__int64 v27; // [xsp+68h] [xbp+68h] BYREF
size_t v28; // [xsp+70h] [xbp+70h]
void *v29; // [xsp+78h] [xbp+78h]
__int64 v30[2]; // [xsp+80h] [xbp+80h] BYREF
void *v31; // [xsp+90h] [xbp+90h]
v2 = *((cocos2d::CCArray **)this + 82);
if ( v2 )
{
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = *((_QWORD *)this + 82);
if ( v4 )
{
v5 = *(unsigned int **)(v4 + 56);
if ( *v5 )
{
v19 = *((cocos2d::CCObject ***)v5 + 2);
for ( i = &v19[*v5 - 1]; i >= v19; ++v19 )
{
v21 = *v19;
if ( !*v19 )
break;
if ( *((_BYTE *)v21 + 771) )
cocos2d::CCArray::addObject(v3, v21);
}
}
}
if ( (unsigned int)cocos2d::CCArray::count(v3) )
{
if ( v3 )
{
v6 = *((unsigned int **)v3 + 7);
if ( *v6 )
{
v7 = *((GJGameLevel ***)v6 + 2);
v8 = (GameLevelManager *)(8LL * *v6 - 8);
for ( j = (char *)v8 + (_QWORD)v7;
j >= (char *)v7;
v8 = (GameLevelManager *)GameLevelManager::deleteLevel(v10, v22) )
{
if ( !*v7 )
break;
v22 = *v7;
v10 = (GameLevelManager *)GameLevelManager::sharedState(v8);
++v7;
}
}
}
LevelBrowserLayer::loadPage((GJSearchObject **)this, *((GJSearchObject **)this + 83));
v11 = cocos2d::CCArray::count(v3);
if ( v11 == 1 )
{
CString = "Level deleted!";
}
else
{
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i levels deleted!",
(const char *)v11);
CString = (const char *)cocos2d::CCString::getCString(v12);
}
v23 = (GJGameLevel *)CString;
v24 = 0;
v25 = 0;
v26 = nullptr;
v14 = strlen(CString);
std::string::__init(&v24, v23, v14);
v27 = 0;
v15 = *(_QWORD *)this;
v28 = 0;
v29 = nullptr;
v16 = *(void (__fastcall **)(LevelBrowserLayer *, __int64, __int64))(v15 + 464);
if ( (v24 & 1) != 0 )
{
std::string::__init(&v27, v26, v25);
}
else
{
v29 = v26;
v27 = v24;
v28 = v25;
}
v30[0] = 0;
v30[1] = 0;
v31 = nullptr;
std::string::__init(v30, &byte_11B8890, 0);
v17 = TextAlertPopup::create(&v27, 150, v30, 0.5, 0.6);
v16(this, v17, 100);
if ( (v30[0] & 1) != 0 )
operator delete(v31);
if ( (v27 & 1) != 0 )
operator delete(v29);
if ( (v24 & 1) != 0 )
operator delete(v26);
}
}
return _stack_chk_guard;
}