//
// SetupSongTriggerPopup::onPlayback from 0x14045d630 to 0x14045d9c5 (917 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405f6e08
// > ??> @ 0x1406daca0
//
// 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
//
// Hidden C++ exception states: #wind=9
void SetupSongTriggerPopup::onPlayback(SetupSongTriggerPopup *a1, SongInfoObject *a2)
{
FMODAudioEngine *v4; // rcx
__int64 v5; // rbx
__int64 v6; // rax
char *p_m_nTag; // rbx
int v8; // esi
int v9; // r15d
int v10; // r12d
int v11; // r13d
bool v12; // di
double v13; // xmm0_8
float v14; // xmm6_4
int v15; // r14d
MusicDownloadManager *v16; // rax
_QWORD *v17; // rbx
float v18; // xmm0_4
__int64 v19; // r8
FMODAudioEngine *v20; // rcx
FMODAudioEngine *v21; // rcx
MusicDownloadManager *v22; // rax
bool v23; // [rsp+40h] [rbp-88h]
_QWORD v24[4]; // [rsp+50h] [rbp-78h] BYREF
FMODAudioEngine *v25; // [rsp+E0h] [rbp+18h]
FMODAudioEngine *v26; // [rsp+E0h] [rbp+18h]
void *v27; // [rsp+E0h] [rbp+18h]
FMODAudioEngine *v28; // [rsp+E0h] [rbp+18h]
FMODAudioEngine *v29; // [rsp+E0h] [rbp+18h]
FMODAudioEngine *v30; // [rsp+E0h] [rbp+18h]
FMODAudioEngine *v31; // [rsp+E8h] [rbp+20h]
v4 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v25 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = (FMODAudioEngine *)qword_1406C2E88;
}
if ( FMODAudioEngine::isMusicPlaying_1(v4, 0) )
{
v5 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v26 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = qword_1406C2E88;
}
if ( *(_QWORD *)(v5 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v5 + 552));
sub_14005E0D0((_QWORD *)(v5 + 1064));
sub_14005E0D0((_QWORD *)(v5 + 1128));
sub_14005E0D0((_QWORD *)(v5 + 1192));
}
else
{
v6 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v27 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = qword_1406C2ED8;
}
if ( *(_QWORD *)(v6 + 528) )
{
p_m_nTag = (char *)&a1[-1].m_nTag;
v8 = (int)(*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 408);
v9 = (int)(*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 410);
v10 = (int)(*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 409);
v11 = (int)(*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 411);
v12 = (*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 413) != 0.0;
v13 = (*(double (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 406);
v14 = *(float *)&v13;
v15 = (int)(*(float (__fastcall **)(char *, __int64))(*(_QWORD *)p_m_nTag + 1136LL))(p_m_nTag, 404);
if ( !qword_1406C2E88 )
{
v28 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
}
v16 = MusicDownloadManager::sharedState();
v17 = MusicDownloadManager::pathForSong((__int64)v16, v24, a2->m_songID);
if ( !qword_1406C2E88 )
{
v31 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
}
v18 = FMODAudioEngine::pitchForIdx(v15);
FMODAudioEngine::loadMusic(v19, (__int64)v17, v18, 0.0, v14, v12, 0, 0, 0);
v20 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v29 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v20 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::setMusicTimeMS(v20, v8, 0, 0);
v21 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v30 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v30);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v21 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::startMusic(v21, v8, v9, v10, v11, v12, 0, 0, v23);
}
}
v22 = MusicDownloadManager::sharedState();
MusicDownloadManager::songStateChanged(v22);
}