//
// PlayLayer::resume from 0x1403ba640 to 0x1403ba8db (667 bytes)
//
// 5 xrefs:
// > PauseLayer::onPracticeMode @ 0x14037e289
// > PauseLayer::onNormalMode @ 0x14037e362
// > PauseLayer::onResume @ 0x14037e3f9
// > ??> @ 0x1406d70e8
// > ??> @ 0x1406d70f4
//
// 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=5
void PlayLayer::resume(PlayLayer *a1)
{
__int64 v2; // rcx
__int64 v3; // rbx
__int64 v4; // rax
__int64 v5; // rcx
GameManager *v6; // rcx
__int64 v7; // rcx
cocos2d::CCEGLView *v8; // rax
__int64 v9; // rcx
GameManager *v10; // rcx
cocos2d::CCEGLView *v11; // rax
UILayer *m_uiLayer; // rcx
FMODAudioEngine *v13; // [rsp+38h] [rbp+10h]
FMODAudioEngine *v14; // [rsp+38h] [rbp+10h]
FMODAudioEngine *v15; // [rsp+38h] [rbp+10h]
void *v16; // [rsp+38h] [rbp+10h]
void *v17; // [rsp+38h] [rbp+10h]
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(a1) + 217) )
{
if ( a1->m_playerDied )
{
v3 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v13 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v3 = qword_1406C2E88;
}
if ( *(_BYTE *)(v3 + 609) )
{
*(_BYTE *)(v3 + 609) = 0;
FMOD::ChannelControl::setPaused(*(FMOD::ChannelControl **)(v3 + 552), 0);
FMOD::ChannelControl::setPaused(*(FMOD::ChannelControl **)(v3 + 584), 0);
v3 = qword_1406C2E88;
}
if ( !v3 )
{
v14 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v3 = qword_1406C2E88;
}
FMOD::System::update(*(FMOD::System **)(v3 + 560));
}
else
{
a1->m_resumeTimer = 2;
a1->m_audioPaused = 1;
}
v4 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v15 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = qword_1406C2E88;
}
a1->m_isSilent = *(float *)(v4 + 512) <= 0.0;
a1->m_isPaused = 0;
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v2) + 170) = 1;
*(_BYTE *)(cocos2d::CCEGLView::sharedOpenGLView(v5) + 237) = 1;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v6, "0128") )
{
v8 = (cocos2d::CCEGLView *)cocos2d::CCEGLView::sharedOpenGLView(v7);
cocos2d::CCEGLView::toggleLockCursor(v8, 1);
}
else
{
v10 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v17 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getGameVariable(v10, "0024") )
{
v11 = (cocos2d::CCEGLView *)cocos2d::CCEGLView::sharedOpenGLView(v9);
cocos2d::CCEGLView::showCursor(v11, 0);
}
}
*(_BYTE *)(cocos2d::CCApplication::sharedApplication(v9) + 217) = 0;
a1->onEnter(a1);
PlayerObject::releaseAllButtons(a1->m_player1);
m_uiLayer = a1->m_uiLayer;
*(_QWORD *)&m_uiLayer->m_p1TouchId = -1;
*(_WORD *)&m_uiLayer->m_p1Jumping = 0;
m_uiLayer->m_checkpointBtnDown = 0;
UILayer::resetUINodeState(m_uiLayer);
UILayer::toggleMenuVisibility(a1->m_uiLayer, 1);
a1->m_pauseDelta = sub_14003CF30() - a1->m_pauseTime + a1->m_pauseDelta;
}
}