//
// CustomSongWidget::deleteSong from 0x14016b270 to 0x14016b4e8 (632 bytes)
//
// 2 xrefs:
// > CustomSongWidget::FLAlert_Clicked @ 0x14016ed59
// > ??> @ 0x1409180d4
//
// 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:29 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall CustomSongWidget::deleteSong(__int64 a1)
{
__int64 v2; // rcx
_QWORD *v3; // rbx
_QWORD *v4; // rcx
_QWORD *v5; // rbx
__int64 v6; // rcx
__int64 v7; // rcx
const char *v8; // rcx
float v9; // xmm2_4
float v10; // xmm1_4
__int64 v11; // rdx
__int16 v12; // [rsp+20h] [rbp-68h] BYREF
char v13; // [rsp+22h] [rbp-66h]
void *v14; // [rsp+28h] [rbp-60h]
_BYTE *v15; // [rsp+30h] [rbp-58h]
_BYTE v16[32]; // [rsp+38h] [rbp-50h] BYREF
char *FileName[4]; // [rsp+58h] [rbp-30h] BYREF
if ( *(_QWORD *)(a1 + 336) )
{
v15 = v16;
v2 = qword_14090C070;
if ( !qword_14090C070 )
{
v14 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v2 = qword_14090C070;
}
v3 = (_QWORD *)MusicDownloadManager::pathForSong(v2, v16, *(unsigned int *)(*(_QWORD *)(a1 + 336) + 320LL));
v4 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v14 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v4 = (_QWORD *)qword_14090BF60;
}
if ( FMODAudioEngine::isMusicPlaying(v4, v3) )
{
v5 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v14 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v5 = (_QWORD *)qword_14090BF60;
}
v6 = v5[69];
if ( v6 )
FMOD::ChannelControl::stop(v6);
sub_14003EB60(v5 + 137);
sub_14003EB60(v5 + 145);
sub_14003EB60(v5 + 153);
}
v7 = qword_14090C070;
if ( !qword_14090C070 )
{
v14 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v7 = qword_14090C070;
}
MusicDownloadManager::pathForSong(v7, FileName, *(unsigned int *)(*(_QWORD *)(a1 + 336) + 320LL));
v8 = (const char *)FileName;
if ( FileName[3] > (char *)0xF )
v8 = FileName[0];
remove(v8);
sub_14003D310((__int64)FileName);
CustomSongWidget::updateSongInfo(a1);
v12 = 25855;
v13 = 0;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(a1 + 376) + 368LL))(*(_QWORD *)(a1 + 376) + 368LL, &v12);
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 376) + 360LL))(
*(_QWORD *)(a1 + 376) + 360LL,
"Song Deleted");
if ( *(_BYTE *)(a1 + 501) )
{
v9 = 0.34999999;
v10 = 140.0;
}
else
{
v9 = 0.40000001;
v10 = 230.0;
}
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 376), v10, v9, 0.0);
LOBYTE(v11) = 1;
CustomSongWidget::showError(a1, v11);
}
}