//
// SongSelectNode::init from 0x1400c6dd0 to 0x1400c76d6 (2310 bytes)
//
// 3 xrefs:
// > SongSelectNode::create @ 0x1400c6d90
// > ??> @ 0x1406c81e4
// > ??> @ 0x1406c81f0
//
// 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=3
bool SongSelectNode::init(
SongSelectNode *a1,
int a2,
bool a3,
LevelSettingsObject *a4,
SongSelectType a5,
cocos2d::CCPoint a6,
cocos2d::CCNode *a7,
cocos2d::CCMenu *a8,
bool a9)
{
bool result; // al
__int64 v14; // rcx
cocos2d::CCArray *v15; // rax
bool v16; // al
struct cocos2d::CCLabelBMFont *v17; // rbx
struct cocos2d::CCRect *v18; // rax
struct cocos2d::extension::CCScale9Sprite *v19; // r15
__int64 v20; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v21; // rbx
const cocos2d::CCSize *v22; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v23; // rbx
const cocos2d::CCPoint *v24; // rax
__int64 v25; // rcx
cocos2d::CCArray *v26; // rax
__int64 v27; // rcx
cocos2d::CCArray *v28; // rax
cocos2d::CCLabelBMFont *v29; // rax
cocos2d::CCLabelBMFont_vtbl *v30; // rbx
__int64 v31; // rax
float y; // xmm8_4
struct cocos2d::CCSprite *v33; // rbx
cocos2d::CCNode *v34; // rdi
cocos2d::CCNode_vtbl *v35; // rbx
struct cocos2d::CCPoint v36; // rax
struct cocos2d::CCSprite *v37; // rbx
cocos2d::CCNode *v38; // rdi
cocos2d::CCNode_vtbl *v39; // rbx
struct cocos2d::CCPoint v40; // rax
ButtonSprite *v41; // rbx
CCMenuItemSpriteExtra *v42; // rax
CCMenuItemSpriteExtra_vtbl *v43; // rbx
struct cocos2d::CCPoint v44; // rax
ButtonSprite *v45; // rbx
CCMenuItemSpriteExtra *v46; // rax
const cocos2d::CCPoint *v47; // rax
ButtonSprite *v48; // rbx
CCMenuItemSpriteExtra *v49; // rax
CCMenuItemSpriteExtra_vtbl *v50; // rbx
struct cocos2d::CCPoint v51; // rax
struct cocos2d::CCSprite *v52; // rax
CCMenuItemSpriteExtra *v53; // rax
__int64 v54; // rax
CCMenuItemSpriteExtra_vtbl *v55; // rbx
struct cocos2d::CCPoint v56; // rax
SongInfoObject *SongInfoObject; // rax
int m_selectedSongID; // ebx
MusicDownloadManager *v59; // rax
CustomSongWidget *v60; // rax
CustomSongWidget_vtbl *v61; // rbx
__int64 v62; // rax
CCMenuItemSpriteExtra *m_customButton; // rcx
int v64; // eax
_BYTE v65[4]; // [rsp+58h] [rbp-51h] BYREF
float v66; // [rsp+5Ch] [rbp-4Dh]
cocos2d::CCPoint v67; // [rsp+60h] [rbp-49h] BYREF
ButtonSprite *v68; // [rsp+68h] [rbp-41h] BYREF
struct cocos2d::CCPoint v69; // [rsp+70h] [rbp-39h] BYREF
cocos2d::CCRect v70; // [rsp+78h] [rbp-31h] BYREF
result = cocos2d::CCNode::init(a1);
if ( result )
{
v15 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
a1->m_selectSongObjects = v15;
cocos2d::CCObject::retain(v15);
a1->m_selectedSongID = a2;
a1->m_settingsObject = a4;
if ( a5 == Custom )
{
v16 = 1;
}
else
{
v16 = a3;
if ( a5 == Default2 )
v16 = 0;
}
a1->m_isCustomSong = v16;
cocos2d::CCPoint::CCPoint(&v67, -65.0, 60.0);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator+)(a6, v65);
if ( !a9 )
{
v17 = cocos2d::CCLabelBMFont::create("Select Song:", "goldFont.fnt");
a7->addChild_1(a7, v17);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v17->setScale_0)(v17);
v17->setPosition_0(v17, (const cocos2d::CCPoint *)v65);
cocos2d::CCArray::addObject(a1->m_selectSongObjects, v17);
}
cocos2d::CCRect::CCRect(&v70, 0.0, 0.0, 80.0, 80.0);
v19 = cocos2d::extension::CCScale9Sprite::create("square02_001.png", v18);
LOBYTE(v20) = 75;
v19->setOpacity(&v19->cocos2d::CCRGBAProtocol, v20);
v21 = v19->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v67, 300.0, 90.0);
v21->setContentSize(v19, v22);
a7->addChild_0(a7, v19, -1);
v23 = v19->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v67, **(float **)&a6, v66 - 58.0);
v23->setPosition_0(v19, v24);
cocos2d::CCArray::addObject(a1->m_selectSongObjects, v19);
v26 = (cocos2d::CCArray *)cocos2d::CCArray::create(v25);
a1->m_normalSongObjects = v26;
cocos2d::CCObject::retain(v26);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
a1->m_changeSongObjects = v28;
cocos2d::CCObject::retain(v28);
v29 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_audioLabel = v29;
a7->addChild_1(a7, v29);
v30 = a1->m_audioLabel->__vftable;
v31 = (__int64)v19->getPosition_0(v19);
v30->setPosition_0(a1->m_audioLabel, (const cocos2d::CCPoint *)v31);
cocos2d::CCArray::addObject(a1->m_normalSongObjects, a1->m_audioLabel);
if ( !a1->m_isCustomSong )
SongSelectNode::updateAudioLabel(a1);
y = a1->m_audioLabel->getPosition_0(a1->m_audioLabel)->y;
v33 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v33->setScale_0)(v33);
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::audioPrevious);
a8->addChild_1(a8, v34);
cocos2d::CCArray::addObject(a1->m_normalSongObjects, v34);
v35 = v34->__vftable;
cocos2d::CCPoint::CCPoint(&v67, **(float **)&a6 - 120.0, y);
v36 = cocos2d::CCNode::convertToNodeSpace(a8, (const struct cocos2d::CCPoint *)&v68);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v35->setPosition_0)(v34, v36);
v34[1].m_unknown5 = 0x40000000;
v37 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v37->setScale_0)(v37);
v38 = CCMenuItemSpriteExtra::create(v37, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::audioNext);
a8->addChild_1(a8, v38);
cocos2d::CCArray::addObject(a1->m_normalSongObjects, v38);
v39 = v38->__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, **(float **)&a6 + 120.0, y);
v40 = cocos2d::CCNode::convertToNodeSpace(a8, &v67);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v39->setPosition_0)(v38, v40);
v38[1].m_unknown5 = 0x40000000;
v68 = (ButtonSprite *)operator new(0x2C0u);
v41 = ButtonSprite::ButtonSprite(v68);
if ( v41 )
{
if ( ButtonSprite::init_1(
v41,
"Normal",
40,
0,
0.40000001,
0,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
20.0) )
{
cocos2d::CCObject::autorelease(v41);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v41->~ButtonSprite)(v41, 1);
v41 = nullptr;
}
}
v42 = CCMenuItemSpriteExtra::create(v41, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::onSongMode_1);
a1->m_normalButton = v42;
HIDWORD(v42->m_pfnSelector.adj) = 1066192077;
a8->addChild_1(a8, a1->m_normalButton);
v43 = a1->m_normalButton->__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, **(float **)&a6 + 40.0, v66 - 1.0);
v44 = cocos2d::CCNode::convertToNodeSpace(a8, &v67);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v43->setPosition_0)(a1->m_normalButton, v44);
a1->m_normalButton->setTag(a1->m_normalButton, 1);
v68 = (ButtonSprite *)operator new(0x2C0u);
v45 = ButtonSprite::ButtonSprite(v68);
if ( v45 )
{
if ( ButtonSprite::init_1(
v45,
"Custom",
40,
0,
0.40000001,
0,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
20.0) )
{
cocos2d::CCObject::autorelease(v45);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v45->~ButtonSprite)(v45, 1);
v45 = nullptr;
}
}
v46 = CCMenuItemSpriteExtra::create(v45, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::onSongMode_1);
a1->m_customButton = v46;
HIDWORD(v46->m_pfnSelector.adj) = 1066192077;
a8->addChild_1(a8, a1->m_customButton);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 62.0, 0.0);
v47 = a1->m_normalButton->getPosition_0(a1->m_normalButton);
cocos2d::CCPoint::operator+(v47, &v67);
a1->m_customButton->setPosition_0(a1->m_customButton, &v67);
a1->m_customButton->setTag(a1->m_customButton, 2);
if ( a5 )
{
a1->m_normalButton->setVisible(a1->m_normalButton, 0);
a1->m_normalButton->setEnabled(a1->m_normalButton, 0);
a1->m_customButton->setVisible(a1->m_customButton, 0);
a1->m_customButton->setEnabled(a1->m_customButton, 0);
}
v68 = (ButtonSprite *)operator new(0x2C0u);
v48 = ButtonSprite::ButtonSprite(v68);
if ( v48 )
{
if ( ButtonSprite::init_1(
v48,
"Select Custom song",
140,
0,
0.80000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_04.png",
30.0) )
{
cocos2d::CCObject::autorelease(v48);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v48->~ButtonSprite)(v48, 1);
v48 = nullptr;
}
}
v49 = CCMenuItemSpriteExtra::create(v48, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::onOpenCustomSong);
a1->m_selectButton = v49;
a8->addChild_1(a8, v49);
v50 = a1->m_selectButton->__vftable;
v19->getPosition_0(v19);
v51 = cocos2d::CCNode::convertToNodeSpace(a8, (const struct cocos2d::CCPoint *)&v68);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v50->setPosition_0)(a1->m_selectButton, v51);
cocos2d::CCArray::addObject(a1->m_changeSongObjects, a1->m_selectButton);
v52 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_changeSongBtn_001.png");
v53 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)SongSelectNode::onOpenCustomSong);
a1->m_changeButton = v53;
a8->addChild_1(a8, v53);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 127.0, -20.0);
v54 = (__int64)v19->getPosition_0(v19);
cocos2d::CCPoint::operator+(v54, &v67);
v55 = a1->m_changeButton->__vftable;
v56 = cocos2d::CCNode::convertToNodeSpace(a8, &v69);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v55->setPosition_0)(a1->m_changeButton, v56);
cocos2d::CCArray::addObject(a1->m_changeSongObjects, a1->m_changeButton);
SongInfoObject = nullptr;
if ( a1->m_isCustomSong )
{
m_selectedSongID = a1->m_selectedSongID;
if ( m_selectedSongID )
{
v59 = MusicDownloadManager::sharedState();
SongInfoObject = MusicDownloadManager::getSongInfoObject(v59, m_selectedSongID);
}
}
v60 = CustomSongWidget::create(SongInfoObject, &a1->CustomSongDelegate, 0, 1, 0, 0, 1, 0, 0);
a1->m_songWidget = v60;
a7->addChild_1(a7, v60);
v61 = a1->m_songWidget->__vftable;
v62 = (__int64)v19->getPosition_0(v19);
v61->setPosition_0(a1->m_songWidget, (const cocos2d::CCPoint *)v62);
cocos2d::CCArray::addObject(a1->m_selectSongObjects, a1->m_songWidget);
if ( a1->m_isCustomSong )
m_customButton = a1->m_customButton;
else
m_customButton = a1->m_normalButton;
v64 = m_customButton->getTag(m_customButton);
SongSelectNode::onSongMode(a1, v64);
return 1;
}
return result;
}