//
// TopArtistsLayer::init from 0x14066dfc0 to 0x14066e789 (1993 bytes)
//
// 5 xrefs:
// > NewgroundsInfoLayer::onArtists @ 0x1401670f7
// > NewgroundsInfoLayer::onArtists @ 0x1401670fe
// > NewgroundsInfoLayer::onArtists @ 0x1401670e8
// > ??> @ 0x1408336f8
// > ??> @ 0x1409321ec
//
// 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 11:35:53 +0000
//
// Hidden C++ exception states: #wind=7
bool __fastcall TopArtistsLayer::init(__int64 a1)
{
bool result; // al
__int64 v3; // rcx
__int64 v4; // rax
__int64 v5; // rax
__int64 *v6; // rdi
__int64 v7; // rdx
void (__fastcall *v8)(__int64 *, __int64); // r8
__int64 v9; // rbx
__int64 v10; // rax
size_t v11; // r14
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rcx
__int64 v15; // rax
struct cocos2d::CCLabelBMFont *v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
int v19; // eax
cocos2d::CCObject *v20; // rsi
__int64 v21; // rdi
__int64 v22; // rbx
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rcx
__int64 v26; // rsi
float v27; // xmm8_4
struct cocos2d::CCSprite *v28; // rax
cocos2d::CCObject *v29; // rax
__int64 v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
__int64 v33; // rax
cocos2d::CCSprite *v34; // rbx
cocos2d::CCObject *v35; // rax
__int64 v36; // rdi
__int64 v37; // rbx
__int64 v38; // rax
__int64 v39; // rax
cocos2d::CCLayerColor *v40; // rax
struct cocos2d::CCLabelBMFont *v41; // rax
__int64 v42; // rdi
__int64 v43; // rbx
__int64 v44; // rax
__int64 v45; // rdi
__int64 v46; // rbx
__int64 v47; // rax
cocos2d::CCString *v48; // rax
const char *CString; // rax
size_t v50; // r8
__int128 *v51; // rbx
__int64 v52; // rcx
__int64 StoredOnlineLevels; // rdi
__int64 v54; // rcx
__int128 *v55; // rbx
char *PageInfo; // rax
__int128 *v57; // r8
__int128 *v58; // r8
__int64 v59; // rdx
__int64 v60; // r15
__int64 v61; // rcx
float v62; // [rsp+38h] [rbp-59h] BYREF
float v63; // [rsp+3Ch] [rbp-55h]
_BYTE v64[8]; // [rsp+40h] [rbp-51h] BYREF
__int64 v65[2]; // [rsp+48h] [rbp-49h] BYREF
__int128 v66; // [rsp+58h] [rbp-39h] BYREF
__int64 v67; // [rsp+68h] [rbp-29h]
__int64 v68; // [rsp+70h] [rbp-21h]
__int128 v69; // [rsp+78h] [rbp-19h] BYREF
__int64 v70; // [rsp+88h] [rbp-9h]
unsigned __int64 v71; // [rsp+90h] [rbp-1h]
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
v4 = cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4, &v62);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, 0.0, 0.0, 80.0, 80.0);
v6 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v5);
v7 = v6[40];
v8 = *(void (__fastcall **)(__int64 *, __int64))(v7 + 40);
LOBYTE(v7) = -1;
v8(v6 + 40, v7);
v9 = *v6;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v64, 440.0, 290.0);
(*(void (__fastcall **)(__int64 *, __int64))(v9 + 312))(v6, v10);
v11 = -1;
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v6,
0xFFFFFFFFLL);
v12 = *v6;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, v62 * 0.5, v63 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v12 + 184))(v6, v13);
v15 = cocos2d::CCMenu::create(v14);
*(_QWORD *)(a1 + 552) = v15;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v15, 10);
v16 = cocos2d::CCLabelBMFont::create("Featured Artists", &qword_140704F78);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v16,
20);
v17 = *(_QWORD *)v16;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, v62 * 0.5, (float)((float)(v63 * 0.5) + 145.0) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v17 + 184))(v16, v18);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v16 + 160LL))(v16);
*(_DWORD *)(a1 + 640) = -1;
v19 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v20 = CCMenuItemSpriteExtra::create(v19, 0, a1, (__int64)PagedListPopup::onClose);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v20);
*((_DWORD *)v20 + 93) = 1070386381;
v21 = *(_QWORD *)v20;
v22 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v64,
(float)((float)(v62 * 0.5) - 220.0) + 10.0,
(float)((float)(v63 * 0.5) + 145.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(v22, v65, v23);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v21 + 184))(v20, v24);
v26 = cocos2d::CCMenu::create(v25);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v26, 10);
v27 = v63 * 0.5;
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
LODWORD(v22) = (_DWORD)v28;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v28 + 160LL))(v28);
v29 = CCMenuItemSpriteExtra::create(v22, 0, a1, (__int64)TopArtistsLayer::onPrevPage);
*(_QWORD *)(a1 + 704) = v29;
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v26 + 464LL))(v26, v29);
v30 = **(_QWORD **)(a1 + 704);
v31 = *(_QWORD *)(a1 + 704);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (float)((float)(v62 * 0.5) - 220.0) + 22.0, v27);
cocos2d::CCNode::convertToNodeSpace(v26, v64, v32);
(*(void (__fastcall **)(__int64, __int64))(v30 + 184))(v31, v33);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v34 + 160LL))(v34);
cocos2d::CCSprite::setFlipX(v34, 1);
v35 = CCMenuItemSpriteExtra::create((int)v34, 0, a1, (__int64)TopArtistsLayer::onNextPage);
*(_QWORD *)(a1 + 696) = v35;
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v26 + 464LL))(v26, v35);
v36 = **(_QWORD **)(a1 + 696);
v37 = *(_QWORD *)(a1 + 696);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (float)((float)(v62 * 0.5) + 220.0) - 22.0, v27);
cocos2d::CCNode::convertToNodeSpace(v26, v64, v38);
(*(void (__fastcall **)(__int64, __int64))(v36 + 184))(v37, v39);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 696) + 336LL))(*(_QWORD *)(a1 + 696), 0);
v40 = LoadingCircle::create();
*(_QWORD *)(a1 + 688) = v40;
*((_QWORD *)v40 + 69) = *(_QWORD *)(a1 + 584);
*(_BYTE *)(*(_QWORD *)(a1 + 688) + 560LL) = 0;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 688));
LoadingCircle::show(*(_QWORD *)(a1 + 688));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 688) + 336LL))(*(_QWORD *)(a1 + 688), 0);
v41 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
*(_QWORD *)(a1 + 720) = v41;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v41);
v42 = **(_QWORD **)(a1 + 720);
v43 = *(_QWORD *)(a1 + 720);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v65,
(float)((float)(v62 * 0.5) + 220.0) - 8.0,
(float)((float)(v63 * 0.5) + 145.0) - 8.0);
(*(void (__fastcall **)(__int64, __int64))(v42 + 184))(v43, v44);
v45 = **(_QWORD **)(a1 + 720);
v46 = *(_QWORD *)(a1 + 720);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, 1.0, 1.0);
(*(void (__fastcall **)(__int64, __int64))(v45 + 288))(v46, v47);
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65[0] = (__int64)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v65[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
v48 = cocos2d::CCString::createWithFormat("topArtists_%i", 0);
CString = cocos2d::CCString::getCString(v48);
v69 = 0;
v70 = 0;
v71 = 0;
v50 = -1;
do
++v50;
while ( CString[v50] );
sub_14003D230(&v69, CString, v50);
v51 = &v69;
if ( v71 > 0xF )
v51 = (__int128 *)v69;
v52 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65[0] = (__int64)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v65[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v52 = *(_QWORD *)&qword_14090BFB0;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v52, v51);
v54 = *(_QWORD *)&qword_14090BFB0;
if ( StoredOnlineLevels )
{
v55 = &v69;
if ( v71 > 0xF )
v55 = (__int128 *)v69;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65[0] = (__int64)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v65[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v54 = *(_QWORD *)&qword_14090BFB0;
}
PageInfo = GameLevelManager::getPageInfo(v54, v55);
v66 = 0;
v67 = 0;
v68 = 0;
do
++v11;
while ( PageInfo[v11] );
sub_14003D230(&v66, PageInfo, v11);
v57 = &v69;
if ( v71 > 0xF )
v57 = (__int128 *)v69;
(*(void (__fastcall **)(__int64, __int128 *, __int128 *))(*(_QWORD *)(a1 + 664) + 16LL))(a1 + 664, &v66, v57);
v58 = &v69;
if ( v71 > 0xF )
v58 = (__int128 *)v69;
(**(void (__fastcall ***)(__int64, __int64, __int128 *))(a1 + 664))(a1 + 664, StoredOnlineLevels, v58);
}
else
{
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65[0] = (__int64)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v65[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v54 = *(_QWORD *)&qword_14090BFB0;
}
GameLevelManager::makeTimeStamp(v54, "upd_artists");
LOBYTE(v59) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 688) + 336LL))(*(_QWORD *)(a1 + 688), v59);
TopArtistsLayer::setupLeaderboard(a1, 0);
v60 = a1 + 664;
v61 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65[0] = (__int64)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v65[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v61 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v61 + 1584) = v60;
GameLevelManager::getTopArtists((cocos2d::CCActionManager **)v61, 0, 0);
}
sub_14003D310((__int64)&v69);
return 1;
}
return result;
}