//
// MusicDownloadManager::isSFXDownloaded from 0x82f548 to 0x82f6f4 (428 bytes)
//
// 4 xrefs:
// > CustomSongWidget::updateWithMultiAssets @ 0x748900
// > CustomSFXWidget::updateSFXInfo @ 0xa32118
// > AudioAssetsBrowser::onInfo @ 0xa8ed40
// > ??> @ 0xa2cd8
//
// 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
//
bool MusicDownloadManager::isSFXDownloaded(MusicDownloadManager *a1, int a2)
{
char isResourceSFX; // w20
cocos2d::CCFileUtils *v6; // x20
MusicDownloadManager *v7; // x0
bool (__fastcall *isPopupNotify)(cocos2d::CCFileUtils *__hidden); // x21
void *v9; // x0
char *v10; // x0
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x1
int v14; // w2
char *v15; // [xsp+48h] [xbp+48h] BYREF
__int64 v16; // [xsp+50h] [xbp+50h] BYREF
isResourceSFX = MusicDownloadManager::isResourceSFX(a1, a2);
if ( !isResourceSFX )
{
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = a1;
isPopupNotify = v6->isPopupNotify;
MusicDownloadManager::pathForSFX((__int64 *)&v15, v7, a2);
sub_D153B8((int)&v16, v15);
isResourceSFX = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64 *))isPopupNotify)(v6, &v16);
v9 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v16 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v9);
}
v10 = v15 - 24;
if ( v15 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v15 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v15 - 2);
*((_DWORD *)v15 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
return isResourceSFX;
}