//
// GameManager::fadeInMusic from 0x1003af080 to 0x1003af174 (244 bytes)
//
// 10 xrefs:
// > SecretLayer5::init @ 0x10007c810
// > GJShopLayer::onBack @ 0x1001ca5b8
// > SecretRewardsLayer::init @ 0x10038323c
// > SecretLayer2::init @ 0x1003a64ec
// > SecretLayer3::init @ 0x1003aab18
// > GameManager::fadeInMenuMusic @ 0x1003af040
// > LevelAreaLayer::init @ 0x1003e234c
// > sub_1003E4C04 @ 0x1003e4c34
// > SecretLayer4::init @ 0x1003f3784
// > SecretLayer::init @ 0x100463e64
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:03:53 +0000
//
void __fastcall GameManager::fadeInMusic(__int64 a1, __int64 a2)
{
__int64 v3; // x20
char isMusicPlaying; // w0
char v5; // w20
__int64 *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 & 1) != 0 )
return;
}
else if ( (isMusicPlaying & 1) != 0 )
{
return;
}
v6 = (__int64 *)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]);
}