//
// CustomSongWidget::onDownload from 0x1000fa8d8 to 0x1000faa80 (424 bytes)
//
// 4 xrefs:
// > CustomSongWidget::musicActionFinished @ 0x1000fe67c
// > sub_1000FE684 @ 0x1000fe6a4
// > CustomSongWidget::FLAlert_Clicked @ 0x1000fe710
// > CustomSongWidget::init @ 0x1000f9c28
//
// 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 CustomSongWidget::onDownload(CustomSongWidget *a1, cocos2d::CCObject *a2)
{
cocos2d::extension::CCScale9Sprite *m_bgSpr; // x0
GameManager *v4; // x0
MusicDownloadManager *v5; // x0
MusicDownloadManager *v6; // x0
MusicDownloadManager *v7; // x0
std::size_t size; // x8
MusicDownloadManager *v9; // x0
MusicDownloadManager *v10; // x0
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_errorLabel->setVisible)(a1->m_errorLabel, 0);
m_bgSpr = a1->m_bgSpr;
if ( m_bgSpr )
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, _QWORD))m_bgSpr->setVisible)(m_bgSpr, 0);
v4 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v4, "0016") )
{
v6 = MusicDownloadManager::sharedState();
MusicDownloadManager::showTOS(v6, &a1->FLAlertLayerProtocol);
return;
}
if ( a1->m_hasSFX )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadBtn->setVisible)(a1->m_downloadBtn, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_cancelDownloadBtn->setVisible)(
a1->m_cancelDownloadBtn,
1);
v5 = MusicDownloadManager::sharedState();
if ( (v5->m_customContentURL.m_data.m_short.shortStorage.__elems_[22] & 0x8000000000000000LL) != 0 )
{
if ( !v5->m_customContentURL.m_data.m_long.size )
{
LABEL_18:
a1->m_hasLibrarySongs = 1;
v9 = MusicDownloadManager::sharedState();
MusicDownloadManager::getCustomContentURL(v9);
return;
}
}
else if ( !v5->m_customContentURL.m_data.m_short.shortStorage.__elems_[22] )
{
goto LABEL_18;
}
CustomSongWidget::startMultiAssetDownload(a1);
return;
}
if ( a1->m_songInfoObject )
{
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_sliderGroove->setVisible)(a1->m_sliderGroove, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadBtn->setVisible)(a1->m_downloadBtn, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_cancelDownloadBtn->setVisible)(
a1->m_cancelDownloadBtn,
1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteBtn->setVisible)(a1->m_deleteBtn, 0);
if ( a1->m_customSongID >= 10000000 )
{
v7 = MusicDownloadManager::sharedState();
size = v7->m_customContentURL.m_data.m_short.shortStorage.__elems_[22];
if ( (size & 0x8000000000000000LL) != 0 )
size = v7->m_customContentURL.m_data.m_long.size;
if ( !size )
goto LABEL_18;
}
if ( a1->m_songInfoObject->m_verified )
{
CustomSongWidget::startDownload(a1);
}
else
{
a1->m_isNotDownloading = 1;
v10 = MusicDownloadManager::sharedState();
MusicDownloadManager::getSongInfo(v10, a1->m_customSongID, 1);
}
}
}