//
// GameManager::fadeInMenuMusic from 0x5f004c to 0x5f0160 (276 bytes)
//
// 16 xrefs:
// > MenuLayer::init @ 0x5c2f18
// > LoadingLayer::loadAssets @ 0x5c4c68
// > PlayLayer::onQuit @ 0x5d08bc
// > GameManager::returnToLastScene @ 0x5f1080
// > MoreOptionsLayer::dropDownLayerWillClose @ 0x7c6c4c
// > OptionsLayer::onMenuMusic @ 0x7c7388
// > SongInfoLayer::onMenuMusic @ 0x7de684
// > SongInfoLayer::onMenuMusic @ 0x7de6b8
// > SecretLayer::onBack @ 0x901d20
// > GJShopLayer::onBack @ 0x92b5b0
// > SecretLayer2::onBack @ 0x93a828
// > SecretLayer4::onBack @ 0x946784
// > LevelAreaLayer::onBack @ 0xa2d4d8
// > SecretRewardsLayer::onBack @ 0xa613e0
// > SecretLayer6::onBack @ 0xa8fe0c
// > ??> @ 0x31008
//
// 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 GameManager::fadeInMenuMusic(GameManager *a1)
{
GameManager *v2; // x0
void *v3; // x0
FMODAudioEngine *v4; // x0
unsigned int *v5; // x2
int v6; // w1
__int64 v7; // [xsp+40h] [xbp+40h] BYREF
v2 = GameManager::sharedState();
if ( GameManager::getGameVariable(v2, "0122") )
{
v4 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v4, 1);
}
else
{
GameManager::getMenuMusicFile(a1, (__int64)&v7);
GameManager::fadeInMusic((__int64)a1, &v7);
v3 = (void *)(v7 - 24);
if ( (__int64 *)(v7 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v5 = (unsigned int *)(v7 - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v6 - 1;
}
if ( v6 <= 0 )
operator delete(v3);
}
}
}