//
// MusicDownloadManager::addMusicDownloadDelegate from 0x140482700 to 0x1404827d7 (215 bytes)
//
// 12 xrefs:
// > AudioAssetsBrowser::init @ 0x1400994e3
// > AudioAssetsPopup::init @ 0x1400be364
// > CustomSFXWidget::init @ 0x140161755
// > CustomSongWidget::init @ 0x14016a61e
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0x1401987e1
// > EditorUI::init @ 0x1401ac33e
// > MenuLayer::init @ 0x140473a13
// > MusicBrowser::init @ 0x14047ba36
// > NewsPopup::init @ 0x14049dce2
// > SetupSongTriggerPopup::init @ 0x1405f3043
// > SFXBrowser::init @ 0x14061886c
// > ??> @ 0x1409289c4
//
// This function is hookable on this platform (idp: pc, 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:32:45 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall MusicDownloadManager::addMusicDownloadDelegate(__int64 a1, __int64 a2)
{
unsigned int v4; // ebx
cocos2d::CCNode *v5; // rbx
v4 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)) )
{
while ( *((_QWORD *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 336), v4) + 40) != a2 )
{
if ( ++v4 >= cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)) )
goto LABEL_4;
}
}
else
{
LABEL_4:
v5 = (cocos2d::CCNode *)operator new(0x148u);
cocos2d::CCNode::CCNode(v5);
*(_QWORD *)v5 = &MusicDelegateHandler::`vftable';
*((_QWORD *)v5 + 40) = 0;
if ( cocos2d::CCNode::init(v5) )
{
*((_QWORD *)v5 + 40) = a2;
cocos2d::CCObject::autorelease(v5);
}
else
{
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v5 + 8LL))(v5, 1);
v5 = nullptr;
}
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 336), v5);
}
}