//
// CustomSongLayer::onClose from 0x1400c43b0 to 0x1400c447d (205 bytes)
//
// 4 xrefs:
// > CustomSongLayer::keyBackClicked @ 0x1400c4489
// > CustomSongLayer::init @ 0x1400c2e6c
// > ??> @ 0x1406c80d0
// > ??> @ 0x1406c80dc
//
// 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=2
void CustomSongLayer::onClose(CustomSongLayer *a1, cocos2d::CCObject *a2)
{
CustomSongLayerDelegate *m_delegate; // rcx
__int64 v4; // rbx
_BOOL8 v5; // rdx
FMODAudioEngine *v6; // [rsp+30h] [rbp+8h]
m_delegate = a1->m_delegate;
if ( m_delegate )
((void (__fastcall *)(CustomSongLayerDelegate *, cocos2d::CCObject *))m_delegate->customSongLayerClosed)(
m_delegate,
a2);
a1->m_songIDInput->onClickTrackNode(a1->m_songIDInput, 0);
v4 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v6 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = qword_1406C2E88;
}
if ( *(_QWORD *)(v4 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v4 + 552));
sub_14005E0D0((_QWORD *)(v4 + 1064));
sub_14005E0D0((_QWORD *)(v4 + 1128));
sub_14005E0D0((_QWORD *)(v4 + 1192));
a1->setKeypadEnabled(a1, 0);
LOBYTE(v5) = 1;
a1->removeFromParentAndCleanup(a1, v5);
}