//
// CustomSongWidget::deleteSong from 0x1400ca020 to 0x1400ca21f (511 bytes)
//
// 2 xrefs:
// > CustomSongWidget::FLAlert_Clicked @ 0x1400cda09
// > ??> @ 0x1406c82bc
//
// 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 CustomSongWidget::deleteSong(CustomSongWidget *a1)
{
SongInfoObject *m_songInfoObject; // rbx
MusicDownloadManager *v3; // rax
_QWORD *v4; // rbx
FMODAudioEngine *v5; // rcx
__int64 v6; // rbx
unsigned int m_songID; // ebx
MusicDownloadManager *v8; // rax
const char *v9; // rcx
float v10; // xmm2_4
float v11; // xmm1_4
__int16 v12; // [rsp+20h] [rbp-48h] BYREF
char v13; // [rsp+22h] [rbp-46h]
FMODAudioEngine *v14; // [rsp+28h] [rbp-40h]
char **v15; // [rsp+30h] [rbp-38h]
char *FileName[4]; // [rsp+38h] [rbp-30h] BYREF
m_songInfoObject = a1->m_songInfoObject;
if ( m_songInfoObject )
{
v15 = FileName;
v3 = MusicDownloadManager::sharedState();
v4 = (_QWORD *)MusicDownloadManager::pathForSong(v3, FileName, (unsigned int)m_songInfoObject->m_songID);
v5 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v14 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = (FMODAudioEngine *)qword_1406C2E88;
}
if ( FMODAudioEngine::isMusicPlaying(v5, v4) )
{
v6 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v14 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v6 = qword_1406C2E88;
}
if ( *(_QWORD *)(v6 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v6 + 552));
sub_14005E0D0((_QWORD *)(v6 + 1064));
sub_14005E0D0((_QWORD *)(v6 + 1128));
sub_14005E0D0((_QWORD *)(v6 + 1192));
}
m_songID = a1->m_songInfoObject->m_songID;
v8 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSong(v8, FileName, m_songID);
v9 = (const char *)FileName;
if ( FileName[3] > (char *)0xF )
v9 = FileName[0];
remove(v9);
sub_14003A830((__int64)FileName);
CustomSongWidget::updateSongInfo(a1);
v12 = 25855;
v13 = 0;
a1->m_errorLabel->setColor(&a1->m_errorLabel->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v12);
a1->m_errorLabel->setString(&a1->m_errorLabel->cocos2d::CCLabelProtocol, "Song Deleted");
if ( a1->m_isMusicLibrary )
{
v10 = 0.34999999;
v11 = 140.0;
}
else
{
v10 = 0.40000001;
v11 = 230.0;
}
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, v11, v10, 0.0);
CustomSongWidget::showError(a1, 1);
}
}