//
// CustomListView::setupList from 0x10010b59c to 0x10010badc (1344 bytes)
//
// 1 xrefs:
// > ??> @ 0x10078f1e8
//
// 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 __fastcall CustomListView::setupList(CustomListView *a1, float MaxY)
{
__int64 v4; // d1
cocos2d::CCArray *m_entries; // x0
float v6; // s0
cocos2d::CCArray *v7; // x0
TableView *m_tableView; // x0
int v9; // w8
TableView *v10; // x0
int m_currentLevelID; // w20
float v12; // s8
int v13; // w21
_DWORD *v14; // x0
unsigned int v15; // w0
int v16; // w8
int v18; // w21
int v19; // w20
__int64 v20; // x21
GJUserScore *v21; // x0
_BOOL4 isCurrentUser; // w20
int v23; // w21
TableViewCellDelegate *m_cellDelegate; // x0
float v25; // s8
float v26; // s9
int v27; // w20
__int64 v28; // x21
int v29; // w20
int v30; // w8
TableView *v31; // x19
__n128 v32; // q0
__n128 v33; // q1
CCScrollLayerExt *v34; // x0
int v35; // w8
TableView *v36; // x0
float v37; // s0
float v38; // s1
float v39; // s1
int v40; // w8
TableView *v41; // x0
float m_itemSeparation; // s0
float v43; // s1
int v44; // w8
TableView *v45; // x0
float v46; // s1
float v47; // s9
TableView *v48; // x20
unsigned __int32 v49; // s8
__n128 v50; // q1
__n128 v51; // q0
__int64 v52; // [xsp+0h] [xbp-50h]
int v53; // [xsp+18h] [xbp-38h] BYREF
cocos2d::CCPoint v54; // 0:s0.4,4:s1.4
a1->m_itemSeparation = CustomListView::getCellHeight(a1->m_type);
if ( (float)(a1->m_itemSeparation * (float)(unsigned int)sub_10024A36C(a1->m_entries)) < a1->m_height )
BoomListView::lockList(a1, 1);
v4 = *(_QWORD *)"";
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 )
{
v6 = vcvts_n_f32_u32(sub_10024A36C(m_entries), 1u);
goto LABEL_8;
}
break;
case Achievement:
case MapPack:
case CustomSong:
v4 = 0x4000000040000000LL;
break;
case Comment:
case Comment2:
case Comment3:
case Comment4:
case Artist:
case URL:
v7 = a1->m_entries;
if ( v7 )
{
v6 = (float)((float)(unsigned int)sub_10024A36C(v7) * 0.5) + -1.0;
LABEL_8:
v4 = LODWORD(v6) | 0x4000000000000000LL;
}
else
{
v4 = 0x400000003F800000LL;
}
break;
case List|0x1:
v4 = 0x41200000C0C00000LL;
break;
default:
break;
}
v52 = v4;
TableView::reloadData(a1->m_tableView);
m_tableView = a1->m_tableView;
*(_QWORD *)&m_tableView->m_scrollLimitTop = v52;
switch ( a1->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:
goto LABEL_10;
case Level:
case Level2:
case Level3:
case Level4:
if ( MaxY != 0.0 && !a1->m_locked )
{
if ( CCScrollLayerExt::getMaxY(m_tableView) >= MaxY )
{
LABEL_40:
v31 = a1->m_tableView;
v32.n128_u32[0] = *(_DWORD *)((__int64 (__fastcall *)(CCContentLayer *))v31->m_contentLayer->getPosition)(v31->m_contentLayer);
v33.n128_f32[0] = MaxY;
sub_100022980(v32, v33, &v53);
v34 = v31;
goto LABEL_72;
}
LABEL_39:
MaxY = CCScrollLayerExt::getMaxY(a1->m_tableView);
goto LABEL_40;
}
if ( GameManager::sharedState()->m_currentLevelID )
{
m_currentLevelID = GameManager::sharedState()->m_currentLevelID;
v12 = 0.0;
if ( (unsigned int)sub_10024A36C(a1->m_entries) )
{
v13 = 1;
while ( 1 )
{
v14 = (_DWORD *)sub_10024A388(a1->m_entries, (unsigned int)(v13 - 1));
if ( v14[82] - v14[83] == m_currentLevelID || v14[258] == m_currentLevelID )
break;
v15 = sub_10024A36C(a1->m_entries);
v16 = v13 + 1;
if ( v13++ >= v15 )
{
v18 = 0;
v19 = v16 - 2;
goto LABEL_53;
}
}
v12 = (float)v13;
v19 = v13 - 2;
v18 = 1;
}
else
{
v18 = 0;
v19 = -1;
}
LABEL_53:
v40 = sub_10024A36C(a1->m_entries);
v41 = a1->m_tableView;
if ( v40 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v41, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v41);
if ( v18 )
{
if ( (unsigned int)sub_10024A36C(a1->m_entries) != 1 )
{
m_itemSeparation = a1->m_itemSeparation;
v43 = a1->m_height * 0.5;
if ( (float)(m_itemSeparation * (float)v19) > v43 )
{
MaxY = (float)((float)(m_itemSeparation * -0.5) - (float)(v43 - (float)(v12 * m_itemSeparation)))
+ *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_tableView->m_contentLayer->getPosition)(a1->m_tableView->m_contentLayer)
+ 4);
if ( MaxY <= CCScrollLayerExt::getMaxY(a1->m_tableView) )
goto LABEL_40;
goto LABEL_39;
}
}
}
}
else
{
LABEL_10:
v9 = sub_10024A36C(a1->m_entries);
v10 = a1->m_tableView;
if ( v9 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v10, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v10);
}
return;
case Score:
case Comment4|Achievement:
if ( (unsigned int)sub_10024A36C(a1->m_entries) )
{
v20 = 0;
do
{
v21 = (GJUserScore *)sub_10024A388(a1->m_entries, v20);
isCurrentUser = GJUserScore::isCurrentUser(v21);
if ( isCurrentUser )
break;
v20 = (unsigned int)(v20 + 1);
}
while ( (unsigned int)v20 < (unsigned int)sub_10024A36C(a1->m_entries) );
v23 = v20 - 1;
}
else
{
isCurrentUser = 0;
v23 = -1;
}
v35 = sub_10024A36C(a1->m_entries);
v36 = a1->m_tableView;
if ( v35 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v36, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v36);
if ( !isCurrentUser )
return;
if ( (unsigned int)sub_10024A36C(a1->m_entries) == 1 )
return;
v37 = a1->m_itemSeparation;
v38 = a1->m_height * 0.5;
if ( (float)(v37 * (float)v23) <= v38 )
return;
v39 = -(float)(v38 - (float)((float)(v23 + 2) * v37));
goto LABEL_71;
case SFX:
case SFX2:
m_cellDelegate = m_tableView->m_cellDelegate;
v25 = 0.0;
v26 = -1.0;
if ( !m_cellDelegate
|| !((unsigned int (__fastcall *)(TableViewCellDelegate *))m_cellDelegate->shouldSnapToSelected)(m_cellDelegate) )
{
v29 = 0;
goto LABEL_64;
}
v27 = ((__int64 (__fastcall *)(TableViewCellDelegate *))a1->m_tableView->m_cellDelegate->getSelectedCellIdx)(a1->m_tableView->m_cellDelegate);
if ( (unsigned int)sub_10024A36C(a1->m_entries) )
{
v28 = 0;
while ( *(_DWORD *)(sub_10024A388(a1->m_entries, v28) + 56) != v27 )
{
v28 = (unsigned int)(v28 + 1);
if ( (unsigned int)v28 >= (unsigned int)sub_10024A36C(a1->m_entries) )
{
v29 = 0;
v30 = v28 - 1;
goto LABEL_63;
}
}
v25 = (float)(v28 + 1);
v30 = v28 - 1;
v29 = 1;
}
else
{
v29 = 0;
v30 = -1;
}
LABEL_63:
v26 = (float)v30;
LABEL_64:
v44 = sub_10024A36C(a1->m_entries);
v45 = a1->m_tableView;
if ( v44 == 1 )
CCScrollLayerExt::moveToTopWithOffset(v45, a1->m_itemSeparation);
else
CCScrollLayerExt::moveToTop(v45);
if ( v29 )
{
if ( (unsigned int)sub_10024A36C(a1->m_entries) != 1 )
{
v37 = a1->m_itemSeparation;
v46 = a1->m_height * 0.5;
if ( (float)(v26 * v37) > v46 )
{
v39 = -(float)(v46 - (float)(v25 * v37));
LABEL_71:
v47 = v39 + (float)(v37 * -0.5);
v48 = a1->m_tableView;
v49 = *(_DWORD *)((__int64 (__fastcall *)(CCContentLayer *))v48->m_contentLayer->getPosition)(v48->m_contentLayer);
v50.n128_f32[0] = v47
+ *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_tableView->m_contentLayer->getPosition)(a1->m_tableView->m_contentLayer)
+ 4);
v51.n128_u32[0] = v49;
sub_100022980(v51, v50, &v53);
v34 = v48;
LABEL_72:
CCScrollLayerExt::setContentOffset(v34, v54, (bool)&v53);
}
}
}
return;
default:
BoomListView::setupList(a1, MaxY);
return;
}
}