//
// LevelLeaderboard::setupLeaderboard from 0x1003db770 to 0x1003db91e (430 bytes)
//
// 5 xrefs:
// > LevelLeaderboard::init @ 0x1003daf7d
// > LevelLeaderboard::onUpdate @ 0x1003db4c8
// > LevelLeaderboard::loadScores @ 0x1003db6ef
// > LevelLeaderboard::loadLeaderboardFinished @ 0x1003dc113
// > sub_1003DC170 @ 0x1003dc1b7
//
// 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 LevelLeaderboard::setupLeaderboard(LevelLeaderboard *a1, cocos2d::CCArray *a2)
{
cocos2d::CCDirector *v3; // rax
cocos2d::CCTouchDispatcher *v4; // rax
GJGameLevel *m_level; // rdi
cocos2d::ccArray *data; // rax
__int64 num; // rcx
cocos2d::CCObject **arr; // rax
unsigned __int64 v9; // rcx
cocos2d::CCObject *v10; // rdx
BoomListType v11; // ecx
CustomListView *v12; // rdi
GJCommentListLayer *v13; // rax
GJCommentListLayer *m_list; // rbx
float v15; // [rsp+0h] [rbp-20h] BYREF
float v16[6]; // [rsp+8h] [rbp-18h] BYREF
if ( a1->m_list )
{
v3 = cocos2d::CCDirector::sharedDirector();
v4 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v3->getTouchDispatcher)(v3);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v4, a1->m_list);
((void (__fastcall *)(GJCommentListLayer *))a1->m_list->removeMeAndCleanup)(a1->m_list);
a1->m_list = nullptr;
}
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v16);
if ( a2 )
{
m_level = a1->m_level;
if ( m_level )
{
if ( GJGameLevel::isPlatformer(m_level) && a1->m_type != Local )
{
data = a2->data;
num = data->num;
if ( data->num )
{
arr = data->arr;
v9 = (unsigned __int64)&arr[num - 1];
do
{
v10 = *arr;
if ( !*arr )
break;
v10[14].m_nTag = 1;
v10[14].m_uReference = a1->m_mode;
++arr;
}
while ( (unsigned __int64)arr <= v9 );
}
}
}
v11 = Comment4|Achievement;
if ( a1->m_type == Local )
v11 = LocalLevelScore;
v12 = CustomListView::create(a2, nullptr, 220.0, 340.0, 0, v11, 0.0);
}
else
{
v12 = nullptr;
}
v13 = GJCommentListLayer::create(v12, "Scores", (cocos2d::ccColor4B)-12684609, 340.0, 220.0, 1);
a1->m_list = v13;
((void (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v13);
m_list = a1->m_list;
sub_10028CBE0(&v15, (float)(v16[0] + -340.0) * 0.5, (float)((float)(v16[1] + -220.0) * 0.5) + -10.0);
((void (__fastcall *)(GJCommentListLayer *, float *))m_list->setPosition)(m_list, &v15);
}