//
// CustomSongWidget::onDownload from 0x86d3dc to 0x86d5ac (464 bytes)
//
// 5 xrefs:
// > CustomSongWidget::musicActionFinished @ 0x86d5c8
// > CustomSongWidget::FLAlert_Clicked @ 0x86d650
// > ??> @ 0x8eae0
// > CustomSongWidget::init @ 0x86b200
// > ??> @ 0x1543ca0
//
// This function is hookable on this platform (idp: arm, 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 12:55:44 +0000
//
__int64 __fastcall CustomSongWidget::onDownload(CustomSongWidget *this, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
GameManager *v4; // x0
MusicDownloadManager *GameVariable; // x0
__int64 result; // x0
MusicDownloadManager *v7; // x0
MusicDownloadManager *v8; // x0
MusicDownloadManager *v9; // x0
__int64 v10; // x2
__int64 v11; // x1
MusicDownloadManager *v12; // x0
MusicDownloadManager *v13; // x0
__int64 v14; // x2
__int64 v15; // x1
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 47) + 344LL))(*((_QWORD *)this + 47), 0);
v3 = *((GameManager **)this + 60);
if ( v3 )
v3 = (GameManager *)(*(__int64 (__fastcall **)(GameManager *, _QWORD))(*(_QWORD *)v3 + 344LL))(v3, 0);
v4 = (GameManager *)GameManager::sharedState(v3);
GameVariable = (MusicDownloadManager *)(unsigned __int8)GameManager::getGameVariable(v4, "0016");
if ( !(_BYTE)GameVariable )
{
v13 = (MusicDownloadManager *)MusicDownloadManager::sharedState(GameVariable);
return MusicDownloadManager::showTOS(v13, (CustomSongWidget *)((char *)this + 328));
}
if ( *((_BYTE *)this + 529) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 48) + 344LL))(*((_QWORD *)this + 48), 0);
v9 = (MusicDownloadManager *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 49) + 344LL))(
*((_QWORD *)this + 49),
1);
v10 = MusicDownloadManager::sharedState(v9) + 368;
v11 = *(_BYTE *)v10 >> 1;
if ( (*(_BYTE *)v10 & 1) != 0 )
v11 = *(_QWORD *)(v10 + 8);
if ( v11 )
return CustomSongWidget::startMultiAssetDownload(this);
goto LABEL_12;
}
result = *((_QWORD *)this + 42);
if ( !result )
return result;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 57) + 344LL))(*((_QWORD *)this + 57), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 48) + 344LL))(*((_QWORD *)this + 48), 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 49) + 344LL))(*((_QWORD *)this + 49), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 54) + 344LL))(*((_QWORD *)this + 54), 0);
if ( *((int *)this + 126) > 9999999 )
{
v14 = MusicDownloadManager::sharedState((MusicDownloadManager *)((char *)&loc_98967C + 3)) + 368;
v15 = *(_BYTE *)v14 >> 1;
if ( (*(_BYTE *)v14 & 1) != 0 )
v15 = *(_QWORD *)(v14 + 8);
if ( !v15 )
{
LABEL_12:
*((_BYTE *)this + 528) = (unsigned __int8)&dword_0 + 1;
v12 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)((char *)&dword_0 + 1));
return MusicDownloadManager::getCustomContentURL(v12);
}
}
v7 = (MusicDownloadManager *)*(unsigned __int8 *)(*((_QWORD *)this + 42) + 433LL);
if ( *(_BYTE *)(*((_QWORD *)this + 42) + 433LL) )
return CustomSongWidget::startDownload(this);
*((_BYTE *)this + 499) = 1;
v8 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v7);
return MusicDownloadManager::getSongInfo(v8, *((_DWORD *)this + 126), 1);
}