//
// LevelListLayer::cellPerformedAction from 0x140306c30 to 0x14030707e (1102 bytes)
//
// 2 xrefs:
// > ??> @ 0x140589140
// > ??> @ 0x1406d44b4
//
// 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=3
bool LevelListLayer::cellPerformedAction(
LevelListLayer *a1,
TableViewCell *a2,
int a3,
CellAction a4,
cocos2d::CCNode *a5)
{
cocos2d::CCPoint *p_m_rewardPosition; // rdi
int v9; // ebp
__int64 v10; // rax
float v11; // xmm0_4
__int64 v12; // rcx
__int64 v13; // rax
_DWORD *v14; // rcx
_DWORD *v15; // rax
__int64 v16; // r15
int j; // r14d
SetLevelOrderPopup *v18; // rsi
GJLevelList *v20; // rcx
std::_Vector_val>::pointer i; // rax
int v22; // edx
__int64 v23; // rax
unsigned int v24; // esi
GJLevelList *v25; // rbp
std::_Vector_val>::pointer Myfirst; // rcx
std::_Vector_val>::pointer Mylast; // rax
std::_Vector_val>::pointer v28; // rdx
_BYTE *v29; // rax
size_t v30; // r8
void *v31; // rcx
__int64 v32; // rcx
CustomListView *v33; // rcx
SetupSmartTemplateLayer *v34; // rax
cocos2d::CCArray *m_pChildren; // rcx
void *Block[2]; // [rsp+38h] [rbp-280h] BYREF
__int64 v37; // [rsp+48h] [rbp-270h]
unsigned __int64 v38; // [rsp+50h] [rbp-268h]
_BYTE v39[528]; // [rsp+60h] [rbp-258h] BYREF
p_m_rewardPosition = nullptr;
if ( a3 != 31 )
{
if ( a3 == 22 )
{
if ( a4 == Click )
{
CustomListView::reloadAll(*(CustomListView **)(*(_QWORD *)&a1->m_uIndexInArray + 544LL));
}
else if ( a4 == Edit )
{
((void (__fastcall *)(cocos2d::CCRGBAProtocol *, _QWORD))a1[-1].LevelBrowserLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable[9].getOpacity)(
&a1[-1].cocos2d::CCRGBAProtocol,
0);
HIDWORD(a2[1].getPosition_0) = 0;
v34 = SetupSmartTemplateLayer::create((GJSmartTemplate *)a2[1].cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable);
v34->show(v34);
return 1;
}
return 0;
}
LABEL_48:
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
return ((bool (__fastcall *)(cocos2d::CCArray *))m_pChildren->copyWithZone)(m_pChildren);
return 0;
}
if ( !a4 )
goto LABEL_48;
v9 = *(_DWORD *)(*(_QWORD *)&a2[1].m_uID + 328LL) - *(_DWORD *)(*(_QWORD *)&a2[1].m_uID + 332LL);
LODWORD(a1->m_pGrid) = 0;
v10 = *(_QWORD *)&a1->m_uIndexInArray;
v11 = 0.0;
if ( v10 )
{
v12 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v10 + 544) + 424LL) + 472LL);
v11 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 200LL))(v12) + 4);
*(float *)&a1->m_pGrid = v11;
}
if ( a4 == 2 )
{
v23 = *(_QWORD *)&a1->m_uIndexInArray;
if ( v23 )
*(float *)&a1->m_pGrid = v11 + *(float *)(*(_QWORD *)(v23 + 544) + 452LL);
v24 = *(_DWORD *)(*(_QWORD *)&a2[1].m_uID + 328LL) - *(_DWORD *)(*(_QWORD *)&a2[1].m_uID + 332LL);
v25 = *(GJLevelList **)&a1->m_nUpdateScriptHandler;
Myfirst = v25->m_levels._Mypair._Myval2._Myfirst;
Mylast = v25->m_levels._Mypair._Myval2._Mylast;
if ( Myfirst != Mylast )
{
while ( 1 )
{
v28 = Myfirst + 1;
if ( *Myfirst == v24 )
break;
++Myfirst;
if ( v28 == Mylast )
goto LABEL_31;
}
memmove(Myfirst, v28, (char *)Mylast - (char *)v28);
--v25->m_levels._Mypair._Myval2._Mylast;
GJLevelList::updateLevelsString(v25);
}
LABEL_31:
fmt::BasicWriter::BasicWriter(v39);
fmt::BasicWriter::operator<<(v39, v24);
v29 = (_BYTE *)fmt::BasicWriter::c_str(v39);
*(_OWORD *)Block = 0;
v37 = 0;
v38 = 0;
v30 = -1;
do
++v30;
while ( v29[v30] );
sub_14003A930(Block, v29, v30);
fmt::BasicWriter::~BasicWriter(v39);
cocos2d::CCDictionary::removeObjectForKey(v25->m_levelsDict, Block);
if ( v38 > 0xF )
{
v31 = Block[0];
if ( v38 + 1 >= 0x1000 )
{
v31 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v31 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v31);
}
v25->m_modified = 1;
goto LABEL_39;
}
if ( a4 == 3 || a4 == 4 )
{
v20 = *(GJLevelList **)&a1->m_nUpdateScriptHandler;
for ( i = v20->m_levels._Mypair._Myval2._Myfirst; i != v20->m_levels._Mypair._Myval2._Mylast; ++i )
{
if ( *i == v9 )
break;
LODWORD(p_m_rewardPosition) = (_DWORD)p_m_rewardPosition + 1;
}
v22 = 1;
if ( a4 == 3 )
v22 = -1;
GJLevelList::reorderLevel(v20, v9, (_DWORD)p_m_rewardPosition + v22);
LABEL_39:
LevelBrowserLayer::setupLevelBrowser((LevelListLayer *)((char *)a1 - 576), nullptr);
v32 = *(_QWORD *)&a1->m_uIndexInArray;
if ( v32 )
{
v33 = *(CustomListView **)(v32 + 544);
v33->m_cellMode = *(_DWORD *)&a1->m_bTouchEnabled;
CustomListView::reloadAll(v33);
}
return 1;
}
if ( a4 != Swap )
return 1;
v13 = *(_QWORD *)&a1->m_nUpdateScriptHandler;
v14 = *(_DWORD **)(v13 + 328);
v15 = *(_DWORD **)(v13 + 320);
v16 = v14 - v15;
for ( j = 0; v15 != v14; ++v15 )
{
if ( *v15 == v9 )
break;
++j;
}
v18 = (SetLevelOrderPopup *)operator new(0x2B0u);
SetIDPopup::SetIDPopup(v18);
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (SetLevelOrderPopup_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&SetLevelOrderPopup::`vftable';
v18->SetIDPopup::TextInputDelegate::__vftable = (TextInputDelegate_vtbl *)&SetLevelOrderPopup::`vftable';
v18->m_levelID = 0;
if ( SetLevelOrderPopup::init(v18, v9, j + 1, v16) )
{
cocos2d::CCObject::autorelease(v18);
}
else
{
((void (__fastcall *)(SetLevelOrderPopup *, __int64))v18->~SetLevelOrderPopup)(v18, 1);
v18 = nullptr;
}
if ( a1 != (LevelListLayer *)576 )
p_m_rewardPosition = &a1[-1].m_rewardPosition;
v18->m_delegate = (SetIDPopupDelegate *)p_m_rewardPosition;
v18->setTag(v18, 1003);
v18->show(v18);
return 1;
}