//
// LevelLeaderboard::setupLeaderboard from 0x4e4fd8 to 0x4e5126 (334 bytes)
//
// 4 xrefs:
// > LevelLeaderboard::onUpdate @ 0x4e51a4
// > LevelLeaderboard::loadLeaderboardFinished @ 0x4e51f8
// > LevelLeaderboard::loadScores @ 0x4e52ec
// > LevelLeaderboard::init @ 0x4e5d00
//
// 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 LevelLeaderboard::setupLeaderboard(LevelLeaderboard *a1, cocos2d::CCArray *a2)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCTouchDispatcher *v5; // r0
cocos2d::CCDirector *v6; // r0
GJGameLevel *m_level; // r0
cocos2d::ccArray *data; // r2
int v9; // r3
cocos2d::CCObject **arr; // r2
cocos2d::CCObject **v11; // r3
CustomListView *v12; // r0
GJCommentListLayer *v13; // r0
GJCommentListLayer *m_list; // r5
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
int v16; // r1
int v17; // t1
LevelLeaderboardMode m_mode; // r7
cocos2d::CCSize v19; // [sp+14h] [bp-18h] BYREF
cocos2d::CCPoint v20; // [sp+1Ch] [bp-10h] BYREF
if ( a1->m_list )
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = v4->getTouchDispatcher(v4);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v5, a1->m_list);
a1->m_list->removeMeAndCleanup(a1->m_list);
a1->m_list = nullptr;
}
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v19, v6);
if ( a2 )
{
m_level = a1->m_level;
if ( m_level )
{
if ( GJGameLevel::isPlatformer(m_level) && a1->m_type != Local )
{
data = a2->data;
if ( data->num )
{
v9 = data->num + 0x40000000;
arr = data->arr;
v11 = &arr[v9 - 1];
while ( arr <= v11 )
{
v17 = (int)*arr++;
v16 = v17;
if ( !v17 )
break;
m_mode = a1->m_mode;
*(_DWORD *)(v16 + 484) = 1;
*(_DWORD *)(v16 + 488) = m_mode;
}
}
}
}
v12 = CustomListView::create(a2, (BoomListType)0, 220.0, 340.0);
}
else
{
v12 = nullptr;
}
v13 = GJCommentListLayer::create(v12, "Scores", (cocos2d::ccColor4B)-12684609, 340.0, 220.0, 1);
a1->m_list = v13;
a1->m_mainLayer->addChild(a1->m_mainLayer, v13);
m_list = a1->m_list;
setPosition = m_list->setPosition;
cocos2d::CCPoint::CCPoint(&v20, (float)(v19.width - 340.0) * 0.5, (float)((float)(v19.height - 220.0) * 0.5) - 10.0);
setPosition(m_list, &v20);
}