//
// MusicDownloadManager::addMusicDownloadDelegate from 0x1001d2c9c to 0x1001d2d20 (132 bytes)
//
// 11 xrefs:
// > CustomSongWidget::init @ 0x10011f4dc
// > SFXBrowser::init @ 0x1001f3104
// > SetupSongTriggerPopup::init @ 0x100258b80
// > AudioAssetsBrowser::init @ 0x100269a74
// > MenuLayer::init @ 0x100304c34
// > CustomSFXWidget::init @ 0x10038c2b4
// > sub_100467BDC @ 0x100468d30
// > EditorUI::init @ 0x100470970
// > AudioAssetsPopup::init @ 0x1004a98c0
// > sub_1004D3630 @ 0x1004d3678
// > NewsPopup::init @ 0x100517b90
//
// 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:23 +0000
//
double __fastcall MusicDownloadManager::addMusicDownloadDelegate(__int64 a1, __int64 a2)
{
__int64 v4; // x21
double result; // d0
_QWORD *v6; // x1
if ( (unsigned int)sub_1002E757C(*(_QWORD *)(a1 + 336)) )
{
v4 = 0;
while ( *(_QWORD *)(sub_1002E75A0(*(_QWORD *)(a1 + 336), v4) + 320) != a2 )
{
v4 = (unsigned int)(v4 + 1);
if ( (unsigned int)v4 >= (unsigned int)sub_1002E757C(*(_QWORD *)(a1 + 336)) )
goto LABEL_5;
}
}
else
{
LABEL_5:
v6 = MusicDelegateHandler::create(a2);
*(_QWORD *)&result = sub_1002E74E0(*(_QWORD *)(a1 + 336), v6).n128_u64[0];
}
return result;
}