//
// CustomListView::setupList from 0x1400abcd0 to 0x1400ac399 (1737 bytes)
//
// 2 xrefs:
// > ??> @ 0x14054a8c0
// > ??> @ 0x1406c7968
//
// 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=2
void CustomListView::setupList(CustomListView *a1, float a2)
{
TableView **p_m_tableView; // rbx
float v4; // xmm6_4
int v5; // xmm8_4
TableView **v6; // rsi
cocos2d::CCArray *m_entries; // rcx
cocos2d::CCArray *v8; // rcx
BoomListType m_type; // edx
cocos2d::CCArray *v10; // rcx
unsigned int v11; // eax
TableView *m_tableView; // rcx
float v13; // xmm6_4
float *v14; // rax
const cocos2d::CCPoint *v15; // rax
TableView *v16; // rbx
__int64 v17; // r14
int v18; // r14d
int v19; // ebx
char v20; // r15
int v21; // ebp
unsigned int v22; // esi
struct cocos2d::CCObject *v23; // rax
unsigned int v24; // eax
TableView *v25; // rcx
float m_itemSeparation; // xmm2_4
float v27; // xmm1_4
const cocos2d::CCPoint *v28; // rax
TableView *v29; // rcx
float v30; // xmm6_4
float *v31; // rax
int v32; // ebx
char v33; // r14
int v34; // ebp
unsigned int v35; // esi
GJUserScore *v36; // rax
unsigned int v37; // eax
TableView *v38; // rcx
bool v39; // zf
float v40; // xmm2_4
float v41; // xmm1_4
CCContentLayer *m_contentLayer; // rbx
float y; // xmm6_4
char v44; // r15
TableViewCellDelegate *m_cellDelegate; // rcx
int v46; // r14d
unsigned int v47; // esi
unsigned int v48; // eax
TableView *v49; // rcx
TableView *v50; // rcx
cocos2d::CCPoint v51; // [rsp+90h] [rbp+8h] BYREF
a1->m_itemSeparation = CustomListView::getCellHeight(a1->m_type);
p_m_tableView = &a1->m_tableView;
if ( a1->m_height > (float)((float)(int)cocos2d::CCArray::count(a1->m_entries) * a1->m_itemSeparation) )
{
a1->m_locked = 1;
(*p_m_tableView)->setTouchEnabled(*p_m_tableView, 0);
(*p_m_tableView)->setMouseEnabled(*p_m_tableView, 0);
(*p_m_tableView)->setKeyboardEnabled(*p_m_tableView, 0);
}
v4 = 0.0;
v5 = 0x40000000;
v6 = &a1->m_tableView;
switch ( a1->m_type )
{
case User:
case Level:
case Level2:
case Score:
case User2:
case Request:
case Message:
case Comment4|Achievement:
case SFX:
case SFX2:
case CustomMusic:
case Options:
case LevelList:
case Level3:
case LevelList2:
case LevelList3:
case Level4:
case LocalLevelScore:
m_entries = a1->m_entries;
if ( m_entries )
v4 = (float)(int)cocos2d::CCArray::count(m_entries) * 0.5;
v6 = &a1->m_tableView;
break;
case Achievement:
case MapPack:
case CustomSong:
v4 = 2.0;
break;
case Comment:
case Comment2:
case Comment3:
case Comment4:
case Artist:
case URL:
v8 = a1->m_entries;
if ( v8 )
v4 = (float)((float)(int)cocos2d::CCArray::count(v8) * 0.5) - 1.0;
else
v4 = 1.0;
break;
case List|0x1:
v4 = -6.0;
v5 = 1092616192;
break;
default:
break;
}
TableView::reloadData(*v6);
(*v6)->m_scrollLimitTop = v4;
LODWORD((*v6)->m_scrollLimitBottom) = v5;
m_type = a1->m_type;
switch ( m_type )
{
case User:
case Stats:
case Achievement:
case Comment:
case Comment2:
case Comment3:
case List|0x1:
case Song:
case MapPack:
case CustomSong:
case Comment4:
case User2:
case Request:
case Message:
case Artist:
case SmartTemplate:
case CustomMusic:
case Options:
case LevelList:
case LevelList2:
case LevelList3:
case LocalLevelScore:
case URL:
v10 = a1->m_entries;
goto LABEL_14;
case Level:
case Level2:
case Level3:
case Level4:
if ( a2 != 0.0 && !a1->m_locked )
{
v13 = fminf((*v6)->m_scrollLimitBottom, a2);
v14 = (float *)(*v6)->m_contentLayer->getPosition_0((*v6)->m_contentLayer);
cocos2d::CCPoint::CCPoint(&v51, *v14, v13);
v16 = *v6;
goto LABEL_48;
}
v17 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v51 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = qword_1406C2ED8;
}
v18 = *(_DWORD *)(v17 + 948);
v10 = a1->m_entries;
if ( !v18 )
{
LABEL_14:
v11 = cocos2d::CCArray::count(v10);
m_tableView = a1->m_tableView;
LABEL_64:
if ( v11 == 1 )
CCScrollLayerExt::moveToTopWithOffset(m_tableView, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(m_tableView);
return;
}
v19 = -1;
v20 = 0;
v21 = 0;
v22 = 0;
if ( !cocos2d::CCArray::count(v10) )
goto LABEL_27;
while ( 1 )
{
v23 = cocos2d::CCArray::objectAtIndex(a1->m_entries, v22);
if ( v23[5].m_uOrderOfArrival - v23[5].m_unknown5 == v18 || v23[19].m_uOrderOfArrival == v18 )
break;
++v19;
if ( ++v22 >= cocos2d::CCArray::count(a1->m_entries) )
goto LABEL_27;
}
v20 = 1;
v21 = v19 + 2;
LABEL_27:
v24 = cocos2d::CCArray::count(a1->m_entries);
v25 = a1->m_tableView;
if ( v24 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v25, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v25);
if ( v20 )
{
if ( cocos2d::CCArray::count(a1->m_entries) != 1 )
{
m_itemSeparation = a1->m_itemSeparation;
v27 = a1->m_height * 0.5;
if ( (float)((float)v19 * m_itemSeparation) > v27 )
{
v28 = a1->m_tableView->m_contentLayer->getPosition_0(a1->m_tableView->m_contentLayer);
v29 = a1->m_tableView;
v30 = fminf(
v29->m_scrollLimitBottom,
(float)((float)((float)((float)v21 * m_itemSeparation) - v27) - (float)(m_itemSeparation * 0.5))
+ v28->y);
v31 = (float *)v29->m_contentLayer->getPosition_0(v29->m_contentLayer);
goto LABEL_47;
}
}
}
return;
case Score:
case Comment4|Achievement:
v32 = -1;
v33 = 0;
v34 = 0;
v35 = 0;
if ( !cocos2d::CCArray::count(a1->m_entries) )
goto LABEL_39;
while ( 1 )
{
v36 = (GJUserScore *)cocos2d::CCArray::objectAtIndex(a1->m_entries, v35);
if ( GJUserScore::isCurrentUser(v36) )
break;
++v32;
if ( ++v35 >= cocos2d::CCArray::count(a1->m_entries) )
goto LABEL_39;
}
v33 = 1;
v34 = v32 + 2;
LABEL_39:
v37 = cocos2d::CCArray::count(a1->m_entries);
v38 = a1->m_tableView;
if ( v37 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v38, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v38);
v39 = v33 == 0;
goto LABEL_43;
case SFX:
case SFX2:
v32 = -1;
v44 = 0;
m_cellDelegate = (*v6)->m_cellDelegate;
v34 = 0;
if ( !m_cellDelegate )
goto LABEL_56;
if ( !m_cellDelegate->shouldSnapToSelected(m_cellDelegate) )
goto LABEL_56;
v46 = (*v6)->m_cellDelegate->getSelectedCellIdx((*v6)->m_cellDelegate);
v47 = 0;
if ( !cocos2d::CCArray::count(a1->m_entries) )
goto LABEL_56;
break;
default:
v50 = *v6;
if ( m_type == (List|0x1) )
{
a1->m_itemSeparation = 80.0;
TableView::reloadData(v50);
(*v6)->m_scrollLimitTop = 5.0;
}
else
{
a1->m_itemSeparation = 40.0;
TableView::reloadData(v50);
(*v6)->m_scrollLimitTop = 30.0;
}
v11 = cocos2d::CCArray::count(a1->m_entries);
m_tableView = *v6;
goto LABEL_64;
}
while ( LODWORD(cocos2d::CCArray::objectAtIndex(a1->m_entries, v47)[1].__vftable) != v46 )
{
++v32;
if ( ++v47 >= cocos2d::CCArray::count(a1->m_entries) )
goto LABEL_56;
}
v44 = 1;
v34 = v32 + 2;
LABEL_56:
v48 = cocos2d::CCArray::count(a1->m_entries);
v49 = a1->m_tableView;
if ( v48 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v49, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v49);
v39 = v44 == 0;
LABEL_43:
if ( !v39 && cocos2d::CCArray::count(a1->m_entries) != 1 )
{
v40 = a1->m_itemSeparation;
v41 = a1->m_height * 0.5;
if ( (float)((float)v32 * v40) > v41 )
{
m_contentLayer = a1->m_tableView->m_contentLayer;
y = m_contentLayer->getPosition_0(m_contentLayer)->y;
v31 = (float *)m_contentLayer->getPosition_0(m_contentLayer);
v30 = y + (float)((float)((float)((float)v34 * v40) - v41) - (float)(v40 * 0.5));
LABEL_47:
cocos2d::CCPoint::CCPoint(&v51, *v31, v30);
v16 = a1->m_tableView;
LABEL_48:
v16->m_contentLayer->setPosition_0(v16->m_contentLayer, v15);
CCScrollLayerExt::doConstraintContent(v16, 0);
}
}
}