//
// SongSelectNode::onSongMode from 0x1001478f8 to 0x100147a58 (352 bytes)
//
// 4 xrefs:
// > SongSelectNode::init @ 0x1001476cc
// > SongSelectNode::onSongMode_1 @ 0x100147898
// > SongSelectNode::customSongLayerClosed @ 0x100147b84
// > sub_100147B88 @ 0x100147bb8
//
// 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
//
void __fastcall SongSelectNode::onSongMode(SongSelectNode *a1, int a2)
{
_BOOL4 v4; // w8
ButtonSprite *v5; // x0
const char *v6; // x1
const char *v7; // x21
ButtonSprite *v8; // x0
__int64 v9; // x21
__int64 v10; // x0
__int64 v11; // x21
__int64 v12; // x0
int m_selectedSongID; // w0
CustomSongWidget *m_songWidget; // x20
SongInfoObject *v15; // x0
v4 = a2 == 2;
if ( a1->m_isCustomSong != v4 )
{
a1->m_isCustomSong = v4;
a1->m_selectedSongID = 0;
a1->m_songChanged = 1;
if ( a2 != 2 )
SongSelectNode::updateAudioLabel(a1);
}
v5 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_normalButton->getNormalImage)(a1->m_normalButton);
if ( a2 == 2 )
v6 = "GJ_button_04.png";
else
v6 = "GJ_button_01.png";
if ( a2 == 2 )
v7 = "GJ_button_01.png";
else
v7 = "GJ_button_04.png";
ButtonSprite::updateBGImage(v5, v6);
v8 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_customButton->getNormalImage)(a1->m_customButton);
ButtonSprite::updateBGImage(v8, v7);
if ( (unsigned int)sub_10024A36C(a1->m_normalSongObjects) )
{
v9 = 0;
do
{
v10 = sub_10024A388(a1->m_normalSongObjects, v9);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v10 + 328LL))(v10, a2 != 2);
v9 = (unsigned int)(v9 + 1);
}
while ( (unsigned int)v9 < (unsigned int)sub_10024A36C(a1->m_normalSongObjects) );
}
if ( (unsigned int)sub_10024A36C(a1->m_changeSongObjects) )
{
v11 = 0;
do
{
v12 = sub_10024A388(a1->m_changeSongObjects, v11);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v12 + 328LL))(v12, a2 == 2);
v11 = (unsigned int)(v11 + 1);
}
while ( (unsigned int)v11 < (unsigned int)sub_10024A36C(a1->m_changeSongObjects) );
}
if ( a1->m_isCustomSong )
m_selectedSongID = a1->m_selectedSongID;
else
m_selectedSongID = 0;
m_songWidget = a1->m_songWidget;
v15 = SongInfoObject::create_1(m_selectedSongID);
CustomSongWidget::updateSongObject(m_songWidget, v15);
SongSelectNode::updateWidgetVisibility(a1);
}