//
// CustomSFXWidget::onDownload from 0x140161e50 to 0x140161faf (351 bytes)
//
// 3 xrefs:
// > CustomSFXWidget::FLAlert_Clicked @ 0x140163a08
// > CustomSFXWidget::init @ 0x14016092f
// > ??> @ 0x140917d68
//
// 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:27:25 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall CustomSFXWidget::onDownload(__int64 a1)
{
__int64 result; // rax
__int64 v3; // rcx
__int64 v4; // rdx
__int64 v5; // rcx
__int64 v6; // rdx
__int64 v7; // rcx
void *v8; // [rsp+30h] [rbp+8h]
void *v9; // [rsp+30h] [rbp+8h]
void *v10; // [rsp+30h] [rbp+8h]
result = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 368) + 336LL))(*(_QWORD *)(a1 + 368), 0);
if ( *(_QWORD *)(a1 + 336) )
{
v3 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v8 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v8);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v3 = qword_14090BFD0;
}
if ( (unsigned __int8)GameManager::getGameVariable(v3, "0016") )
{
CustomSFXWidget::showLoadingArt(a1, v4);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 376) + 336LL))(*(_QWORD *)(a1 + 376), 0);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 384) + 336LL))(*(_QWORD *)(a1 + 384), v6);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 408) + 336LL))(*(_QWORD *)(a1 + 408), 0);
*(_BYTE *)(a1 + 491) = 0;
v7 = qword_14090C070;
if ( !qword_14090C070 )
{
v10 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v7 = qword_14090C070;
}
MusicDownloadManager::downloadSFX(v7, *(unsigned int *)(a1 + 496));
return CustomSFXWidget::startMonitorDownload(a1);
}
else
{
if ( !qword_14090C070 )
{
v9 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
return MusicDownloadManager::showTOS(v5, a1 + 328);
}
}
return result;
}