//
// LeaderboardsLayer::init from 0x100513350 to 0x100513c59 (2313 bytes)
//
// 2 xrefs:
// > LeaderboardsLayer::scene @ 0x1005131e5
// > LeaderboardsLayer::create @ 0x10051330f
//
// 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:31:37 +0000
//
bool __fastcall LeaderboardsLayer::init(__int64 a1, int a2, unsigned int a3, double a4)
{
bool result; // al
unsigned int v7; // r15d
__int64 v8; // r12
__int64 v9; // rax
char *v10; // rsi
double v11; // xmm0_8
__int64 v12; // r12
__int64 v13; // rax
char *v14; // rsi
double v15; // xmm0_8
__int64 v16; // r12
__int64 v17; // rax
char *v18; // rsi
double v19; // xmm0_8
__int64 v20; // r12
__int64 v21; // rax
char *v22; // rsi
double v23; // xmm0_8
__int64 v24; // r12
__int64 v25; // rax
char *v26; // rsi
double v27; // xmm0_8
__int64 v28; // r12
__int64 v29; // rax
char *v30; // rsi
double v31; // xmm0_8
__int64 v32; // r12
__int64 v33; // rax
char *v34; // rsi
double v35; // xmm0_8
__int64 v36; // r12
__int64 v37; // rax
char *v38; // rsi
double v39; // xmm0_8
__int64 v40; // r12
__int64 v41; // rax
char *v42; // rsi
double v43; // xmm0_8
__int64 v44; // r12
__int64 v45; // rax
char *v46; // rsi
double v47; // xmm0_8
__int64 v48; // r12
__int64 v49; // rax
char *v50; // rsi
double v51; // xmm0_8
__int64 v52; // r12
__int64 v53; // rax
char *v54; // rsi
__int64 v55; // rax
float *v56; // r12
double v57; // xmm0_8
char *v58; // r13
__int64 v59; // rax
__int64 v60; // rax
float v61; // xmm1_4
double v62; // xmm0_8
unsigned __int8 *v63; // r12
__int64 v64; // rax
__int64 v65; // rax
float v66; // xmm1_4
_QWORD *v67; // rax
char *v68; // r12
__int64 v69; // rdi
__int64 v70; // rdx
__int64 v71; // rcx
__int64 v72; // r12
double v73; // xmm0_8
char *v74; // rax
void *v75; // r14
__int64 v76; // rax
__int64 v77; // rax
float v78; // xmm1_4
double v79; // xmm0_8
char *v80; // rax
void *v81; // r14
int v82; // edx
int v83; // ecx
int v84; // r8d
int v85; // r9d
__int64 v86; // r15
__int64 v87; // rax
__int64 v88; // rax
float v89; // xmm1_4
double v90; // xmm0_8
__int128 v91; // [rsp+0h] [rbp-70h] BYREF
void *v92; // [rsp+10h] [rbp-60h]
unsigned int v93; // [rsp+1Ch] [rbp-54h]
__int64 v94; // [rsp+20h] [rbp-50h] BYREF
bool v95; // [rsp+2Bh] [rbp-45h]
float v96; // [rsp+2Ch] [rbp-44h]
void *v97[2]; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
result = cocos2d::CCLayer::init((_WORD *)a1);
if ( result )
{
v95 = result;
v7 = (a2 == 0) + a2;
*(_BYTE *)(GameManager::sharedState() + 712) = 0;
*(_DWORD *)(GameManager::sharedState() + 708) = 6;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1);
if ( !*(_BYTE *)(GameManager::sharedState() + 656) )
{
v8 = GameLevelManager::sharedState(a4);
v9 = GameLevelManager::sharedState(a4);
GameLevelManager::getLeaderboardKey(v97, v9, 1, 0);
if ( ((__int64)v97[0] & 1) != 0 )
v10 = (char *)__p;
else
v10 = (char *)v97 + 1;
v11 = GameLevelManager::resetTimerForKey(v8, v10);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v12 = GameLevelManager::sharedState(v11);
v13 = GameLevelManager::sharedState(v11);
GameLevelManager::getLeaderboardKey(v97, v13, 1, 1);
if ( ((__int64)v97[0] & 1) != 0 )
v14 = (char *)__p;
else
v14 = (char *)v97 + 1;
v15 = GameLevelManager::resetTimerForKey(v12, v14);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v16 = GameLevelManager::sharedState(v15);
v17 = GameLevelManager::sharedState(v15);
GameLevelManager::getLeaderboardKey(v97, v17, 1, 2);
if ( ((__int64)v97[0] & 1) != 0 )
v18 = (char *)__p;
else
v18 = (char *)v97 + 1;
v19 = GameLevelManager::resetTimerForKey(v16, v18);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v20 = GameLevelManager::sharedState(v19);
v21 = GameLevelManager::sharedState(v19);
GameLevelManager::getLeaderboardKey(v97, v21, 1, 3);
if ( ((__int64)v97[0] & 1) != 0 )
v22 = (char *)__p;
else
v22 = (char *)v97 + 1;
v23 = GameLevelManager::resetTimerForKey(v20, v22);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v24 = GameLevelManager::sharedState(v23);
v25 = GameLevelManager::sharedState(v23);
GameLevelManager::getLeaderboardKey(v97, v25, 4, 0);
if ( ((__int64)v97[0] & 1) != 0 )
v26 = (char *)__p;
else
v26 = (char *)v97 + 1;
v27 = GameLevelManager::resetTimerForKey(v24, v26);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v28 = GameLevelManager::sharedState(v27);
v29 = GameLevelManager::sharedState(v27);
GameLevelManager::getLeaderboardKey(v97, v29, 4, 1);
if ( ((__int64)v97[0] & 1) != 0 )
v30 = (char *)__p;
else
v30 = (char *)v97 + 1;
v31 = GameLevelManager::resetTimerForKey(v28, v30);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v32 = GameLevelManager::sharedState(v31);
v33 = GameLevelManager::sharedState(v31);
GameLevelManager::getLeaderboardKey(v97, v33, 4, 2);
if ( ((__int64)v97[0] & 1) != 0 )
v34 = (char *)__p;
else
v34 = (char *)v97 + 1;
v35 = GameLevelManager::resetTimerForKey(v32, v34);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v36 = GameLevelManager::sharedState(v35);
v37 = GameLevelManager::sharedState(v35);
GameLevelManager::getLeaderboardKey(v97, v37, 4, 3);
if ( ((__int64)v97[0] & 1) != 0 )
v38 = (char *)__p;
else
v38 = (char *)v97 + 1;
v39 = GameLevelManager::resetTimerForKey(v36, v38);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v40 = GameLevelManager::sharedState(v39);
v41 = GameLevelManager::sharedState(v39);
GameLevelManager::getLeaderboardKey(v97, v41, 2, 0);
if ( ((__int64)v97[0] & 1) != 0 )
v42 = (char *)__p;
else
v42 = (char *)v97 + 1;
v43 = GameLevelManager::resetTimerForKey(v40, v42);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v44 = GameLevelManager::sharedState(v43);
v45 = GameLevelManager::sharedState(v43);
GameLevelManager::getLeaderboardKey(v97, v45, 2, 1);
if ( ((__int64)v97[0] & 1) != 0 )
v46 = (char *)__p;
else
v46 = (char *)v97 + 1;
v47 = GameLevelManager::resetTimerForKey(v44, v46);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v48 = GameLevelManager::sharedState(v47);
v49 = GameLevelManager::sharedState(v47);
GameLevelManager::getLeaderboardKey(v97, v49, 2, 2);
if ( ((__int64)v97[0] & 1) != 0 )
v50 = (char *)__p;
else
v50 = (char *)v97 + 1;
v51 = GameLevelManager::resetTimerForKey(v48, v50);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
v52 = GameLevelManager::sharedState(v51);
v53 = GameLevelManager::sharedState(v51);
GameLevelManager::getLeaderboardKey(v97, v53, 2, 3);
if ( ((__int64)v97[0] & 1) != 0 )
v54 = (char *)__p;
else
v54 = (char *)v97 + 1;
GameLevelManager::resetTimerForKey(v52, v54);
if ( ((__int64)v97[0] & 1) != 0 )
operator delete(__p);
}
v93 = a3;
v55 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v97, v55);
v56 = (float *)cocos2d::CCSprite::create_1((__int64)"GJ_gradientBG.png");
sub_100278250((float *)&v94, 0.0, 0.0);
(*(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v56 + 296LL))(v56, &v94);
(*(void (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v56, 4294967294LL);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v56 + 128LL))(v56, (float)(*(float *)v97 + 10.0) / v56[108]);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v56 + 144LL))(
v56,
(float)(*((float *)v97 + 1) + 10.0) / v56[109]);
sub_100278250((float *)&v94, -5.0, -5.0);
(*(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v56 + 184LL))(v56, &v94);
BYTE2(v94) = -1;
LOWORD(v94) = 26112;
v57 = (*(double (__fastcall **)(float *, __int64 *))(*(_QWORD *)v56 + 960LL))(v56, &v94);
v58 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_sideArt_001.png", v57);
sub_100278250((float *)&v94, 0.0, 0.0);
(*(void (__fastcall **)(char *, __int64 *))(*(_QWORD *)v58 + 296LL))(v58, &v94);
v59 = cocos2d::CCDirector::sharedDirector();
v96 = sub_100479760(v59) + -1.0;
v60 = cocos2d::CCDirector::sharedDirector();
v61 = sub_100479750(v60) + -1.0;
sub_100278250((float *)&v94, v96, v61);
(*(void (__fastcall **)(char *, __int64 *))(*(_QWORD *)v58 + 184LL))(v58, &v94);
v62 = (*(double (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v58, 1);
v63 = (unsigned __int8 *)cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_sideArt_001.png", v62);
sub_100278250((float *)&v94, 1.0, 0.0);
(*(void (__fastcall **)(unsigned __int8 *, __int64 *))(*(_QWORD *)v63 + 296LL))(v63, &v94);
v64 = cocos2d::CCDirector::sharedDirector();
v96 = sub_100479770(v64) + 1.0;
v65 = cocos2d::CCDirector::sharedDirector();
v66 = sub_100479750(v65) + -1.0;
sub_100278250((float *)&v94, v96, v66);
(*(void (__fastcall **)(unsigned __int8 *, __int64 *))(*(_QWORD *)v63 + 184LL))(v63, &v94);
cocos2d::CCSprite::setFlipX(v63, 1u);
(*(void (__fastcall **)(__int64, unsigned __int8 *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v63, 1);
v67 = LoadingCircle::create();
*(_QWORD *)(a1 + 480) = v67;
v67[69] = a1;
*((_BYTE *)v67 + 560) = 0;
cocos2d::CCObject::retain((__int64)v67);
LoadingCircle::show(*(_QWORD *)(a1 + 480));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 480) + 344LL))(*(_QWORD *)(a1 + 480), 0);
v92 = operator new(0x20u);
*(_QWORD *)&v91 = 33;
*((_QWORD *)&v91 + 1) = 31;
strcpy((char *)v92, "No Internet connection!");
sub_100278250((float *)&v94, 0.5, 1.0);
v68 = TextArea::create(&v91, (__int64)"bigFont.fnt", &v94, 0, 0, 1.0, 600.0, 20.0);
*(_QWORD *)(a1 + 488) = v68;
if ( (v91 & 1) != 0 )
{
operator delete(v92);
v68 = *(char **)(a1 + 488);
}
*((_DWORD *)v68 + 162) = 1106247680;
sub_100278250((float *)&v94, *(float *)v97 * 0.5, (float)(0.5 * *((float *)v97 + 1)) + 10.0);
(*(void (__fastcall **)(char *, __int64 *))(*(_QWORD *)v68 + 184LL))(v68, &v94);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 488) + 160LL))(*(_QWORD *)(a1 + 488), 0.60000002);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 488), 2);
v69 = *(_QWORD *)(a1 + 488);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v69 + 344LL))(v69, 0);
v72 = cocos2d::CCMenu::create(v69, 0, v70, v71);
v73 = (*(double (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v72, 10);
v74 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_infoIcon_001.png", v73);
v75 = CCMenuItemSpriteExtra::create((__int64)v74, 0, a1, (__int64)LeaderboardsLayer::onInfo, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v75, 2.0);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v72 + 456LL))(v72, v75);
v76 = cocos2d::CCDirector::sharedDirector();
v96 = sub_100479760(v76) + 30.0;
v77 = cocos2d::CCDirector::sharedDirector();
v78 = sub_100479750(v77) + 30.0;
sub_100278250((float *)&v94, v96, v78);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v72 + 184LL))(v72, &v94);
LeaderboardsLayer::setupTabs(a1);
v79 = LeaderboardsLayer::selectLeaderboard(a1, v7, v93);
v80 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_arrow_01_001.png", v79);
v81 = CCMenuItemSpriteExtra::create((__int64)v80, 0, a1, (__int64)LeaderboardsLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v81, 1.6);
v86 = sub_1008735E0((_DWORD)v81, 0, v82, v83, v84, v85);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v86, 1);
v87 = cocos2d::CCDirector::sharedDirector();
v96 = sub_100479760(v87) + 24.0;
v88 = cocos2d::CCDirector::sharedDirector();
v89 = sub_100479740(v88) + -23.0;
*(_QWORD *)&v90 = LODWORD(v96);
sub_100278250((float *)&v94, v96, v89);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v86 + 184LL))(v86, &v94);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, (__int64)v81, v90);
return v95;
}
return result;
}