//
// PlayLayer::onQuit from 0x100080440 to 0x10008053d (253 bytes)
//
// 7 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10007bef9
// > PlayLayer::levelComplete @ 0x100081062
// > PlayLayer::postUpdate @ 0x100088c0c
// > PauseLayer::onQuit @ 0x1003c3185
// > EndLevelLayer::onMenu @ 0x1004baf9f
// > RetryLevelLayer::onMenu @ 0x1004f7f58
// > PlayLayer::setupHasCompleted @ 0x10007be71
//
// 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:20:01 +0000
//
__int64 __fastcall PlayLayer::onQuit(__int64 a1, __int64 a2)
{
__int64 v3; // rcx
unsigned int v4; // eax
__int64 v5; // rax
__int64 v6; // rdi
__int64 v7; // rdx
double v8; // xmm0_8
__int64 v9; // rax
__int64 v10; // rdi
double v11; // xmm0_8
__int64 v12; // rdi
__int64 v13; // rdx
double v14; // xmm0_8
__int64 v15; // rsi
__int64 v16; // rax
__int64 v17; // rdi
__int64 v18; // rdx
double v19; // xmm0_8
__int64 v20; // rax
PlayLayer::writePersistentSave(a1);
if ( *(_BYTE *)(a1 + 12238) == 1 )
{
v3 = *(_QWORD *)(a1 + 1936);
v4 = *(unsigned __int8 *)(v3 + 1472);
if ( (v4 & 1) == 0 )
{
if ( !(v4 >> 1) )
goto LABEL_7;
goto LABEL_6;
}
if ( *(_QWORD *)(v3 + 1480) )
{
LABEL_6:
v5 = GameLevelManager::sharedState();
a2 = *(_QWORD *)(a1 + 1936);
GameLevelManager::writePlatformerSaveJournal(v5, a2);
}
}
LABEL_7:
PlayLayer::dtFlushCells(a1);
PlayLayer::dtCommitPlaytime(a1);
v6 = cocos2d::CCDirector::sharedDirector(a1, a2);
*(_DWORD *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 128LL))(v6) + 56) = 1065353216;
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v6, a2) + 178) = 0;
*(_QWORD *)&v8 = GameManager::sharedState(v6, a2, v7).u64[0];
v10 = v9;
GameManager::didExitPlayscene(v9, v8);
PlatformToolbox::showCursor(v10);
UILayer::disableMenu(*(_QWORD *)(a1 + 13288));
cocos2d::CCNode::stopActionByTag(a1, 31);
cocos2d::CCNode::stopAllActions(a1);
cocos2d::CCNode::unscheduleAllSelectors(a1);
v11 = GJBaseGameLayer::resetAudio(a1);
v12 = FMODAudioEngine::sharedEngine(v11);
FMODAudioEngine::unloadAllEffects(v12);
*(_QWORD *)&v14 = GameManager::sharedState(v12, 31, v13).u64[0];
v15 = *(_QWORD *)(a1 + 1936);
v17 = v16;
GameManager::returnToLastScene(v16, v15, v14);
*(_QWORD *)&v19 = GameManager::sharedState(v17, v15, v18).u64[0];
return GameManager::fadeInMenuMusic(v20, v19);
}