//
// MusicBrowser::init from 0x1403388b0 to 0x140339477 (3015 bytes)
//
// 3 xrefs:
// > MusicBrowser::create @ 0x140338875
// > ??> @ 0x1406d5300
// > ??> @ 0x1406d530c
//
// 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=2
bool MusicBrowser::init(MusicBrowser *a1, int a2, GJSongType a3)
{
bool result; // al
__int64 v7; // rcx
cocos2d::CCDirector *v8; // rax
struct cocos2d::CCRect *v9; // rax
struct cocos2d::extension::CCScale9Sprite *v10; // rdi
__int64 v11; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v12; // rbx
const cocos2d::CCSize *v13; // rax
float v14; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
__int64 v17; // rcx
cocos2d::CCMenu *v18; // rax
struct cocos2d::CCLabelBMFont *v19; // rax
__int64 v20; // rdx
float v21; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v22; // rbx
const cocos2d::CCPoint *v23; // rax
float v24; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v25; // rbx
const cocos2d::CCPoint *v26; // rax
struct cocos2d::CCSprite *v27; // rax
CCMenuItemSpriteExtra *v28; // rdi
float v29; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v30; // rbx
struct cocos2d::CCPoint v31; // rax
struct cocos2d::CCSprite *v32; // rbx
CCMenuItemSpriteExtra *v33; // rax
float v34; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v35; // rbx
struct cocos2d::CCPoint v36; // rax
cocos2d::CCSprite *v37; // rbx
CCMenuItemSpriteExtra *v38; // rax
float v39; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v40; // rbx
double v41; // xmm0_8
struct cocos2d::CCPoint v42; // rax
struct cocos2d::CCSprite *v43; // rbx
CCMenuItemSpriteExtra *v44; // rax
CCMenuItemSpriteExtra_vtbl *v45; // rbx
struct cocos2d::CCPoint v46; // rax
struct cocos2d::CCSprite *v47; // rbx
CCMenuItemSpriteExtra *v48; // rdi
float v49; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v50; // rbx
struct cocos2d::CCPoint v51; // rax
struct cocos2d::CCSprite *v52; // rbx
CCMenuItemSpriteExtra *v53; // rax
float v54; // xmm0_4
__int64 v55; // rax
double v56; // xmm0_8
cocos2d::CCSprite *v57; // rdi
ButtonSprite *v58; // rax
int v59; // r9d
ButtonSprite *v60; // rbx
__int64 v61; // rax
CCMenuItemSpriteExtra *v62; // rax
float v63; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v64; // rbx
struct cocos2d::CCPoint v65; // rax
double v66; // xmm0_8
cocos2d::CCSprite *v67; // rdi
ButtonSprite *v68; // rax
int v69; // r9d
ButtonSprite *v70; // rbx
__int64 v71; // rax
CCMenuItemSpriteExtra *v72; // rax
float v73; // xmm0_4
const cocos2d::CCPoint *v74; // rax
cocos2d::CCLabelBMFont *v75; // rax
float v76; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v77; // rbx
__int64 v78; // rax
float v79; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v80; // rbx
const cocos2d::CCPoint *v81; // rax
GJSongType m_songType; // eax
const char *v83; // rcx
struct cocos2d::CCSprite *v84; // rdi
float v85; // xmm0_4
cocos2d::CCSprite_vtbl *v86; // rbx
const cocos2d::CCPoint *v87; // rax
LoadingCircleSprite *v88; // rax
float v89; // xmm0_4
LoadingCircleSprite_vtbl *v90; // rbx
const cocos2d::CCPoint *v91; // rax
MusicDownloadManager *v92; // rax
MusicDownloadManager *v93; // rax
bool v94; // [rsp+38h] [rbp-59h]
cocos2d::CCSize v95; // [rsp+58h] [rbp-39h] BYREF
cocos2d::CCRect v96[7]; // [rsp+60h] [rbp-31h] BYREF
float v97; // [rsp+110h] [rbp+7Fh]
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
a1->m_noElasticity = 1;
a1->m_songID = a2;
a1->m_songType = a3;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8);
cocos2d::CCRect::CCRect(v96, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v9);
LOBYTE(v11) = -1;
v10->setOpacity(&v10->cocos2d::CCRGBAProtocol, v11);
v12 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize(&v95, 440.0, 290.0);
v12->setContentSize(v10, v13);
v14 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
0xFFFFFFFFLL);
v15 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v14, v97 * 0.5);
v15->setPosition_0(v10, v16);
v18 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v17);
a1->m_buttonMenu = v18;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v18, 10);
a1->m_joystickConnected = -1;
v19 = cocos2d::CCLabelBMFont::create(" ", "chatFont.fnt");
a1->m_infoLabel = v19;
LOBYTE(v20) = -56;
v19->setOpacity(&v19->cocos2d::CCRGBAProtocol, v20);
a1->m_infoLabel->setColor(&a1->m_infoLabel->cocos2d::CCRGBAProtocol, &stru_140529B80);
v21 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_infoLabel->setScale_0)(a1->m_infoLabel);
v22 = a1->m_infoLabel->__vftable;
cocos2d::CCPoint::CCPoint(v21, 0.5);
v22->setAnchorPoint(a1->m_infoLabel, v23);
v24 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_infoLabel,
10);
v25 = a1->m_infoLabel->__vftable;
cocos2d::CCPoint::CCPoint(v24, v97 * 0.5);
v25->setPosition_0(a1->m_infoLabel, v26);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onClose);
v29 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v28);
HIDWORD(v28->m_pfnSelector.adj) = 1070386381;
v30 = v28->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v29, (float)((float)(v97 * 0.5) - 220.0) + 10.0);
v31 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v96[0].origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v30->setPosition_0)(v28, v31);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v32->setScale_0)(v32);
v33 = CCMenuItemSpriteExtra::create(v32, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onPage);
a1->m_prevButton = v33;
HIDWORD(v33->m_pfnSelector.adj) = 1067030938;
v34 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
a1->m_prevButton);
v35 = a1->m_prevButton->__vftable;
cocos2d::CCPoint::CCPoint(v34, (float)((float)(v97 * 0.5) - 220.0) + 22.0);
v36 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v95);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v35->setPosition_0)(a1->m_prevButton, v36);
a1->m_prevButton->setTag(a1->m_prevButton, 0);
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
((void (__fastcall *)(cocos2d::CCSprite *))v37->setScale_0)(v37);
cocos2d::CCSprite::setFlipX(v37, 1);
v38 = CCMenuItemSpriteExtra::create(v37, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onPage);
a1->m_nextButton = v38;
HIDWORD(v38->m_pfnSelector.adj) = 1069547520;
v39 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
a1->m_nextButton);
v40 = a1->m_nextButton->__vftable;
v41 = cocos2d::CCPoint::CCPoint(v39, (float)((float)(v97 * 0.5) + 220.0) - 22.0);
v42 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v95);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v40->setPosition_0)(a1->m_nextButton, v42);
a1->m_nextButton->setTag(a1->m_nextButton, 1);
v43 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v43->setScale_0)(v43);
v44 = CCMenuItemSpriteExtra::create(v43, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onUpdateLibrary);
a1->m_refreshButton = v44;
v45 = v44->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v41, (float)((float)(v97 * 0.5) + 220.0) - 10.0);
v46 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v95);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v45->setPosition_0)(
a1->m_refreshButton,
v46);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, a1->m_refreshButton);
a1->m_refreshButton->setVisible(a1->m_refreshButton, 0);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("gj_findBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v47->setScale_0)(v47);
v48 = CCMenuItemSpriteExtra::create(v47, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onSearch);
v49 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v48);
v50 = v48->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v49, (float)((float)(v97 * 0.5) - 220.0) + 24.0);
v51 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v95);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v50->setPosition_0)(v48, v51);
v52 = cocos2d::CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v52->setScale_0)(v52);
v53 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onClearSearch);
a1->m_clearSearchButton = v53;
v54 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v53);
cocos2d::CCPoint::CCPoint(v54, 0.0);
v55 = (__int64)v48->getPosition_0(v48);
v56 = cocos2d::CCPoint::operator+(v55, &v95);
a1->m_clearSearchButton->setPosition_0(a1->m_clearSearchButton, (const cocos2d::CCPoint *)&v95);
a1->m_clearSearchButton->setVisible(a1->m_clearSearchButton, 0);
v57 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_filterIcon_001.png");
v96[0].origin = (cocos2d::CCPoint)operator new(0x2C0u);
v58 = ButtonSprite::ButtonSprite(*(ButtonSprite **)&v96[0].origin);
v60 = v58;
if ( v58 )
{
if ( ButtonSprite::init(v58, v57, 32, v59, 32.0, 1.0, v94, "GJ_button_01.png", 0) )
{
cocos2d::CCObject::autorelease(v60);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v60->~ButtonSprite)(v60, 1);
v60 = nullptr;
}
}
cocos2d::CCPoint::CCPoint(*(float *)&v56, -0.5);
cocos2d::CCPoint::operator=(&v60->m_spritePosition, v61);
ButtonSprite::updateSpriteBGSize(v60);
v62 = CCMenuItemSpriteExtra::create(v60, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onTagFilters);
a1->m_tagFilterButton = v62;
v63 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v62);
v64 = a1->m_tagFilterButton->__vftable;
cocos2d::CCPoint::CCPoint(v63, (float)((float)(v97 * 0.5) + 220.0) - 24.0);
v65 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v95);
v66 = ((double (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v64->setPosition_0)(
a1->m_tagFilterButton,
v65);
((void (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_tagFilterButton->setScale_0)(a1->m_tagFilterButton);
HIDWORD(a1->m_tagFilterButton->m_pDisabledImage) = 1061158912;
v67 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_musicIcon_001.png");
v96[0].origin = (cocos2d::CCPoint)operator new(0x2C0u);
v68 = ButtonSprite::ButtonSprite(*(ButtonSprite **)&v96[0].origin);
v70 = v68;
if ( v68 )
{
if ( ButtonSprite::init(v68, v67, 32, v69, 32.0, 1.0, v94, "GJ_button_01.png", 0) )
{
cocos2d::CCObject::autorelease(v70);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v70->~ButtonSprite)(v70, 1);
v70 = nullptr;
}
}
cocos2d::CCPoint::CCPoint(*(float *)&v66, -1.5);
cocos2d::CCPoint::operator=(&v70->m_spritePosition, v71);
ButtonSprite::updateSpriteBGSize(v70);
v72 = CCMenuItemSpriteExtra::create(v70, nullptr, a1, (cocos2d::SEL_MenuHandler *)MusicBrowser::onArtistFilters);
a1->m_artistFilterButton = v72;
v73 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v72);
cocos2d::CCPoint::CCPoint(v73, 0.0);
v74 = a1->m_tagFilterButton->getPosition_0(a1->m_tagFilterButton);
cocos2d::CCPoint::operator+(v74, &v95);
a1->m_artistFilterButton->setPosition_0(a1->m_artistFilterButton, (const cocos2d::CCPoint *)&v95);
((void (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_artistFilterButton->setScale_0)(a1->m_artistFilterButton);
HIDWORD(a1->m_artistFilterButton->m_pDisabledImage) = 1061158912;
v75 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1->m_pageLabel = v75;
v76 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v75,
10);
v77 = a1->m_pageLabel->__vftable;
cocos2d::CCPoint::CCPoint(v76, (float)((float)(v97 * 0.5) + 220.0) - 50.0);
v79 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v77->setPosition_0)(a1->m_pageLabel, v78);
v80 = a1->m_pageLabel->__vftable;
cocos2d::CCPoint::CCPoint(v79, 1.0);
v80->setAnchorPoint(a1->m_pageLabel, v81);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_pageLabel->setScale_0)(a1->m_pageLabel);
m_songType = a1->m_songType;
if ( m_songType > 0 )
{
v83 = "chompo_med_001.png";
if ( m_songType == 1 )
v83 = "ncs_med_001.png";
v84 = cocos2d::CCSprite::createWithSpriteFrameName(v83);
((void (__fastcall *)(struct cocos2d::CCSprite *))v84->setScale_0)(v84);
v85 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v84,
11);
v86 = v84->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v85, (float)((float)(v97 * 0.5) + 220.0) - 70.0);
v86->setPosition_0(v84, v87);
}
v88 = LoadingCircleSprite::create(1.0);
a1->m_circleSprite = v88;
v89 = ((float (__fastcall *)(cocos2d::CCLayer *, LoadingCircleSprite *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v88);
v90 = a1->m_circleSprite->__vftable;
cocos2d::CCPoint::CCPoint(v89, v97 * 0.5);
v90->setPosition_0(a1->m_circleSprite, v91);
MusicBrowser::setupSongControls(a1);
v92 = MusicDownloadManager::sharedState();
MusicDownloadManager::addMusicDownloadDelegate(v92, &a1->MusicDownloadDelegate);
if ( !MusicDownloadManager::sharedState()->m_musicObjects )
{
v93 = MusicDownloadManager::sharedState();
MusicDownloadManager::parseMusicLibrary(v93);
}
MusicBrowser::trySetupMusicBrowser(a1);
cocos2d::CCNode::scheduleUpdate(a1);
return 1;
}
return result;
}