//
// MusicDownloadManager::deleteSong from 0x82fabc to 0x82fb94 (216 bytes)
//
// 5 xrefs:
// > GJSongBrowser::FLAlert_Clicked @ 0x5be9ac
// > CustomSongCell::onDelete @ 0x60b468
// > CustomSongWidget::deleteSong @ 0x747550
// > MusicDownloadManager::limitDownloadedSongs @ 0x82fe50
// > ??> @ 0xbc688
//
// 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
//
void MusicDownloadManager::deleteSong(MusicDownloadManager *a1, int a2)
{
char *v2; // x0
unsigned int *v3; // x2
int v4; // w1
char *filename; // [xsp+30h] [xbp+30h] BYREF
MusicDownloadManager::pathForSong((__int64 *)&filename, a1, a2);
remove(filename);
v2 = filename - 24;
if ( filename - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v3 = (unsigned int *)(filename - 8);
do
v4 = __ldaxr(v3);
while ( __stlxr(v4 - 1, v3) );
}
else
{
v4 = *((_DWORD *)filename - 2);
*((_DWORD *)filename - 2) = v4 - 1;
}
if ( v4 <= 0 )
operator delete(v2);
}
}