//
// SetupSongTriggerPopup::onPlayback from 0x9a9a94 to 0x9a9d04 (624 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'SetupSongTriggerPopup::onPlayback @ 0x9a9d08
// > ??> @ 0x34b48
// > ??> @ 0x11c5570
//
// 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 SetupSongTriggerPopup::onPlayback(SetupSongTriggerPopup *a1, SongInfoObject *a2)
{
FMODAudioEngine *v4; // x0
int v5; // w23
int v6; // w26
int v7; // w25
int v8; // w24
bool v9; // w22
float v10; // s8
int v11; // w28
FMODAudioEngine *v12; // x19
MusicDownloadManager *v13; // x0
float v14; // s0
void *v15; // x0
FMODAudioEngine *v16; // x0
FMODAudioEngine *v17; // x0
MusicDownloadManager *v18; // x0
FMODAudioEngine *v19; // x0
unsigned int *v20; // x2
int v21; // w1
__int64 v22; // [xsp+90h] [xbp+80h] BYREF
v4 = FMODAudioEngine::sharedEngine();
if ( FMODAudioEngine::isMusicPlaying(v4, 0) )
{
v19 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v19, 1);
}
else if ( GameManager::sharedState()->m_levelEditorLayer )
{
v5 = (int)a1->getValue(a1, 408);
v6 = (int)a1->getValue(a1, 410);
v7 = (int)a1->getValue(a1, 409);
v8 = (int)a1->getValue(a1, 411);
v9 = a1->getValue(a1, 413) != 0.0;
v10 = a1->getValue(a1, 406);
v11 = (int)a1->getValue(a1, 404);
v12 = FMODAudioEngine::sharedEngine();
v13 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSong(&v22, v13, a2->m_songID);
FMODAudioEngine::sharedEngine();
v14 = FMODAudioEngine::pitchForIdx(v11);
FMODAudioEngine::loadMusic((__int64)v12, &v22, v9, 0, 0, 0, v14, 0.0, v10);
v15 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v22 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v15);
}
v16 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setMusicTimeMS(v16, v5, 0, 0);
v17 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::startMusic(v17, v5, v6, v7, v8, v9, 0, 0, 0);
}
v18 = MusicDownloadManager::sharedState();
MusicDownloadManager::songStateChanged(v18);
}