//
// CustomSFXWidget::onToggleFavorite from 0x140162080 to 0x14016219f (287 bytes)
//
// 2 xrefs:
// > CustomSFXWidget::init @ 0x140160e12
// > ??> @ 0x140917d80
//
// 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=2
__int64 __fastcall CustomSFXWidget::onToggleFavorite(__int64 a1)
{
__int64 result; // rax
__int64 v3; // rbx
__int64 v4; // rcx
_BYTE v5[24]; // [rsp+20h] [rbp-18h] BYREF
void *v6; // [rsp+40h] [rbp+8h] BYREF
result = *(_QWORD *)(a1 + 336);
if ( result )
{
v3 = qword_14090C070;
if ( *(int *)(result + 76) <= 0 )
{
if ( !qword_14090C070 )
{
v6 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v3 = qword_14090C070;
}
LODWORD(v6) = *(_DWORD *)(*(_QWORD *)(a1 + 336) + 56LL);
if ( (int)v6 <= 0 || sub_140066A60((_QWORD *)(v3 + 648), (unsigned __int8 *)&v6) )
return CustomSFXWidget::updateSFXInfo(a1);
v4 = v3 + 648;
}
else
{
if ( !qword_14090C070 )
{
v6 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v3 = qword_14090C070;
}
LODWORD(v6) = *(_DWORD *)(*(_QWORD *)(a1 + 336) + 76LL);
if ( (int)v6 <= 1 || sub_140066A60((_QWORD *)(v3 + 712), (unsigned __int8 *)&v6) )
return CustomSFXWidget::updateSFXInfo(a1);
v4 = v3 + 712;
}
sub_140068190(v4, (__int64)v5, (unsigned __int8 *)&v6);
return CustomSFXWidget::updateSFXInfo(a1);
}
return result;
}