//
// GameManager::fadeInMusic from 0x100360760 to 0x100360850 (240 bytes)
//
// 11 xrefs:
// > LevelAreaLayer::init @ 0x100263f3f
// > LevelAreaInnerLayer::tryResumeTowerMusic @ 0x1002673b2
// > GJShopLayer::onBack @ 0x1003101a0
// > GameManager::fadeInMenuMusic @ 0x100360712
// > SecretLayer4::init @ 0x10039a0fc
// > SecretLayer5::init @ 0x10046ea57
// > SecretLayer6::init @ 0x10047353d
// > SecretLayer2::init @ 0x1004961ec
// > SecretLayer3::init @ 0x10049c663
// > SecretLayer::init @ 0x1006d1807
// > SecretRewardsLayer::init @ 0x10070cded
//
// This function is hookable on this platform (idp: pc, 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 12:28:56 +0000
//
void __fastcall GameManager::fadeInMusic(__m128 a1, __int64 a2, unsigned __int8 *a3)
{
unsigned int v3; // eax
__int64 v4; // r14
char isMusicPlaying; // r14
__int64 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(*(double *)a1.i64);
if ( (*a3 & 1) != 0 )
{
sub_10001AD30(&v7, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
}
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(*(double *)a1.i64);
if ( (*a3 & 1) != 0 )
{
sub_10001AD30(&v9, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
}
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);
}
}