//
// EditLevelLayer::onEdit from 0x1400d82b0 to 0x1400d8448 (408 bytes)
//
// 3 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x1400d8f51
// > EditLevelLayer::init @ 0x1400d5ef1
// > ??> @ 0x1406c8814
//
// 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=3
void EditLevelLayer::onEdit(EditLevelLayer *a1, cocos2d::CCObject *a2)
{
__int64 v3; // rax
__int64 AudioFileName; // rdi
__int64 v5; // rcx
GJGameLevel *m_level; // rbx
__int64 v7; // rcx
struct cocos2d::CCScene *v8; // rdi
__int64 v9; // rdx
__int64 v10; // rcx
LevelEditorLayer *v11; // rax
struct cocos2d::CCTransitionFade *v12; // rbx
__int64 v13; // rcx
cocos2d::CCDirector *v14; // rax
void *v15; // [rsp+90h] [rbp+18h]
FMODAudioEngine *v16; // [rsp+98h] [rbp+20h]
if ( !*(_BYTE *)(cocos2d::CCDirector::sharedDirector(a1) + 168) && !a1->m_exiting )
{
EditLevelLayer::closeTextInputs(a1);
a1->setKeypadEnabled(a1, 0);
a1->m_exiting = 1;
v3 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v15 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = qword_1406C2ED8;
}
*(_DWORD *)(v3 + 700) = 3;
EditLevelLayer::verifyLevelName(a1);
AudioFileName = GJGameLevel::getAudioFileName(a1->m_level);
v5 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v16 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = qword_1406C2E88;
}
FMODAudioEngine::loadMusic(v5, AudioFileName, 1.0, 0.0, 1.0, 1, 0, 0, 0);
m_level = a1->m_level;
v8 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(v7);
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v10, v9) + 224) = v8;
v11 = LevelEditorLayer::create(m_level, 0);
v8->addChild_1(v8, v11);
v8->m_eObjType = LevelEditorLayerObjectType;
v12 = cocos2d::CCTransitionFade::create(0.5, v8);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v13);
cocos2d::CCDirector::replaceScene(v14, v12);
}
}