//
// GameManager::fadeInMusic from 0x10031236c to 0x100312460 (244 bytes)
//
// 10 xrefs:
// > SecretLayer5::init @ 0x100074060
// > GJShopLayer::onBack @ 0x10014bcc0
// > SecretRewardsLayer::init @ 0x1002e80b4
// > SecretLayer2::init @ 0x1003097d0
// > SecretLayer3::init @ 0x10030de00
// > GameManager::fadeInMenuMusic @ 0x10031232c
// > LevelAreaLayer::init @ 0x100343bd0
// > LevelAreaInnerLayer::tryResumeTowerMusic @ 0x1003464b8
// > SecretLayer4::init @ 0x100353e94
// > SecretLayer::init @ 0x1003bd134
//
// 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(__int64 a1, __int64 a2)
{
FMODAudioEngine *v3; // x20
bool isMusicPlaying; // w0
bool v5; // w20
FMOD::Channel *v6; // x20
void *v7[2]; // [xsp+0h] [xbp-50h] BYREF
__int64 v8; // [xsp+10h] [xbp-40h]
void *__p[2]; // [xsp+20h] [xbp-30h] BYREF
__int64 v10; // [xsp+30h] [xbp-20h]
if ( (*(char *)(a2 + 23) & 0x8000000000000000LL) != 0 )
{
if ( !*(_QWORD *)(a2 + 8) )
return;
}
else if ( !*(_BYTE *)(a2 + 23) )
{
return;
}
v3 = FMODAudioEngine::sharedEngine();
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__p = *(_OWORD *)a2;
v10 = *(_QWORD *)(a2 + 16);
}
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v3, __p, 0);
v5 = isMusicPlaying;
if ( SHIBYTE(v10) < 0 )
{
operator delete(__p[0]);
if ( v5 )
return;
}
else if ( isMusicPlaying )
{
return;
}
v6 = (FMOD::Channel *)FMODAudioEngine::sharedEngine();
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(v7, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)v7 = *(_OWORD *)a2;
v8 = *(_QWORD *)(a2 + 16);
}
FMODAudioEngine::playMusic(v6, (__int64)v7, 1, 0, 1.0);
if ( SHIBYTE(v8) < 0 )
operator delete(v7[0]);
}