//
// SongSelectNode::onSongMode from 0x100219600 to 0x1002197e7 (487 bytes)
//
// 4 xrefs:
// > SongSelectNode::init @ 0x10021939f
// > SongSelectNode::onSongMode_1 @ 0x10021954d
// > SongSelectNode::customSongLayerClosed @ 0x1002199b1
// > sub_1002199C0 @ 0x1002199e5
//
// 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)
{
ButtonSprite *v4; // rax
const char *v5; // r15
const char *v6; // rsi
ButtonSprite *v7; // rax
unsigned int v8; // r12d
__int64 v9; // rax
unsigned int v10; // r15d
__int64 v11; // rax
int m_selectedSongID; // edi
CustomSongWidget *m_songWidget; // r14
SongInfoObject *v14; // rax
bool v15; // al
bool v16; // r14
if ( a1->m_isCustomSong != (a2 == 2) )
{
a1->m_isCustomSong = a2 == 2;
a1->m_selectedSongID = 0;
a1->m_songChanged = 1;
if ( a2 != 2 )
SongSelectNode::updateAudioLabel(a1);
}
v4 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_normalButton->getNormalImage)(a1->m_normalButton);
v5 = "GJ_button_04.png";
v6 = "GJ_button_01.png";
if ( a2 == 2 )
{
v6 = "GJ_button_04.png";
v5 = "GJ_button_01.png";
}
ButtonSprite::updateBGImage(v4, v6);
v7 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_customButton->getNormalImage)(a1->m_customButton);
ButtonSprite::updateBGImage(v7, v5);
if ( (unsigned int)sub_100720070(a1->m_normalSongObjects) )
{
v8 = 0;
do
{
v9 = sub_1007200C0(a1->m_normalSongObjects, v8);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v9 + 328LL))(v9, a2 != 2);
++v8;
}
while ( v8 < (unsigned int)sub_100720070(a1->m_normalSongObjects) );
}
if ( (unsigned int)sub_100720070(a1->m_changeSongObjects) )
{
v10 = 0;
do
{
v11 = sub_1007200C0(a1->m_changeSongObjects, v10);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v11 + 328LL))(v11, a2 == 2);
++v10;
}
while ( v10 < (unsigned int)sub_100720070(a1->m_changeSongObjects) );
}
m_selectedSongID = 0;
if ( a1->m_isCustomSong )
m_selectedSongID = a1->m_selectedSongID;
m_songWidget = a1->m_songWidget;
v14 = SongInfoObject::create_1(m_selectedSongID);
CustomSongWidget::updateSongObject(m_songWidget, v14);
v15 = a1->m_isCustomSong && a1->m_selectedSongID != 0;
v16 = v15;
((void (__fastcall *)(CustomSongWidget *, bool))a1->m_songWidget->setVisible)(a1->m_songWidget, v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_selectButton->setVisible)(
a1->m_selectButton,
a1->m_isCustomSong && !v16);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_changeButton->setVisible)(
a1->m_changeButton,
a1->m_isCustomSong && v16);
}