//
// TopArtistsLayer::init from 0x500d68 to 0x501234 (1228 bytes)
//
// 1 xrefs:
// > TopArtistsLayer::create @ 0x500ba8
//
// 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 TopArtistsLayer::init(TopArtistsLayer *a1)
{
int v2; // r10
cocos2d::CCDirector *v3; // r0
cocos2d::CCNode *v4; // r5
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCMenu *v7; // r0
cocos2d::CCLabelBMFont *v8; // r5
void (__fastcall *v9)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v10; // r0
CCMenuItemSpriteExtra *v11; // r7
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCMenu *v13; // r8
float v14; // s19
cocos2d::CCSprite *v15; // r7
CCMenuItemSpriteExtra *v16; // r0
cocos2d::CCSprite *v17; // r6
CCMenuItemSpriteExtra *v18; // r0
CCMenuItemSpriteExtra *m_nextButton; // r11
LoadingCircle *v20; // r0
cocos2d::CCLayer *m_mainLayer; // r3
LoadingCircle *m_loadingCircle; // r0
cocos2d::CCLabelBMFont *v23; // r0
cocos2d::CCLabelBMFont *m_pageInfoLabel; // r8
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCLabelBMFont *v26; // r8
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11
GameLevelManager *v28; // r0
char *TopArtistsKey; // r0
GameLevelManager *v30; // r0
cocos2d::CCArray *StoredOnlineLevels; // r5
void (__fastcall *setupPageInfo)(TopArtistsLayer *__hidden, std::string, const unsigned __int8 *); // r8
GameLevelManager *v33; // r0
char *PageInfo; // r0
GameLevelManager *v35; // r0
GameLevelManager *v36; // r0
float v38; // r2
float v39; // r3
cocos2d::CCMenu *m_buttonMenu; // [sp+8h] [bp-4Ch]
cocos2d::CCPoint *v41; // [sp+8h] [bp-4Ch]
cocos2d::CCPoint *v42; // [sp+8h] [bp-4Ch]
CCMenuItemSpriteExtra *m_prevButton; // [sp+Ch] [bp-48h]
cocos2d::CCSize v44; // [sp+14h] [bp-40h] BYREF
cocos2d::CCPoint v45; // [sp+1Ch] [bp-38h] BYREF
cocos2d::CCPoint v46; // [sp+24h] [bp-30h] BYREF
void (*v47)(TopArtistsLayer *, cocos2d::CCObject *); // [sp+2Ch] [bp-28h]
int v48; // [sp+30h] [bp-24h]
cocos2d::CCPoint v49; // [sp+34h] [bp-20h] BYREF
cocos2d::CCRect v50; // [sp+3Ch] [bp-18h] BYREF
cocos2d::CCSize v51; // 0:^0.8
cocos2d::CCRect v52; // 0:kr00_16.16
v2 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)150);
if ( v2 )
{
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v44, v3);
cocos2d::CCRect::CCRect(&v50, 0.0, 0.0, 80.0, 80.0);
v52.origin.x = v38;
v52.origin.y = v39;
v52.size = v51;
v4 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square02.png",
(const char *)&v50,
v52);
((void (__fastcall *)(cocos2d::CCNode *, int))v4->__vftable[1].~CCNode_0)(v4, 255);
setContentSize = v4->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v50, 440.0, 290.0);
setContentSize(v4, (const cocos2d::CCSize *)&v50);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v4, -1);
setPosition = v4->setPosition;
cocos2d::CCPoint::CCPoint(&v50.origin, v44.width * 0.5, v44.height * 0.5);
setPosition(v4, &v50.origin);
v7 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v7;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, 10);
v8 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, 20);
v9 = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v50.origin, v44.width * 0.5, (float)((float)(v44.height * 0.5) + 145.0) - 18.0);
v9(v8, &v50.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v8->setScale)(v8, 1058642330);
a1->m_joystickConnected = -1;
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v47 = TopArtistsLayer::onClose;
v48 = 0;
v11 = CCMenuItemSpriteExtra::create(
v10,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(TopArtistsLayer::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
CCMenuItemSpriteExtra::setSizeMult(v11, 1.6);
v12 = v11->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(
&v49,
(float)((float)(v44.width * 0.5) - 220.0) + 10.0,
(float)((float)(v44.height * 0.5) + 145.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v50.origin, m_buttonMenu, &v49);
v12(v11, &v50.origin);
v13 = cocos2d::CCMenu::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 10);
v14 = v44.height * 0.5;
v15 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v15->setScale)(v15, 1061997773);
LODWORD(v49.x) = TopArtistsLayer::onPrevPage;
v49.y = 0.0;
v16 = CCMenuItemSpriteExtra::create(
v15,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(TopArtistsLayer::onPrevPage, (unsigned int)a1));
a1->m_prevButton = v16;
CCMenuItemSpriteExtra::setSizeMult(v16, 1.2);
v13->addChild(v13, a1->m_prevButton);
m_prevButton = a1->m_prevButton;
v41 = (cocos2d::CCPoint *)m_prevButton->setPosition;
cocos2d::CCPoint::CCPoint(&v46, (float)((float)(v44.width * 0.5) - 220.0) + 22.0, v14);
cocos2d::CCNode::convertToNodeSpace(&v50.origin, v13, &v46);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *))v41)(m_prevButton, &v50);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v17->setScale)(v17, 1061997773);
cocos2d::CCSprite::setFlipX(v17, 1);
LODWORD(v50.origin.x) = TopArtistsLayer::onNextPage;
v50.origin.y = 0.0;
v18 = CCMenuItemSpriteExtra::create(
v17,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(TopArtistsLayer::onNextPage, (unsigned int)a1));
a1->m_nextButton = v18;
CCMenuItemSpriteExtra::setSizeMult(v18, 1.2);
v13->addChild(v13, a1->m_nextButton);
m_nextButton = a1->m_nextButton;
v42 = (cocos2d::CCPoint *)m_nextButton->setPosition;
cocos2d::CCPoint::CCPoint(&v45, (float)((float)(v44.width * 0.5) + 220.0) - 22.0, v14);
cocos2d::CCNode::convertToNodeSpace(&v46, v13, &v45);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))v42)(m_nextButton, &v46);
a1->m_prevButton->setVisible(a1->m_prevButton, 0);
a1->m_nextButton->setVisible(a1->m_nextButton, 0);
v20 = LoadingCircle::create();
m_mainLayer = a1->m_mainLayer;
a1->m_loadingCircle = v20;
v20->m_parentLayer = m_mainLayer;
m_loadingCircle = a1->m_loadingCircle;
m_loadingCircle->m_fade = 0;
cocos2d::CCObject::retain(m_loadingCircle);
LoadingCircle::show(a1->m_loadingCircle);
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
v23 = cocos2d::CCLabelBMFont::create();
a1->m_pageInfoLabel = v23;
a1->m_mainLayer->addChild(a1->m_mainLayer, v23);
m_pageInfoLabel = a1->m_pageInfoLabel;
v25 = m_pageInfoLabel->setPosition;
cocos2d::CCPoint::CCPoint(
&v46,
(float)((float)(v44.width * 0.5) + 220.0) - 8.0,
(float)((float)(v44.height * 0.5) + 145.0) - 8.0);
v25(m_pageInfoLabel, &v46);
v26 = a1->m_pageInfoLabel;
setAnchorPoint = v26->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v46, 1.0, 1.0);
setAnchorPoint(v26, &v46);
v28 = GameLevelManager::sharedState();
TopArtistsKey = (char *)GameLevelManager::getTopArtistsKey(v28, 0);
sub_776584((int)&v45, TopArtistsKey);
v30 = GameLevelManager::sharedState();
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v30, (const char *)LODWORD(v45.x));
if ( StoredOnlineLevels )
{
setupPageInfo = a1->setupPageInfo;
v33 = GameLevelManager::sharedState();
PageInfo = (char *)GameLevelManager::getPageInfo(v33, (const char *)LODWORD(v45.x));
sub_776584((int)&v46, PageInfo);
((void (__fastcall *)(TopArtistsLayer *, cocos2d::CCPoint *, _DWORD))setupPageInfo)(a1, &v46, LODWORD(v45.x));
sub_774008(&v46);
a1->loadListFinished(a1, StoredOnlineLevels, (const unsigned __int8 *)LODWORD(v45.x));
}
else
{
v35 = GameLevelManager::sharedState();
GameLevelManager::makeTimeStamp(v35, "upd_artists");
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 1);
TopArtistsLayer::setupLeaderboard(a1, nullptr);
GameLevelManager::sharedState()->m_onlineListDelegate = &a1->OnlineListDelegate;
v36 = GameLevelManager::sharedState();
GameLevelManager::getTopArtists(v36, 0, 0);
}
sub_774008(&v45);
}
return v2;
}