//
// EndLevelLayer::onMenu from 0x140135090 to 0x140135205 (373 bytes)
//
// 4 xrefs:
// > EndLevelLayer::keyBackClicked @ 0x1401356d9
// > EndLevelLayer::keyDown @ 0x140136db2
// > EndLevelLayer::customSetup @ 0x140133df5
// > ??> @ 0x1406c9ec4
//
// 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=7
void EndLevelLayer::onMenu(EndLevelLayer *a1, cocos2d::CCObject *a2)
{
PlayLayer *m_playLayer; // rax
GManager *v4; // rbx
__int64 v5; // r8
__int64 v6; // r9
int v7; // ecx
__int128 v8; // [rsp+30h] [rbp-28h] BYREF
__int64 v9; // [rsp+40h] [rbp-18h]
__int64 v10; // [rsp+48h] [rbp-10h]
void *v11; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v12; // [rsp+70h] [rbp+18h]
if ( !a1->m_exiting )
{
a1->m_exiting = 1;
m_playLayer = a1->m_playLayer;
if ( m_playLayer->m_endLayerStars || a1->m_animateCoins || m_playLayer->m_orbs > 0 || m_playLayer->m_diamonds > 0 )
{
v4 = (GManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v11 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GManager *)qword_1406C2ED8;
}
v4->m_quickSave = 1;
GManager::save(v4);
v4->m_quickSave = 0;
}
PlayLayer::onQuit(a1->m_playLayer);
a1->m_playLayer = nullptr;
a1->exitLayer(a1, nullptr);
v8 = 0;
*(_QWORD *)&v8 = sub_14003AA10(0x20u);
v9 = 16;
v10 = 31;
strcpy((char *)v8, "quitSound_01.ogg");
v7 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v12 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v7 = qword_1406C2E88;
}
FMODAudioEngine::playEffect(v7, (__int64)&v8, v5, v6, 1060320051);
}
}