//
// LevelLeaderboard::setupLeaderboard from 0x1003c8750 to 0x1003c88fe (430 bytes)
//
// 5 xrefs:
// > LevelLeaderboard::init @ 0x1003c7f5d
// > LevelLeaderboard::onUpdate @ 0x1003c84a8
// > LevelLeaderboard::loadScores @ 0x1003c86cf
// > LevelLeaderboard::loadLeaderboardFinished @ 0x1003c90f3
// > sub_1003C9150 @ 0x1003c9197
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:29:35 +0000
//
__int64 __fastcall LevelLeaderboard::setupLeaderboard(_QWORD *a1, __int64 a2, double a3)
{
__int64 v3; // r14
_QWORD *v4; // rbx
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rdi
unsigned int *v9; // rax
__int64 v10; // rcx
__int64 *v11; // rax
unsigned __int64 v12; // rcx
__int64 v13; // rdx
unsigned int v14; // ecx
char *v15; // rdi
_QWORD *v16; // rax
__int64 v17; // rbx
float v19; // [rsp+0h] [rbp-20h] BYREF
float v20[6]; // [rsp+8h] [rbp-18h] BYREF
v3 = a2;
v4 = a1;
if ( a1[88] )
{
v5 = cocos2d::CCDirector::sharedDirector(a1, a2);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 160LL))(v5);
a2 = a1[88];
cocos2d::CCTouchDispatcher::unregisterForcePrio(v6, a2);
a1 = (_QWORD *)a1[88];
(*(void (__fastcall **)(_QWORD *))(*a1 + 536LL))(a1);
v4[88] = 0;
}
v7 = cocos2d::CCDirector::sharedDirector(a1, a2);
cocos2d::CCDirector::getWinSize(v20, v7);
if ( v3 )
{
v8 = v4[85];
if ( v8 )
{
if ( (unsigned __int8)GJGameLevel::isPlatformer(v8, a3) )
{
if ( *((_DWORD *)v4 + 172) != 3 )
{
v9 = *(unsigned int **)(v3 + 56);
v10 = *v9;
if ( *v9 )
{
v11 = *((__int64 **)v9 + 2);
v12 = (unsigned __int64)&v11[v10 - 1];
do
{
v13 = *v11;
if ( !*v11 )
break;
*(_DWORD *)(v13 + 832) = 1;
*(_DWORD *)(v13 + 836) = *((_DWORD *)v4 + 173);
++v11;
}
while ( (unsigned __int64)v11 <= v12 );
}
}
}
}
v14 = 18;
if ( *((_DWORD *)v4 + 172) == 3 )
v14 = 31;
v15 = CustomListView::create(v3, 0, 0, v14, 220.0, 340.0, 0.0);
}
else
{
v15 = nullptr;
}
v16 = GJCommentListLayer::create((__int64)v15, 340.0, 220.0, (__int64)"Scores", 0xFF3E72BF, 1u);
v4[88] = v16;
(*(void (__fastcall **)(_QWORD, _QWORD *))(*(_QWORD *)v4[73] + 456LL))(v4[73], v16);
v17 = v4[88];
sub_100278250(&v19, (float)(v20[0] + -340.0) * 0.5, (float)((float)(v20[1] + -220.0) * 0.5) + -10.0);
return (*(__int64 (__fastcall **)(__int64, float *))(*(_QWORD *)v17 + 184LL))(v17, &v19);
}