//
// CustomListView::setupList from 0x3304d0 to 0x330980 (1200 bytes)
//
// 0 xrefs:
//
// 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
//
void CustomListView::setupList(CustomListView *a1, float MaxY)
{
float v4; // s17
float v5; // s16
cocos2d::CCArray *m_entries; // r0
cocos2d::CCArray *v7; // r0
TableView *m_tableView; // r0
__int32 v9; // r3
TableView *v10; // r5
const cocos2d::CCPoint *v11; // r0
float v12; // r2
float x; // r1
int v14; // r5
int m_currentLevelID; // r8
_DWORD *v16; // r0
int v17; // r8
int v18; // r7
bool v19; // zf
TableView *v20; // r0
float m_itemSeparation; // s14
float v22; // s16
TableView *v23; // r0
int v24; // r5
GJUserScore *v25; // r0
int v26; // r8
int v27; // r7
TableView *v28; // r0
float v29; // s12
float v30; // s15
float v31; // s16
TableViewCellDelegate *m_cellDelegate; // r0
int v33; // r5
int v34; // r8
int v35; // r8
int v36; // r7
TableView *v37; // r0
float v38; // s13
float v39; // s14
float v40; // s16
const cocos2d::CCPoint *v41; // r0
const cocos2d::CCPoint *v42; // r0
float v43; // r7
int v44; // r0
bool v45; // r3
cocos2d::CCPoint v46; // [sp+4h] [bp-Ch] BYREF
a1->m_itemSeparation = CustomListView::getCellHeight(a1->m_type);
if ( (float)((float)(unsigned int)cocos2d::CCArray::count(a1->m_entries) * a1->m_itemSeparation) < a1->m_height )
BoomListView::lockList(a1, 1);
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 )
goto LABEL_10;
v5 = vcvts_n_f32_u32(cocos2d::CCArray::count(m_entries), 1u);
goto LABEL_11;
case Achievement:
case MapPack:
case CustomSong:
v4 = 2.0;
v5 = 2.0;
break;
case Comment:
case Comment2:
case Comment3:
case Comment4:
case Artist:
case URL:
v7 = a1->m_entries;
v5 = 1.0;
if ( v7 )
v5 = vcvts_n_f32_u32(cocos2d::CCArray::count(v7), 1u) - 1.0;
LABEL_11:
v4 = 2.0;
break;
case List|0x1:
v4 = 10.0;
v5 = -6.0;
break;
default:
LABEL_10:
v4 = 2.0;
v5 = 0.0;
break;
}
TableView::reloadData(a1->m_tableView);
m_tableView = a1->m_tableView;
v9 = a1->m_type - 2;
m_tableView->m_scrollLimitTop = v5;
m_tableView->m_scrollLimitBottom = v4;
switch ( v9 )
{
case 0:
case 1:
case 2:
case 5:
case 6:
case 7:
case 9:
case 10:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 19:
case 20:
case 23:
case 24:
case 25:
case 27:
case 28:
case 31:
case 32:
goto LABEL_32;
case 3:
case 4:
case 26:
case 29:
if ( MaxY != 0.0 && !a1->m_locked )
{
if ( MaxY > CCScrollLayerExt::getMaxY(m_tableView) )
MaxY = CCScrollLayerExt::getMaxY(a1->m_tableView);
v10 = a1->m_tableView;
v11 = v10->m_contentLayer->getPosition(v10->m_contentLayer);
v12 = MaxY;
x = v11->x;
goto LABEL_70;
}
if ( !GameManager::sharedState()->m_currentLevelID )
{
LABEL_32:
v19 = cocos2d::CCArray::count(a1->m_entries) == 1;
v23 = a1->m_tableView;
if ( v19 )
CCScrollLayerExt::moveToTopWithOffset(v23, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v23);
return;
}
v14 = -1;
m_currentLevelID = GameManager::sharedState()->m_currentLevelID;
while ( 2 )
{
if ( (unsigned int)(v14 + 1) >= cocos2d::CCArray::count(a1->m_entries) )
{
v17 = 0;
v18 = 0;
}
else
{
v16 = (_DWORD *)cocos2d::CCArray::objectAtIndex(a1->m_entries, v14 + 1);
if ( v16[67] - v16[68] != m_currentLevelID && v16[191] != m_currentLevelID )
{
++v14;
continue;
}
v18 = v14 + 2;
v17 = 1;
}
break;
}
v19 = cocos2d::CCArray::count(a1->m_entries) == 1;
v20 = a1->m_tableView;
if ( v19 )
CCScrollLayerExt::moveToTopWithOffset(v20, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v20);
if ( !v17 )
return;
if ( cocos2d::CCArray::count(a1->m_entries) == 1 )
return;
m_itemSeparation = a1->m_itemSeparation;
v22 = a1->m_height * 0.5;
if ( (float)((float)v14 * m_itemSeparation) <= v22 )
return;
v40 = (float)((float)((float)((float)v18 * m_itemSeparation) - v22) - (float)(m_itemSeparation * 0.5))
+ a1->m_tableView->m_contentLayer->getPosition(a1->m_tableView->m_contentLayer)->y;
if ( v40 > CCScrollLayerExt::getMaxY(a1->m_tableView) )
v40 = CCScrollLayerExt::getMaxY(a1->m_tableView);
v10 = a1->m_tableView;
v41 = v10->m_contentLayer->getPosition(v10->m_contentLayer);
v12 = v40;
x = v41->x;
goto LABEL_70;
case 11:
case 18:
v24 = -1;
while ( 2 )
{
if ( (unsigned int)(v24 + 1) >= cocos2d::CCArray::count(a1->m_entries) )
{
v26 = 0;
v27 = 0;
}
else
{
v25 = (GJUserScore *)cocos2d::CCArray::objectAtIndex(a1->m_entries, v24 + 1);
if ( !GJUserScore::isCurrentUser(v25) )
{
++v24;
continue;
}
v27 = v24 + 2;
v26 = 1;
}
break;
}
v19 = cocos2d::CCArray::count(a1->m_entries) == 1;
v28 = a1->m_tableView;
if ( v19 )
CCScrollLayerExt::moveToTopWithOffset(v28, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v28);
if ( !v26 )
return;
if ( cocos2d::CCArray::count(a1->m_entries) == 1 )
return;
v29 = a1->m_itemSeparation;
v30 = a1->m_height * 0.5;
if ( (float)((float)v24 * v29) <= v30 )
return;
v31 = (float)((float)((float)v27 * v29) - v30) - (float)(v29 * 0.5);
goto LABEL_69;
case 21:
case 22:
m_cellDelegate = m_tableView->m_cellDelegate;
if ( !m_cellDelegate
|| !((int (__fastcall *)(TableViewCellDelegate *))m_cellDelegate->shouldSnapToSelected)(m_cellDelegate) )
{
v35 = 0;
v33 = -1;
goto LABEL_54;
}
v33 = -1;
v34 = a1->m_tableView->m_cellDelegate->getSelectedCellIdx(a1->m_tableView->m_cellDelegate);
while ( 1 )
{
if ( (unsigned int)(v33 + 1) >= cocos2d::CCArray::count(a1->m_entries) )
{
v35 = 0;
LABEL_54:
v36 = 0;
goto LABEL_55;
}
if ( *(_DWORD *)(cocos2d::CCArray::objectAtIndex(a1->m_entries, v33 + 1) + 52) == v34 )
break;
++v33;
}
v36 = v33 + 2;
v35 = 1;
LABEL_55:
v19 = cocos2d::CCArray::count(a1->m_entries) == 1;
v37 = a1->m_tableView;
if ( v19 )
CCScrollLayerExt::moveToTopWithOffset(v37, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v37);
if ( v35 )
{
if ( cocos2d::CCArray::count(a1->m_entries) != 1 )
{
v38 = a1->m_itemSeparation;
v39 = a1->m_height * 0.5;
if ( (float)((float)v33 * v38) > v39 )
{
v31 = (float)((float)((float)v36 * v38) - v39) - (float)(v38 * 0.5);
LABEL_69:
v42 = a1->m_tableView->m_contentLayer->getPosition(a1->m_tableView->m_contentLayer);
v10 = a1->m_tableView;
v43 = v42->x;
v44 = (int)v10->m_contentLayer->getPosition(v10->m_contentLayer);
x = v43;
v12 = v31 + *(float *)(v44 + 4);
LABEL_70:
cocos2d::CCPoint::CCPoint(&v46, x, v12);
CCScrollLayerExt::setContentOffset(v10, (cocos2d::CCPoint)(unsigned int)&v46, v45);
}
}
}
return;
default:
BoomListView::setupList(a1, MaxY);
return;
}
}