//
// CustomSFXWidget::onDownload from 0x1005e3970 to 0x1005e3ac6 (342 bytes)
//
// 3 xrefs:
// > CustomSFXWidget::FLAlert_Clicked @ 0x1005e4ea5
// > sub_1005E4EC0 @ 0x1005e4f0c
// > CustomSFXWidget::init @ 0x1005e2f73
//
// 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 CustomSFXWidget::onDownload(CustomSFXWidget *a1, cocos2d::CCObject *a2)
{
GameManager *v2; // rax
MusicDownloadManager *v3; // rax
cocos2d::CCSprite *m_progressBarSprite; // r14
__m128 width_low; // xmm0
__m128 v6; // xmm2
MusicDownloadManager *v7; // rax
_BYTE v8[40]; // [rsp+8h] [rbp-28h] BYREF
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_errorLabel->setVisible)(a1->m_errorLabel, 0);
if ( a1->m_sfxObject )
{
v2 = GameManager::sharedState();
if ( GameManager::getGameVariable(v2, "0016") )
{
CustomSFXWidget::showLoadingArt(a1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadButton->setVisible)(a1->m_downloadButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_cancelButton->setVisible)(a1->m_cancelButton, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteButton->setVisible)(a1->m_deleteButton, 0);
a1->m_showCancel = 0;
v3 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSFX(v3, a1->m_sfxID);
m_progressBarSprite = a1->m_progressBarSprite;
width_low = (__m128)LODWORD(a1->m_progressOutlineSprite->m_obRect.size.width);
width_low.f32[0] = width_low.f32[0] + -4.0;
v6 = width_low;
v6.f32[0] = fminf(width_low.f32[0] * 0.0, width_low.f32[0]);
sub_10028CC00((__int64)v8, 0.0, 0.0, v6, (__m128)0x41000000u);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *))m_progressBarSprite->setTextureRect)(m_progressBarSprite, v8);
CustomSFXWidget::showLoadingArt(a1);
cocos2d::CCNode::unschedule(a1, (cocos2d::SEL_SCHEDULE)(unsigned __int64)CustomSFXWidget::updateDownloadProgress);
cocos2d::CCNode::schedule_1(
a1,
(cocos2d::SEL_SCHEDULE)(unsigned __int64)CustomSFXWidget::updateDownloadProgress,
0.033333335);
}
else
{
v7 = MusicDownloadManager::sharedState();
MusicDownloadManager::showTOS(v7, &a1->FLAlertLayerProtocol);
}
}
}