//
// EndLevelLayer::onReplay from 0x140134e80 to 0x14013508b (523 bytes)
//
// 3 xrefs:
// > EndLevelLayer::keyDown @ 0x140136da4
// > EndLevelLayer::customSetup @ 0x140133d7c
// > ??> @ 0x1406c9eb8
//
// 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 EndLevelLayer::onReplay(EndLevelLayer *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // rcx
cocos2d::CCEGLView *v4; // rax
FMODAudioEngine *v5; // rcx
__int64 v6; // r8
__int64 v7; // r9
int v8; // ecx
PlayLayer *m_playLayer; // rdi
__int64 v10; // rbx
struct cocos2d::CCDelayTime *v11; // rax
struct cocos2d::CCSequence *v12; // rax
cocos2d::ccColor3B *v13; // r8
float v14; // [rsp+20h] [rbp-38h]
__int128 v15; // [rsp+30h] [rbp-28h] BYREF
__int64 v16; // [rsp+40h] [rbp-18h]
__int64 v17; // [rsp+48h] [rbp-10h]
void *v18; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v19; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v20; // [rsp+70h] [rbp+18h]
if ( !a1->m_exiting )
{
a1->m_exiting = 1;
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getGameVariable(v3, "0024") )
{
v4 = (cocos2d::CCEGLView *)cocos2d::CCEGLView::sharedOpenGLView();
cocos2d::CCEGLView::showCursor(v4, 0);
}
v5 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v19 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::clearAllAudio(v5);
v15 = 0;
*(_QWORD *)&v15 = sub_14003AA10(0x20u);
v16 = 16;
v17 = 31;
strcpy((char *)v15, "playSound_01.ogg");
v8 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v20 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v8 = qword_1406C2E88;
}
FMODAudioEngine::playEffect(v8, (__int64)&v15, v6, v7, 1050253722);
a1->exitLayer(a1, nullptr);
a1->setTouchEnabled(a1, 0);
a1->setKeyboardEnabled(a1, 0);
a1->setKeypadEnabled(a1, 0);
m_playLayer = a1->m_playLayer;
if ( m_playLayer->m_isPlatformer )
{
m_playLayer->m_started = 0;
m_playLayer->m_platformerRestart = 1;
}
v10 = cocos2d::CCCallFunc::create(m_playLayer, PlayLayer::fullReset);
v11 = cocos2d::CCDelayTime::create(0.5);
v12 = cocos2d::CCSequence::create(v11, v10, 0);
cocos2d::CCNode::runAction((CCLightFlash *)m_playLayer, (cocos2d::CCPoint)v12, v13, 0.0, v14);
}
}