//
// MusicDownloadManager::clearUnusedSongs from 0x830098 to 0x830154 (188 bytes)
//
// 4 xrefs:
// > GJSongBrowser::FLAlert_Clicked @ 0x5be9d0
// > LevelBrowserLayer::FLAlert_Clicked @ 0x6ed6f4
// > GJAccountManager::backupAccount @ 0x8467c4
// > ??> @ 0x5cdc0
//
// 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::clearUnusedSongs(MusicDownloadManager *a1)
{
GameLevelManager *v2; // x0
unsigned int v3; // w19
cocos2d::CCDictionary *AllUsedSongIDs; // x23
cocos2d::CCArray *AllSongs; // x21
bool v6; // cf
unsigned int v7; // w1
cocos2d::CCArray *i; // x0
__int64 v9; // x20
v2 = GameLevelManager::sharedState();
v3 = 0;
AllUsedSongIDs = GameLevelManager::getAllUsedSongIDs(v2);
AllSongs = MusicDownloadManager::getAllSongs(a1);
v6 = (unsigned int)cocos2d::CCArray::count(AllSongs) == 0;
v7 = 0;
for ( i = AllSongs; !v6; i = AllSongs )
{
v9 = cocos2d::CCArray::objectAtIndex(i, v7);
if ( MusicDownloadManager::isSongDownloaded(a1, *(_DWORD *)(v9 + 316))
|| cocos2d::CCDictionary::objectForKey(AllUsedSongIDs, *(int *)(v9 + 316)) )
{
++v3;
}
else
{
++v3;
MusicDownloadManager::clearSong(a1, *(_DWORD *)(v9 + 316));
}
v6 = v3 >= (unsigned int)cocos2d::CCArray::count(AllSongs);
v7 = v3;
}
}