//
// LevelBrowserLayer::onDeleteSelected from 0x1402cf2f0 to 0x1402cf627 (823 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::init @ 0x1402c9877
// > ??> @ 0x1406d2e1c
//
// 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=4
void LevelBrowserLayer::onDeleteSelected(LevelBrowserLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCArray *m_levels; // rcx
int v4; // edx
cocos2d::CCArray *v5; // rax
cocos2d::ccArray *data; // rcx
__int64 num; // rax
cocos2d::CCObject **arr; // rcx
cocos2d::CCObject **v9; // r9
int v10; // r8d
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // rbx
size_t v14; // r8
void **v15; // rdx
FLAlertLayer *v16; // rbx
__int64 v17; // rax
void *v18; // rcx
__int64 v19; // rax
FLAlertLayer *v20; // rbx
FLAlertLayer *v21; // [rsp+58h] [rbp-21h]
__int128 v22; // [rsp+60h] [rbp-19h] BYREF
__int64 v23; // [rsp+70h] [rbp-9h]
__int64 v24; // [rsp+78h] [rbp-1h]
_BYTE v25[32]; // [rsp+80h] [rbp+7h] BYREF
void *Block[2]; // [rsp+A0h] [rbp+27h] BYREF
__int64 v27; // [rsp+B0h] [rbp+37h]
unsigned __int64 v28; // [rsp+B8h] [rbp+3Fh]
m_levels = a1->m_levels;
if ( m_levels && cocos2d::CCArray::count(m_levels) )
{
v4 = 0;
v5 = a1->m_levels;
if ( !v5 )
goto LABEL_26;
data = v5->data;
num = data->num;
if ( !(_DWORD)num )
goto LABEL_26;
arr = data->arr;
v9 = &arr[num - 1];
if ( arr > v9 )
goto LABEL_26;
do
{
v10 = v4;
if ( !*arr )
break;
++v4;
if ( !HIBYTE((*arr)[12].m_unknown5) )
v4 = v10;
++arr;
}
while ( arr <= v9 );
if ( v4 > 0 )
{
v11 = cocos2d::CCString::createWithFormat(
"Are you sure you want to delete the %i selected levels?",
v4);
CString = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
v27 = 0;
v28 = 0;
v13 = -1;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003A930(Block, CString, v14);
v15 = Block;
if ( v28 > 0xF )
v15 = (void **)Block[0];
v22 = 0;
v23 = 0;
v24 = 0;
do
++v13;
while ( *((_BYTE *)v15 + v13) );
sub_14003A930(&v22, v15, v13);
v21 = (FLAlertLayer *)operator new(0x278u);
v16 = FLAlertLayer::FLAlertLayer(v21);
if ( v16 )
{
v17 = sub_14003BDB0((__int64)v25, (__int64)&v22);
if ( FLAlertLayer::init(
(__int64)v16,
(__int64)&a1->FLAlertLayerProtocol,
"Delete",
v17,
"Back",
"Delete",
380.0,
0,
0,
1.0) )
{
cocos2d::CCObject::autorelease(v16);
}
else
{
((void (__fastcall *)(FLAlertLayer *, __int64))v16->~FLAlertLayer)(v16, 1);
v16 = nullptr;
}
}
sub_14003A830((__int64)&v22);
ButtonSprite::updateBGImage(v16->m_button2, "GJ_button_06.png");
v16->setTag(v16, 5);
v16->show(v16);
if ( v28 > 0xF )
{
v18 = Block[0];
if ( v28 + 1 >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v18);
}
}
else
{
LABEL_26:
*(_OWORD *)Block = 0;
v27 = 0;
v28 = 15;
Block[0] = sub_14003AA10(0x20u);
v27 = 19;
v28 = 31;
strcpy((char *)Block[0], "No levels selected.");
v19 = sub_14003BDB0((__int64)v25, (__int64)Block);
v20 = FLAlertLayer::create(0, (int)"Nothing here...", v19, (__int64)"OK", 0, 1132068864, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v20->show(v20);
}
}
}