//
// TopArtistsLayer::init from 0x1001a4740 to 0x1001a4d58 (1560 bytes)
//
// 2 xrefs:
// > TopArtistsLayer::create @ 0x1001a46f4
// > ??> @ 0x1007ad6d0
//
// 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
//
bool __fastcall TopArtistsLayer::init(TopArtistsLayer *a1)
{
_BOOL4 inited; // w19
cocos2d::CCDirector *v3; // x0
cocos2d::extension::CCScale9Sprite *v4; // x21
__n128 v5; // q0
__n128 v6; // q1
cocos2d::CCMenu *v7; // x0
cocos2d::CCLabelBMFont *v8; // x21
__n128 v9; // q0
__n128 v10; // q1
cocos2d::CCSprite *v11; // x0
CCMenuItemSpriteExtra *v12; // x21
cocos2d::CCMenu *m_buttonMenu; // x22
__n128 v14; // q0
__n128 v15; // q1
cocos2d::CCMenu *v16; // x21
float v17; // s8
cocos2d::CCSprite *v18; // x23
CCMenuItemSpriteExtra *v19; // x0
__n128 v20; // q0
CCMenuItemSpriteExtra *m_prevButton; // x23
__n128 v22; // q1
cocos2d::CCSprite *v23; // x22
CCMenuItemSpriteExtra *v24; // x0
__n128 v25; // q0
CCMenuItemSpriteExtra *m_nextButton; // x22
__n128 v27; // q1
LoadingCircle *v28; // x0
cocos2d::CCLabelBMFont *v29; // x0
__n128 v30; // q0
cocos2d::CCLabelBMFont *m_pageInfoLabel; // x21
__n128 v32; // q1
__n128 v33; // q0
cocos2d::CCLabelBMFont *v34; // x21
__n128 v35; // q1
GameLevelManager *v36; // x0
char *TopArtistsKey; // x0
GameLevelManager *v38; // x0
void **v39; // x1
cocos2d::CCArray *StoredOnlineLevels; // x21
GameLevelManager *v41; // x0
void **v42; // x1
char *PageInfo; // x0
void **v44; // x2
void **v45; // x2
GameLevelManager *v46; // x0
GameLevelManager *v47; // x0
void *__p[2]; // [xsp+0h] [xbp-A0h] BYREF
char v50; // [xsp+17h] [xbp-89h]
void *v51[2]; // [xsp+18h] [xbp-88h] BYREF
char v52; // [xsp+2Fh] [xbp-71h]
cocos2d::CCPoint v53; // [xsp+30h] [xbp-70h] BYREF
float v54; // [xsp+38h] [xbp-68h]
float v55; // [xsp+3Ch] [xbp-64h]
cocos2d::CCPoint v56; // 0:kr08_8.8
cocos2d::CCPoint v57; // 0:kr10_8.8
cocos2d::CCPoint v58; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v59; // 0:x3.16
cocos2d::SEL_MenuHandler v60; // 0:x3.16
cocos2d::SEL_MenuHandler v61; // 0:x3.16
cocos2d::CCRect v62; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
inited = FLAlertLayer::init_1(a1, 150);
if ( inited )
{
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
sub_100022990((float *)v51, 0.0, 0.0, 80.0, 80.0);
v4 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v62);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v4->setOpacity)(v4, 255);
sub_100022988((float *)v51, 440.0, 290.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v4->setContentSize)(v4, v51);
v5 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v4,
0xFFFFFFFFLL);
v5.n128_f32[0] = v54 * 0.5;
v6.n128_f32[0] = v55 * 0.5;
sub_100022980(v5, v6, v51);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v4->setPosition)(v4, v51);
v7 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v7;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v7,
10);
v8 = cocos2d::CCLabelBMFont::create_1("Featured Artists", "bigFont.fnt");
v9 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
20);
v9.n128_f32[0] = v54 * 0.5;
v10.n128_f32[0] = (float)((float)(v55 * 0.5) + 145.0) + -18.0;
sub_100022980(v9, v10, v51);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v8->setPosition)(v8, v51);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v8->setScale)(v8, 0.6);
a1->m_joystickConnected = -1;
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v59.ptr = (void (__cdecl *)(cocos2d::CCObject *))TopArtistsLayer::onClose;
v59.adj = 0;
v12 = CCMenuItemSpriteExtra::create(v11, nullptr, a1, v59);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v12);
CCMenuItemSpriteExtra::setSizeMult(v12, 1.6);
m_buttonMenu = a1->m_buttonMenu;
v14.n128_f32[0] = (float)((float)(v54 * 0.5) + -220.0) + 10.0;
v15.n128_f32[0] = (float)((float)(v55 * 0.5) + 145.0) + -10.0;
sub_100022980(v14, v15, &v53);
v56 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v53);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))v12->setPosition)(v12, v51, v56.x, v56.y);
v16 = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v16,
10);
v17 = v55 * 0.5;
v18 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v18->setScale)(v18, 0.8);
v60.ptr = (void (__cdecl *)(cocos2d::CCObject *))TopArtistsLayer::onPrevPage;
v60.adj = 0;
v19 = CCMenuItemSpriteExtra::create(v18, nullptr, a1, v60);
a1->m_prevButton = v19;
CCMenuItemSpriteExtra::setSizeMult(v19, 1.2);
v20 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v16->addChild)(v16, a1->m_prevButton);
m_prevButton = a1->m_prevButton;
v20.n128_f32[0] = (float)((float)(v54 * 0.5) + -220.0) + 22.0;
v22.n128_f32[0] = v17;
sub_100022980(v20, v22, &v53);
v57 = cocos2d::CCNode::convertToNodeSpace(v16, &v53);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))m_prevButton->setPosition)(
m_prevButton,
v51,
v57.x,
v57.y);
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v23->setScale)(v23, 0.8);
cocos2d::CCSprite::setFlipX(v23, 1);
v61.ptr = (void (__cdecl *)(cocos2d::CCObject *))TopArtistsLayer::onNextPage;
v61.adj = 0;
v24 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, v61);
a1->m_nextButton = v24;
CCMenuItemSpriteExtra::setSizeMult(v24, 1.2);
v25 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v16->addChild)(v16, a1->m_nextButton);
m_nextButton = a1->m_nextButton;
v25.n128_f32[0] = (float)((float)(v54 * 0.5) + 220.0) + -22.0;
v27.n128_f32[0] = v17;
sub_100022980(v25, v27, &v53);
v58 = cocos2d::CCNode::convertToNodeSpace(v16, &v53);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))m_nextButton->setPosition)(
m_nextButton,
v51,
v58.x,
v58.y);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_prevButton->setVisible)(a1->m_prevButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_nextButton->setVisible)(a1->m_nextButton, 0);
v28 = LoadingCircle::create();
a1->m_loadingCircle = v28;
v28->m_parentLayer = a1->m_mainLayer;
v28->m_fade = 0;
cocos2d::CCObject::retain(v28);
LoadingCircle::show(a1->m_loadingCircle);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 0);
v29 = cocos2d::CCLabelBMFont::create_1(" ", "goldFont.fnt");
a1->m_pageInfoLabel = v29;
v30 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v29);
m_pageInfoLabel = a1->m_pageInfoLabel;
v30.n128_f32[0] = (float)((float)(v54 * 0.5) + 220.0) + -8.0;
v32.n128_f32[0] = (float)((float)(v55 * 0.5) + 145.0) + -8.0;
sub_100022980(v30, v32, v51);
v33 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, void **))m_pageInfoLabel->setPosition)(m_pageInfoLabel, v51);
v34 = a1->m_pageInfoLabel;
v33.n128_u32[0] = 1.0;
v35.n128_u32[0] = 1.0;
sub_100022980(v33, v35, v51);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v34->setAnchorPoint)(v34, v51);
v36 = GameLevelManager::sharedState();
TopArtistsKey = (char *)GameLevelManager::getTopArtistsKey(v36, 0);
sub_100009900(v51, TopArtistsKey);
v38 = GameLevelManager::sharedState();
if ( v52 >= 0 )
v39 = v51;
else
v39 = (void **)v51[0];
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v38, (const char *)v39);
if ( StoredOnlineLevels )
{
v41 = GameLevelManager::sharedState();
if ( v52 >= 0 )
v42 = v51;
else
v42 = (void **)v51[0];
PageInfo = (char *)GameLevelManager::getPageInfo(v41, (const char *)v42);
sub_100009900(__p, PageInfo);
if ( v52 >= 0 )
v44 = v51;
else
v44 = (void **)v51[0];
((void (__fastcall *)(TopArtistsLayer *, void **, void **))a1->setupPageInfo)(a1, __p, v44);
if ( v50 < 0 )
operator delete(__p[0]);
if ( v52 >= 0 )
v45 = v51;
else
v45 = (void **)v51[0];
((void (__fastcall *)(TopArtistsLayer *, cocos2d::CCArray *, void **))a1->loadListFinished)(
a1,
StoredOnlineLevels,
v45);
}
else
{
v46 = GameLevelManager::sharedState();
GameLevelManager::makeTimeStamp(v46, "upd_artists");
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 1);
TopArtistsLayer::setupLeaderboard(a1, nullptr);
GameLevelManager::sharedState()->m_onlineListDelegate = &a1->OnlineListDelegate;
v47 = GameLevelManager::sharedState();
GameLevelManager::getTopArtists(v47, 0, 0);
}
if ( v52 < 0 )
operator delete(v51[0]);
}
return inited;
}