//
// MoreSearchLayer::onSongMode from 0x6d3694 to 0x6d3894 (512 bytes)
//
// 6 xrefs:
// > MoreSearchLayer::init @ 0x6d4ad0
// > MoreSearchLayer::init @ 0x6d4b58
// > ??> @ 0x32250
// > MoreSearchLayer::init @ 0x6d44b4
// > MoreSearchLayer::init @ 0x6d459c
// > ??> @ 0x12297f8
//
// 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 MoreSearchLayer::onSongMode(MoreSearchLayer *a1, cocos2d::CCObject *a2)
{
int v3; // w20
GameLevelManager *v4; // x0
int BoolForKey; // w22
GameLevelManager *v6; // x0
GameLevelManager *v7; // x0
CCTextInputNode *m_enterSongID; // x23
unsigned __int8 *v9; // x0
ButtonSprite *v10; // x0
ButtonSprite *v11; // x0
const char *v12; // x1
GameLevelManager *v13; // x0
bool v14; // w0
unsigned int *v15; // x2
int v16; // w1
const unsigned __int8 *v17; // [xsp+60h] [xbp+60h] BYREF
v3 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2) == 2;
v4 = GameLevelManager::sharedState();
BoolForKey = GameLevelManager::getBoolForKey(v4, "customsong_filter");
v6 = GameLevelManager::sharedState();
GameLevelManager::setBoolForKey(v6, v3, "customsong_filter");
if ( v3 != BoolForKey )
{
v7 = GameLevelManager::sharedState();
GameLevelManager::setIntForKey(v7, v3 ^ 1, "song_filter");
m_enterSongID = a1->m_enterSongID;
sub_D153B8((int)&v17, &byte_F288A0);
CCTextInputNode::setString(m_enterSongID, &v17);
v9 = (unsigned __int8 *)(v17 - 24);
if ( v17 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v17 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v17 - 2);
*((_DWORD *)v17 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v9);
}
}
v10 = (ButtonSprite *)a1->m_normalBtn->getNormalImage(a1->m_normalBtn);
if ( v3 )
{
ButtonSprite::updateBGImage(v10, "GJ_button_04.png");
v11 = (ButtonSprite *)a1->m_customBtn->getNormalImage(a1->m_customBtn);
v12 = "GJ_button_01.png";
}
else
{
ButtonSprite::updateBGImage(v10, "GJ_button_01.png");
v11 = (ButtonSprite *)a1->m_customBtn->getNormalImage(a1->m_customBtn);
v12 = "GJ_button_04.png";
}
ButtonSprite::updateBGImage(v11, v12);
v13 = GameLevelManager::sharedState();
v14 = GameLevelManager::getBoolForKey(v13, "enable_songFilter");
MoreSearchLayer::toggleSongNodes(a1, v3, !v14);
MoreSearchLayer::updateAudioLabel(a1);
}