//
// CustomSongLayer::onSearch from 0x83cfe8 to 0x83d148 (352 bytes)
//
// 3 xrefs:
// > ??> @ 0xc32a0
// > CustomSongLayer::init @ 0x83cbb0
// > ??> @ 0x122ec68
//
// 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 CustomSongLayer::onSearch(CustomSongLayer *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
FMODAudioEngine *v4; // x0
SongInfoObject *v5; // x0
CustomSongWidget *m_songWidget; // x20
SongInfoObject *v7; // x0
char *v8; // x0
GameManager *v9; // x0
unsigned int *v10; // x2
int v11; // w1
char *v12; // [xsp+40h] [xbp+40h] BYREF
v3 = GameManager::sharedState();
if ( GameManager::getGameVariable(v3, "0051") )
{
v4 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v4, 1);
a1->m_songIDInput->onClickTrackNode(a1->m_songIDInput, 0);
CCTextInputNode::getString(a1->m_songIDInput, (__int64)&v12);
v5 = (SongInfoObject *)atoi(v12);
m_songWidget = a1->m_songWidget;
v7 = (SongInfoObject *)SongInfoObject::create(v5);
CustomSongWidget::updateSongObject(m_songWidget, v7);
CustomSongWidget::getSongInfoIfUnloaded(a1->m_songWidget);
v8 = v12 - 24;
if ( v12 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v12 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v8);
}
}
else
{
v9 = GameManager::sharedState();
GameManager::setGameVariable(v9, "0051", 1);
CustomSongLayer::showNewgroundsMessage(a1);
}
}