//
// TopArtistsLayer::init from 0x1404cac10 to 0x1404cb3a6 (1942 bytes)
//
// 5 xrefs:
// > NewgroundsInfoLayer::onArtists @ 0x1400c6069
// > NewgroundsInfoLayer::onArtists @ 0x1400c6070
// > NewgroundsInfoLayer::onArtists @ 0x1400c605a
// > ??> @ 0x1406214c0
// > ??> @ 0x1406dd37c
//
// 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
//
// Hidden C++ exception states: #wind=7
bool TopArtistsLayer::init(TopArtistsLayer *a1)
{
bool result; // al
__int64 v3; // rcx
cocos2d::CCDirector *v4; // rax
struct cocos2d::CCRect *v5; // rax
struct cocos2d::extension::CCScale9Sprite *v6; // rdi
__int64 v7; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v8; // rbx
const cocos2d::CCSize *v9; // rax
size_t v10; // rsi
float v11; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v12; // rbx
const cocos2d::CCPoint *v13; // rax
__int64 v14; // rcx
cocos2d::CCMenu *v15; // rax
struct cocos2d::CCLabelBMFont *v16; // rdi
float v17; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
struct cocos2d::CCSprite *v20; // rax
CCMenuItemSpriteExtra *v21; // rdi
float v22; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v23; // rbx
struct cocos2d::CCPoint v24; // rax
__int64 v25; // rcx
cocos2d::CCNode *v26; // rdi
struct cocos2d::CCSprite *v27; // rbx
CCMenuItemSpriteExtra *v28; // rax
float v29; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v30; // rbx
struct cocos2d::CCPoint v31; // rax
cocos2d::CCSprite *v32; // rbx
CCMenuItemSpriteExtra *v33; // rax
float v34; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v35; // rbx
struct cocos2d::CCPoint v36; // rax
LoadingCircle *v37; // rax
cocos2d::CCLabelBMFont *v38; // rax
float v39; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v40; // rbx
__int64 v41; // rax
float v42; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v43; // rbx
const cocos2d::CCPoint *v44; // rax
cocos2d::CCString *v45; // rax
const char *CString; // rax
size_t v47; // r8
const char *v48; // rbx
GameLevelManager *v49; // rcx
cocos2d::CCArray *StoredOnlineLevels; // rdi
GameLevelManager *v51; // rcx
const char *v52; // rbx
const char *PageInfo; // rax
const char *v54; // r8
const char *v55; // r8
_BOOL8 v56; // rdx
OnlineListDelegate *v57; // r14
GameLevelManager *v58; // rcx
float v59; // [rsp+38h] [rbp-59h]
cocos2d::CCSize v60; // [rsp+40h] [rbp-51h] BYREF
cocos2d::CCRect v61; // [rsp+48h] [rbp-49h] BYREF
__int128 v62; // [rsp+58h] [rbp-39h] BYREF
__int64 v63; // [rsp+68h] [rbp-29h]
__int64 v64; // [rsp+70h] [rbp-21h]
__int128 v65; // [rsp+78h] [rbp-19h] BYREF
__int64 v66; // [rsp+88h] [rbp-9h]
unsigned __int64 v67; // [rsp+90h] [rbp-1h]
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4);
cocos2d::CCRect::CCRect(&v61, 0.0, 0.0, 80.0, 80.0);
v6 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v5);
LOBYTE(v7) = -1;
v6->setOpacity(&v6->cocos2d::CCRGBAProtocol, v7);
v8 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize(&v60, 440.0, 290.0);
v8->setContentSize(v6, v9);
v10 = -1;
v11 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v6,
0xFFFFFFFFLL);
v12 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v11, v59 * 0.5);
v12->setPosition_0(v6, v13);
v15 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v14);
a1->m_buttonMenu = v15;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, 10);
v16 = cocos2d::CCLabelBMFont::create("Featured Artists", &qword_14052A4D8);
v17 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v16,
20);
v18 = v16->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v17, v59 * 0.5);
v18->setPosition_0(v16, v19);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v16->setScale_0)(v16);
a1->m_joystickConnected = -1;
v20 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v21 = CCMenuItemSpriteExtra::create(v20, nullptr, a1, (cocos2d::SEL_MenuHandler *)AudioAssetsBrowser::onClose);
v22 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v21);
HIDWORD(v21->m_pfnSelector.adj) = 1070386381;
v23 = v21->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v22, (float)((float)(v59 * 0.5) - 220.0) + 10.0);
v24 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v61.origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v23->setPosition_0)(v21, v24);
v26 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v25);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, 10);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v27->setScale_0)(v27);
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, a1, (cocos2d::SEL_MenuHandler *)TopArtistsLayer::onPrevPage);
a1->m_prevButton = v28;
v29 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v26->addChild_1)(v26, v28);
v30 = a1->m_prevButton->__vftable;
cocos2d::CCPoint::CCPoint(v29, (float)((float)(v59 * 0.5) - 220.0) + 22.0);
v31 = cocos2d::CCNode::convertToNodeSpace(v26, (const struct cocos2d::CCPoint *)&v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v30->setPosition_0)(a1->m_prevButton, v31);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *))v32->setScale_0)(v32);
cocos2d::CCSprite::setFlipX(v32, 1);
v33 = CCMenuItemSpriteExtra::create(v32, nullptr, a1, (cocos2d::SEL_MenuHandler *)TopArtistsLayer::onNextPage);
a1->m_nextButton = v33;
v34 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v26->addChild_1)(v26, v33);
v35 = a1->m_nextButton->__vftable;
cocos2d::CCPoint::CCPoint(v34, (float)((float)(v59 * 0.5) + 220.0) - 22.0);
v36 = cocos2d::CCNode::convertToNodeSpace(v26, (const struct cocos2d::CCPoint *)&v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v35->setPosition_0)(a1->m_nextButton, v36);
a1->m_prevButton->setVisible(a1->m_prevButton, 0);
a1->m_nextButton->setVisible(a1->m_nextButton, 0);
v37 = LoadingCircle::create();
a1->m_loadingCircle = v37;
v37->m_parentLayer = a1->m_mainLayer;
a1->m_loadingCircle->m_fade = 0;
cocos2d::CCObject::retain(a1->m_loadingCircle);
LoadingCircle::show(a1->m_loadingCircle);
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
v38 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1->m_pageInfoLabel = v38;
v39 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v38);
v40 = a1->m_pageInfoLabel->__vftable;
cocos2d::CCPoint::CCPoint(v39, (float)((float)(v59 * 0.5) + 220.0) - 8.0);
v42 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v40->setPosition_0)(a1->m_pageInfoLabel, v41);
v43 = a1->m_pageInfoLabel->__vftable;
cocos2d::CCPoint::CCPoint(v42, 1.0);
v43->setAnchorPoint(a1->m_pageInfoLabel, v44);
if ( !qword_1406C2EC0 )
{
v61.origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v61.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
v45 = cocos2d::CCString::createWithFormat("topArtists_%i", 0);
CString = cocos2d::CCString::getCString(v45);
v65 = 0;
v66 = 0;
v67 = 0;
v47 = -1;
do
++v47;
while ( CString[v47] );
sub_14003A930(&v65, CString, v47);
v48 = (const char *)&v65;
if ( v67 > 0xF )
v48 = (const char *)v65;
v49 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v61.origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v61.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v49 = (GameLevelManager *)qword_1406C2EC0;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v49, v48);
v51 = (GameLevelManager *)qword_1406C2EC0;
if ( StoredOnlineLevels )
{
v52 = (const char *)&v65;
if ( v67 > 0xF )
v52 = (const char *)v65;
if ( !qword_1406C2EC0 )
{
v61.origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v61.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v51 = (GameLevelManager *)qword_1406C2EC0;
}
PageInfo = GameLevelManager::getPageInfo(v51, v52);
v62 = 0;
v63 = 0;
v64 = 0;
do
++v10;
while ( PageInfo[v10] );
sub_14003A930(&v62, PageInfo, v10);
v54 = (const char *)&v65;
if ( v67 > 0xF )
v54 = (const char *)v65;
a1->setupPageInfo(&a1->OnlineListDelegate, (std::string *)&v62, v54);
v55 = (const char *)&v65;
if ( v67 > 0xF )
v55 = (const char *)v65;
a1->loadListFinished(&a1->OnlineListDelegate, StoredOnlineLevels, v55);
}
else
{
if ( !qword_1406C2EC0 )
{
v61.origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v61.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v51 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::makeTimeStamp(v51, "upd_artists");
LOBYTE(v56) = 1;
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, v56);
TopArtistsLayer::setupLeaderboard(a1, nullptr);
v57 = &a1->OnlineListDelegate;
v58 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v61.origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v61.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v58 = (GameLevelManager *)qword_1406C2EC0;
}
v58->m_onlineListDelegate = v57;
GameLevelManager::getTopArtists(v58, 0, 0);
}
sub_14003A830((__int64)&v65);
return 1;
}
return result;
}