//
// MusicDownloadManager::limitDownloadedSongs from 0x1001d4a6c to 0x1001d4af4 (136 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::onDownloadSongCompleted @ 0x1001d53d0
//
// 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 11:00:24 +0000
//
__int64 __fastcall MusicDownloadManager::limitDownloadedSongs(__int64 a1)
{
__int64 v2; // x0
int v3; // w21
int v4; // w22
__int64 DownloadedSongs; // x20
__int64 result; // x0
__int64 v7; // x1
v2 = GameManager::sharedState(a1);
v3 = *(_DWORD *)(v2 + 1140);
v4 = *(_DWORD *)(GameManager::sharedState(v2) + 1144);
DownloadedSongs = MusicDownloadManager::getDownloadedSongs(a1);
result = sub_1002E757C(DownloadedSongs);
if ( (unsigned int)result >= 0x33 )
{
do
{
v7 = *(unsigned int *)(sub_1002E75B0(DownloadedSongs) + 316);
if ( (_DWORD)v7 != v3 && (_DWORD)v7 != v4 )
MusicDownloadManager::deleteSong(a1, v7);
sub_1002E7648(DownloadedSongs, 1);
result = sub_1002E757C(DownloadedSongs);
}
while ( (unsigned int)result > 0x32 );
}
return result;
}