//
// CustomSongLayer::onClose from 0x1401654b0 to 0x14016557b (203 bytes)
//
// 3 xrefs:
// > CustomSongLayer::keyBackClicked @ 0x140165589
// > CustomSongLayer::init @ 0x140163ecf
// > ??> @ 0x140917ee8
//
// 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 11:27:26 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall CustomSongLayer::onClose(__int64 a1)
{
void (__fastcall ***v2)(_QWORD); // rcx
_QWORD *v3; // rbx
__int64 v4; // rcx
__int64 v5; // rdx
void *v7; // [rsp+30h] [rbp+8h]
v2 = *(void (__fastcall ****)(_QWORD))(a1 + 704);
if ( v2 )
(**v2)(v2);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 688) + 1032LL))(*(_QWORD *)(a1 + 688), 0);
v3 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v7 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v3 = (_QWORD *)qword_14090BF60;
}
v4 = v3[69];
if ( v4 )
FMOD::ChannelControl::stop(v4);
sub_14003EB60(v3 + 137);
sub_14003EB60(v3 + 145);
sub_14003EB60(v3 + 153);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 992LL))(a1, 0);
LOBYTE(v5) = 1;
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 520LL))(a1, v5);
}