//
// SongSelectNode::onSongMode from 0x140168880 to 0x140168a9d (541 bytes)
//
// 4 xrefs:
// > SongSelectNode::init @ 0x1401686b4
// > SongSelectNode::onSongMode_1 @ 0x14016886c
// > SongSelectNode::customSongLayerClosed @ 0x140168e11
// > ??> @ 0x140918008
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:28 +0000
//
__int64 __fastcall SongSelectNode::onSongMode(__int64 a1, int a2)
{
bool v4; // r14
int v5; // ebp
const char *v6; // rsi
const char *v7; // rdi
__int64 v8; // rax
__int64 v9; // rax
unsigned int i; // edi
struct cocos2d::CCObject *v11; // rax
unsigned int j; // edi
struct cocos2d::CCObject *v13; // rax
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rdi
cocos2d::CCObject *v17; // rsi
__int64 v18; // rcx
cocos2d::CCObject *v19; // rax
cocos2d::CCObject *v20; // rcx
v4 = a2 == 2;
v5 = 0;
if ( *(_BYTE *)(a1 + 348) != (a2 == 2) )
{
*(_BYTE *)(a1 + 348) = v4;
*(_DWORD *)(a1 + 344) = 0;
*(_BYTE *)(a1 + 349) = 1;
if ( a2 != 2 )
SongSelectNode::updateAudioLabel(a1);
}
v6 = "GJ_button_04.png";
v7 = "GJ_button_01.png";
if ( a2 == 2 )
v7 = "GJ_button_04.png";
v8 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 384) + 952LL))(*(_QWORD *)(a1 + 384));
ButtonSprite::updateBGImage(v8, v7);
if ( a2 == 2 )
v6 = "GJ_button_01.png";
v9 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 392) + 952LL))(*(_QWORD *)(a1 + 392));
ButtonSprite::updateBGImage(v9, v6);
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 368)); ++i )
{
v11 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 368), i);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v11 + 336LL))(v11, a2 != 2);
}
for ( j = 0; j < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 376)); ++j )
{
v13 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 376), j);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v13 + 336LL))(v13, v4);
}
if ( *(_BYTE *)(a1 + 348) )
v14 = *(unsigned int *)(a1 + 344);
else
v14 = 0;
v15 = SongInfoObject::create_1(v14);
v16 = *(_QWORD *)(a1 + 416);
v17 = (cocos2d::CCObject *)v15;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v16 + 376) + 336LL))(*(_QWORD *)(v16 + 376), 0);
v18 = *(_QWORD *)(v16 + 480);
if ( v18 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v18 + 336LL))(v18, 0);
v19 = *(cocos2d::CCObject **)(v16 + 336);
if ( v19 != v17 )
{
if ( v17 )
cocos2d::CCObject::retain(v17);
v20 = *(cocos2d::CCObject **)(v16 + 336);
if ( v20 )
cocos2d::CCObject::release(v20);
*(_QWORD *)(v16 + 336) = v17;
v19 = v17;
}
if ( v19 )
v5 = *((_DWORD *)v19 + 80);
*(_DWORD *)(v16 + 504) = v5;
CustomSongWidget::updateSongInfo(v16);
return SongSelectNode::updateWidgetVisibility(a1);
}