//
// GameManager::fadeInMusic from 0x1003773d0 to 0x1003774c0 (240 bytes)
//
// 11 xrefs:
// > LevelAreaLayer::init @ 0x10027793f
// > LevelAreaInnerLayer::tryResumeTowerMusic @ 0x10027adb2
// > GJShopLayer::onBack @ 0x100324b40
// > GameManager::fadeInMenuMusic @ 0x100377382
// > SecretLayer4::init @ 0x1003b0cfc
// > SecretLayer5::init @ 0x10047a0f7
// > SecretLayer6::init @ 0x10047ebdd
// > SecretLayer2::init @ 0x10049d21c
// > SecretLayer3::init @ 0x1004a3693
// > SecretLayer::init @ 0x1005faa07
// > SecretRewardsLayer::init @ 0x1006301bd
//
// 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::fadeInMusic(__m128 a1, __int64 a2, unsigned __int8 *a3)
{
unsigned int v3; // eax
FMODAudioEngine *v4; // r14
char isMusicPlaying; // r14
FMODAudioEngine *v6; // r14
__m128 v7; // [rsp+0h] [rbp-50h] BYREF
void *__p; // [rsp+10h] [rbp-40h]
__m128 v9; // [rsp+20h] [rbp-30h] BYREF
void *v10; // [rsp+30h] [rbp-20h]
v3 = *a3;
if ( (v3 & 1) != 0 )
{
if ( !*((_QWORD *)a3 + 1) )
return;
}
else if ( !(v3 >> 1) )
{
return;
}
v4 = FMODAudioEngine::sharedEngine();
if ( (*a3 & 1) != 0 )
{
sub_100006B70(&v7, *((const void **)a3 + 2), *((_QWORD *)a3 + 1), *(double *)a1.i64);
}
else
{
__p = *((void **)a3 + 2);
a1 = *(__m128 *)a3;
v7 = *(__m128 *)a3;
}
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v4, &v7, 0);
if ( (v7.i8[0] & 1) != 0 )
operator delete(__p);
if ( !isMusicPlaying )
{
v6 = FMODAudioEngine::sharedEngine();
if ( (*a3 & 1) != 0 )
{
sub_100006B70(&v9, *((const void **)a3 + 2), *((_QWORD *)a3 + 1), *(double *)a1.i64);
}
else
{
v10 = *((void **)a3 + 2);
v9 = *(__m128 *)a3;
}
FMODAudioEngine::playMusic(v6, &v9, 1, 0, COERCE_DOUBLE(1065353216));
if ( (v9.i8[0] & 1) != 0 )
operator delete(v10);
}
}