//
// MusicDownloadManager::addMusicDownloadDelegate from 0x10058b0b0 to 0x10058b187 (215 bytes)
//
// 7 xrefs:
// > EditorUI::init @ 0x10000b601
// > SetupSongTriggerPopup::init @ 0x1002d3b20
// > SFXBrowser::init @ 0x10043f472
// > CustomSFXWidget::init @ 0x1005e387f
// > MusicBrowser::init @ 0x10060e859
// > CustomSongWidget::init @ 0x10061b992
// > AudioAssetsBrowser::init @ 0x1007b442e
//
// 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 __fastcall MusicDownloadManager::addMusicDownloadDelegate(MusicDownloadManager *a1, MusicDownloadDelegate *a2)
{
unsigned int v2; // r15d
cocos2d::CCNode *v3; // r15
if ( (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
{
v2 = 0;
while ( *(MusicDownloadDelegate **)(sub_1007200C0(a1->m_musicDownloadDelegates, v2) + 320) != a2 )
{
if ( ++v2 >= (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
goto LABEL_5;
}
}
else
{
LABEL_5:
v3 = (cocos2d::CCNode *)operator new(0x148u);
cocos2d::CCNode::CCNode((__int64)v3);
v3->__vftable = (cocos2d::CCNode_vtbl *)off_10096FDD8;
v3[1].__vftable = nullptr;
if ( cocos2d::CCNode::init(v3) )
{
v3[1].__vftable = (cocos2d::CCNode_vtbl *)a2;
cocos2d::CCObject::autorelease(v3);
}
else
{
((void (__fastcall *)(cocos2d::CCNode *))v3->~CCNode_0)(v3);
v3 = nullptr;
}
sub_10071FCD0(a1->m_musicDownloadDelegates, v3);
}
}