//
// MusicDownloadManager::clearUnusedSongs from 0x96d388 to 0x96d444 (188 bytes)
//
// 4 xrefs:
// > GJSongBrowser::FLAlert_Clicked @ 0x6e7224
// > LevelBrowserLayer::FLAlert_Clicked @ 0x7fc794
// > GJAccountManager::backupAccount @ 0x98ad08
// > ??> @ 0x7f288
//
// This function is hookable on this platform (idp: arm, 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 12:57:39 +0000
//
cocos2d::CCArray *__fastcall MusicDownloadManager::clearUnusedSongs(MusicDownloadManager *this)
{
GameLevelManager *v2; // x0
unsigned int v3; // w19
cocos2d::CCDictionary *AllUsedSongIDs; // x23
cocos2d::CCArray *AllSongs; // x21
bool v6; // cf
unsigned int v7; // w1
cocos2d::CCArray *result; // x0
__int64 v9; // x20
v2 = (GameLevelManager *)GameLevelManager::sharedState(this);
v3 = 0;
AllUsedSongIDs = GameLevelManager::getAllUsedSongIDs(v2);
AllSongs = MusicDownloadManager::getAllSongs(this);
v6 = (unsigned int)cocos2d::CCArray::count(AllSongs) == 0;
v7 = 0;
for ( result = AllSongs; !v6; result = AllSongs )
{
v9 = cocos2d::CCArray::objectAtIndex(result, v7);
if ( (unsigned __int8)MusicDownloadManager::isSongDownloaded(this, *(_DWORD *)(v9 + 316))
|| cocos2d::CCDictionary::objectForKey(AllUsedSongIDs, *(int *)(v9 + 316)) )
{
++v3;
}
else
{
++v3;
MusicDownloadManager::clearSong(this, (const char *)*(unsigned int *)(v9 + 316));
}
v6 = v3 >= (unsigned int)cocos2d::CCArray::count(AllSongs);
v7 = v3;
}
return result;
}