//
// MusicDownloadManager::clearUnusedSongs from 0x572924 to 0x57297e (90 bytes)
//
// 3 xrefs:
// > GJSongBrowser::FLAlert_Clicked @ 0x3f7468
// > LevelBrowserLayer::FLAlert_Clicked @ 0x4a8e5e
// > GJAccountManager::backupAccount @ 0x583154
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:39 +0000
//
unsigned int __fastcall MusicDownloadManager::clearUnusedSongs(MusicDownloadManager *this)
{
GameLevelManager *v2; // r0
unsigned int v3; // r4
cocos2d::CCDictionary *AllUsedSongIDs; // r8
cocos2d::CCArray *AllSongs; // r7
unsigned int result; // r0
int v7; // r5
unsigned int v8; // r2
v2 = (GameLevelManager *)GameLevelManager::sharedState(this);
v3 = 0;
AllUsedSongIDs = GameLevelManager::getAllUsedSongIDs(v2);
AllSongs = MusicDownloadManager::getAllSongs(this);
while ( 1 )
{
result = cocos2d::CCArray::count(AllSongs);
if ( v3 >= result )
break;
v7 = cocos2d::CCArray::objectAtIndex(AllSongs, v3);
if ( !MusicDownloadManager::isSongDownloaded(this, *(_DWORD *)(v7 + 264), v8)
&& !cocos2d::CCDictionary::objectForKey(AllUsedSongIDs, *(_DWORD *)(v7 + 264)) )
{
MusicDownloadManager::clearSong(this, *(const char **)(v7 + 264));
}
++v3;
}
return result;
}