//
// GameManager::playMenuMusic from 0x100377000 to 0x100377151 (337 bytes)
//
// 1 xrefs:
// > OptionsLayer::musicSliderChanged @ 0x10079b185
//
// 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 __fastcall GameManager::playMenuMusic(GameManager *a1)
{
double v1; // xmm0_8
FMODAudioEngine *v2; // rax
void *v3; // r14
FMODAudioEngine *v4; // rbx
char v5; // r14
char isMusicPlaying; // bl
FMODAudioEngine *v7; // rbx
__int128 v8; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
__int128 v10; // [rsp+20h] [rbp-40h] BYREF
void *v11; // [rsp+30h] [rbp-30h]
__int128 v12; // [rsp+38h] [rbp-28h] BYREF
void *v13; // [rsp+48h] [rbp-18h]
if ( qword_1009A0E18 )
{
if ( GameManager::getGameVariable((GameManager *)qword_1009A0E18, "0122") )
{
LABEL_3:
v2 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v2, 1);
return;
}
}
else
{
v3 = operator new(0x638u);
sub_10038CE40(v3);
qword_1009A0E18 = (__int64)v3;
(*(void (__fastcall **)(void *))(*(_QWORD *)v3 + 80LL))(v3);
if ( GameManager::getGameVariable((GameManager *)qword_1009A0E18, "0122") )
goto LABEL_3;
}
GameManager::getMenuMusicFile((__int64)&v12, (__int64)a1, v1);
v4 = FMODAudioEngine::sharedEngine();
v5 = v12 & 1;
if ( (v12 & 1) != 0 )
{
sub_100006B70(&v8, v13, *((unsigned __int64 *)&v12 + 1), v1);
}
else
{
__p = v13;
v1 = *(double *)&v12;
v8 = v12;
}
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v4, &v8, 0);
if ( (v8 & 1) != 0 )
operator delete(__p);
if ( !isMusicPlaying )
{
v7 = FMODAudioEngine::sharedEngine();
if ( v5 )
{
sub_100006B70(&v10, v13, *((unsigned __int64 *)&v12 + 1), v1);
}
else
{
v11 = v13;
v10 = v12;
}
FMODAudioEngine::playMusic(v7, &v10, 1, 0, 0.0);
if ( (v10 & 1) != 0 )
operator delete(v11);
}
if ( v5 )
operator delete(v13);
}