//
// LevelLeaderboard::setupLeaderboard from 0x140302d40 to 0x140302f06 (454 bytes)
//
// 6 xrefs:
// > LevelLeaderboard::init @ 0x140301bdb
// > LevelLeaderboard::loadScores @ 0x140302506
// > LevelLeaderboard::onUpdate @ 0x140302913
// > LevelLeaderboard::loadLeaderboardFinished @ 0x140302bdf
// > ??> @ 0x1406d4400
// > ??> @ 0x1406d440c
//
// 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)
{
CustomListView *v2; // rsi
__int64 v5; // rax
cocos2d::CCTouchDispatcher *v6; // rax
cocos2d::CCDirector *v7; // rax
const char *v8; // rdx
GJGameLevel *m_level; // rax
cocos2d::ccArray *data; // rcx
__int64 num; // rax
cocos2d::CCObject **arr; // rcx
cocos2d::CCObject **i; // r8
cocos2d::CCObject *v14; // rdx
BoomListType v15; // eax
GJCommentListLayer *v16; // rax
cocos2d::CCLayer *m_mainLayer; // rcx
float v18; // xmm0_4
GJCommentListLayer_vtbl *v19; // rbx
const cocos2d::CCPoint *v20; // rax
int v21; // [rsp+20h] [rbp-38h]
float v22; // [rsp+60h] [rbp+8h]
v2 = nullptr;
if ( a1->m_list )
{
v5 = cocos2d::CCDirector::sharedDirector(a1);
v6 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 144LL))(v5);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v6, a1->m_list);
a1->m_list->removeMeAndCleanup(a1->m_list);
a1->m_list = nullptr;
}
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v7);
if ( a2 )
{
m_level = a1->m_level;
if ( m_level )
{
if ( m_level->m_levelLength == 5 && a1->m_type != Local )
{
data = a2->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; v14[16].m_nLuaID = a1->m_mode )
{
v14 = *arr;
if ( !*arr )
break;
++arr;
v14[16].m_uID = 1;
}
}
}
}
v15 = Comment4|Achievement;
if ( a1->m_type == Local )
v15 = LocalLevelScore;
v2 = CustomListView::create(a2, nullptr, 220.0, 340.0, v21, v15, 0.0);
}
v16 = GJCommentListLayer::create(v2, v8, (cocos2d::ccColor4B)-12684609, 340.0, 220.0, 1);
m_mainLayer = a1->m_mainLayer;
a1->m_list = v16;
v18 = ((float (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *))m_mainLayer->addChild_1)(m_mainLayer, v16);
v19 = a1->m_list->__vftable;
cocos2d::CCPoint::CCPoint(v18, (float)(v22 - 340.0) * 0.5);
v19->setPosition_0(a1->m_list, v20);
}