//
// CustomListView::setupList from 0x60d0fc to 0x60d68c (1424 bytes)
//
// 2 xrefs:
// > ??> @ 0x778f8
// > ??> @ 0x114b540
//
// 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 CellHeight; // s0
cocos2d::CCArray *m_entries; // x0
float v6; // s8
float v7; // s9
TableView *m_tableView; // x0
__int32 v9; // w1
int v10; // w22
GJUserScore *v11; // x0
int v12; // w20
int v13; // w23
float v14; // s1
float v15; // s8
float v16; // s3
CCContentLayer *m_contentLayer; // x1
float v18; // s0
int v19; // w22
int m_currentLevelID; // w23
_DWORD *v21; // x0
int v22; // w20
int v23; // w23
float m_itemSeparation; // s1
float v25; // s2
float v26; // s8
TableView *v27; // x20
const cocos2d::CCPoint *v28; // x0
float v29; // s1
float x; // s0
TableViewCellDelegate *m_cellDelegate; // x0
int v32; // w22
int v33; // w23
int v34; // w20
int v35; // w23
cocos2d::CCArray *v36; // x0
cocos2d::CCArray *v37; // x0
float v38; // s2
float v39; // s8
const cocos2d::CCPoint *v40; // x0
TableView *v41; // x19
__int64 v42; // x0
float v43; // [xsp+50h] [xbp+50h]
cocos2d::CCPoint v44; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCPoint v45; // 0:s0.4,4:s1.4
cocos2d::CCPoint v46; // 0:s0.4,4:s1.4
CellHeight = CustomListView::getCellHeight(a1->m_type);
m_entries = a1->m_entries;
a1->m_itemSeparation = CellHeight;
if ( (float)((float)(unsigned int)cocos2d::CCArray::count(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:
v37 = a1->m_entries;
v7 = 2.0;
if ( v37 )
v6 = (float)(unsigned int)cocos2d::CCArray::count(v37) * 0.5;
else
v6 = 0.0;
break;
case Achievement:
case MapPack:
case CustomSong:
v7 = 2.0;
v6 = 2.0;
break;
case Comment:
case Comment2:
case Comment3:
case Comment4:
case Artist:
case URL:
v36 = a1->m_entries;
v7 = 2.0;
if ( v36 )
v6 = (float)((float)(unsigned int)cocos2d::CCArray::count(v36) * 0.5) + -1.0;
else
v6 = 1.0;
break;
case List|0x1:
v7 = 10.0;
v6 = -6.0;
break;
default:
v6 = 0.0;
v7 = 2.0;
break;
}
TableView::reloadData(a1->m_tableView);
m_tableView = a1->m_tableView;
v9 = a1->m_type - 2;
m_tableView->m_scrollLimitTop = v6;
m_tableView->m_scrollLimitBottom = v7;
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_10;
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);
v27 = a1->m_tableView;
x = v27->m_contentLayer->getPosition(v27->m_contentLayer)->x;
v29 = MaxY;
goto LABEL_40;
}
if ( GameManager::sharedState()->m_currentLevelID )
{
v19 = -1;
m_currentLevelID = GameManager::sharedState()->m_currentLevelID;
while ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) > v19 + 1 )
{
v21 = (_DWORD *)cocos2d::CCArray::objectAtIndex(a1->m_entries, v19 + 1);
if ( m_currentLevelID == v21[82] - v21[83] || m_currentLevelID == v21[218] )
{
v22 = v19 + 2;
v23 = 1;
goto LABEL_33;
}
++v19;
}
v23 = 0;
v22 = 0;
LABEL_33:
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) == 1 )
{
CCScrollLayerExt::moveToTopWithOffset(a1->m_tableView, a1->m_itemSeparation);
if ( !v23 )
return;
}
else
{
CCScrollLayerExt::moveToTop(a1->m_tableView);
if ( !v23 )
return;
}
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) != 1 )
{
m_itemSeparation = a1->m_itemSeparation;
v25 = a1->m_height * 0.5;
if ( (float)((float)v19 * m_itemSeparation) > v25 )
{
v26 = (float)((float)-(float)(v25 - (float)(m_itemSeparation * (float)v22)) - (float)(m_itemSeparation * 0.5))
+ a1->m_tableView->m_contentLayer->getPosition(a1->m_tableView->m_contentLayer)->y;
if ( v26 > CCScrollLayerExt::getMaxY(a1->m_tableView) )
v26 = CCScrollLayerExt::getMaxY(a1->m_tableView);
v27 = a1->m_tableView;
v28 = v27->m_contentLayer->getPosition(v27->m_contentLayer);
v29 = v26;
x = v28->x;
LABEL_40:
cocos2d::CCPoint::CCPoint(&v44, x, v29);
CCScrollLayerExt::setContentOffset(v27, v45, (bool)&v44);
}
}
}
else
{
LABEL_10:
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) == 1 )
CCScrollLayerExt::moveToTopWithOffset(a1->m_tableView, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(a1->m_tableView);
}
return;
case 11:
case 18:
v10 = -1;
while ( 2 )
{
if ( v10 + 1 < (unsigned int)cocos2d::CCArray::count(a1->m_entries) )
{
v11 = (GJUserScore *)cocos2d::CCArray::objectAtIndex(a1->m_entries, v10 + 1);
if ( !GJUserScore::isCurrentUser(v11) )
{
++v10;
continue;
}
v13 = v10 + 2;
v12 = 1;
}
else
{
v12 = 0;
v13 = 0;
}
break;
}
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) == 1 )
CCScrollLayerExt::moveToTopWithOffset(a1->m_tableView, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(a1->m_tableView);
if ( !v12 )
return;
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) == 1 )
return;
v14 = a1->m_itemSeparation;
v15 = 0.5;
v16 = a1->m_height * 0.5;
if ( (float)((float)v10 * v14) <= v16 )
return;
m_contentLayer = a1->m_tableView->m_contentLayer;
v18 = -(float)(v16 - (float)(v14 * (float)v13));
goto LABEL_60;
case 21:
case 22:
m_cellDelegate = m_tableView->m_cellDelegate;
if ( m_cellDelegate && m_cellDelegate->shouldSnapToSelected(m_cellDelegate) )
{
v32 = -1;
v33 = a1->m_tableView->m_cellDelegate->getSelectedCellIdx(a1->m_tableView->m_cellDelegate);
while ( 1 )
{
if ( v32 + 1 >= (unsigned int)cocos2d::CCArray::count(a1->m_entries) )
{
v34 = 0;
v35 = 0;
goto LABEL_54;
}
if ( v33 == *(_DWORD *)(cocos2d::CCArray::objectAtIndex(a1->m_entries, v32 + 1) + 56) )
break;
++v32;
}
v35 = v32 + 2;
v34 = 1;
}
else
{
v34 = 0;
v32 = -1;
v35 = 0;
}
LABEL_54:
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) == 1 )
CCScrollLayerExt::moveToTopWithOffset(a1->m_tableView, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(a1->m_tableView);
if ( v34 )
{
if ( (unsigned int)cocos2d::CCArray::count(a1->m_entries) != 1 )
{
v14 = a1->m_itemSeparation;
v15 = 0.5;
v38 = a1->m_height * 0.5;
if ( (float)((float)v32 * v14) > v38 )
{
m_contentLayer = a1->m_tableView->m_contentLayer;
v18 = -(float)(v38 - (float)(v14 * (float)v35));
LABEL_60:
v39 = v18 - (float)(v14 * v15);
v40 = m_contentLayer->getPosition(m_contentLayer);
v41 = a1->m_tableView;
v43 = v40->x;
v42 = (__int64)v41->m_contentLayer->getPosition(v41->m_contentLayer);
cocos2d::CCPoint::CCPoint(&v44, v43, v39 + *(float *)(v42 + 4));
CCScrollLayerExt::setContentOffset(v41, v46, (bool)&v44);
}
}
}
return;
default:
BoomListView::setupList(a1, MaxY);
return;
}
}