//
// OptionsLayer::onMenuMusic from 0x140372880 to 0x140372988 (264 bytes)
//
// 2 xrefs:
// > OptionsLayer::customSetup @ 0x140372828
// > ??> @ 0x1406d5abc
//
// 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
//
// Hidden C++ exception states: #wind=4
void OptionsLayer::onMenuMusic(OptionsLayer *a1, cocos2d::CCObject *a2)
{
__int64 v2; // rbx
GameManager *v3; // rcx
void *v4; // [rsp+40h] [rbp+18h]
FMODAudioEngine *v5; // [rsp+40h] [rbp+18h]
void *v6; // [rsp+40h] [rbp+18h]
if ( !qword_1406C2ED8 )
{
v4 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v4);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
if ( GameManager::toggleGameVariable((GameManager *)a1, "0122") )
{
v2 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v5 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v5);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v2 = qword_1406C2E88;
}
if ( *(_QWORD *)(v2 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v2 + 552));
sub_14005E0D0((_QWORD *)(v2 + 1064));
sub_14005E0D0((_QWORD *)(v2 + 1128));
sub_14005E0D0((_QWORD *)(v2 + 1192));
}
else
{
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v6 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
GameManager::fadeInMenuMusic(v3);
}
}