//
// MusicDownloadManager::downloadSFX from 0x968ec4 to 0x9691d8 (788 bytes)
//
// 5 xrefs:
// > CustomSongWidget::processNextMultiAsset @ 0x86ce90
// > CustomSFXWidget::startDownload @ 0xb5dfb4
// > EditorSFXManager::downloadAllMissing @ 0xcc0764
// > EditorSoundConfigInfoLayer::downloadMissingSFX @ 0xcd3394
// > ??> @ 0x55078
//
// 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:57:37 +0000
//
__int64 __fastcall MusicDownloadManager::downloadSFX(MusicDownloadManager *this, unsigned int a2)
{
unsigned __int8 v4; // w0
__int64 v5; // x1
const char *SFXDownloadKey; // x22
size_t v8; // x2
char *v9; // x1
cocos2d::CCObject *Request; // x2
cocos2d::CCObject *v11; // [xsp+48h] [xbp+48h]
cocos2d::CCObject *v12; // [xsp+48h] [xbp+48h]
unsigned __int64 v13; // [xsp+58h] [xbp+58h] BYREF
size_t v14; // [xsp+60h] [xbp+60h]
void *v15; // [xsp+68h] [xbp+68h]
__int64 v16; // [xsp+70h] [xbp+70h] BYREF
size_t v17; // [xsp+78h] [xbp+78h]
void *v18; // [xsp+80h] [xbp+80h]
__int64 v19; // [xsp+88h] [xbp+88h] BYREF
size_t v20; // [xsp+90h] [xbp+90h]
void *v21; // [xsp+98h] [xbp+98h]
__int64 v22; // [xsp+A0h] [xbp+A0h] BYREF
size_t v23; // [xsp+A8h] [xbp+A8h]
void *v24; // [xsp+B0h] [xbp+B0h]
__int64 v25; // [xsp+B8h] [xbp+B8h] BYREF
size_t v26; // [xsp+C0h] [xbp+C0h]
void *v27; // [xsp+C8h] [xbp+C8h]
unsigned __int64 v28; // [xsp+D0h] [xbp+D0h] BYREF
size_t v29; // [xsp+D8h] [xbp+D8h]
void *v30; // [xsp+E0h] [xbp+E0h]
v4 = *((_BYTE *)this + 368);
v5 = v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *((_QWORD *)this + 47);
if ( v5 )
{
SFXDownloadKey = (const char *)MusicDownloadManager::getSFXDownloadKey(this, (const char *)a2);
if ( !MusicDownloadManager::isDLActive(this, SFXDownloadKey) )
{
GameToolbox::intToString(&v13, (GameToolbox *)a2);
v16 = 0;
v17 = 0;
v18 = nullptr;
std::string::__init(&v16, "/sfx/s", 6u);
if ( (v13 & 1) != 0 )
{
v9 = (char *)v15;
v8 = v14;
}
else
{
v8 = (unsigned __int8)v13 >> 1;
v9 = (char *)&v13 + 1;
}
std::string::append((__int64)&v16, v9, v8);
std::string::append((__int64)&v16, ".ogg", 4u);
v22 = 0;
v23 = 0;
v24 = nullptr;
if ( (v16 & 1) != 0 )
{
std::string::__init(&v22, v18, v17);
}
else
{
v22 = v16;
v23 = v17;
v24 = v18;
}
MusicDownloadManager::generateCustomContentURL((__int64)this, (__int64)&v22, &v19);
if ( (v22 & 1) != 0 )
operator delete(v24);
v25 = 0;
v26 = 0;
v27 = nullptr;
if ( (v19 & 1) != 0 )
{
std::string::__init(&v25, v21, v20);
}
else
{
v27 = v21;
v25 = v19;
v26 = v20;
}
v28 = 0;
v29 = 0;
v30 = nullptr;
if ( (v13 & 1) != 0 )
{
std::string::__init((__int64 *)&v28, v15, v14);
}
else
{
v30 = v15;
v28 = v13;
v29 = v14;
}
Request = (cocos2d::CCObject *)MusicDownloadManager::ProcessHttpGetRequest(
this,
(__int64)&v25,
(__int64)&v28,
(__int64)MusicDownloadManager::onDownloadSFXCompleted,
0,
5,
10);
if ( (v28 & 1) != 0 )
{
v12 = Request;
operator delete(v30);
Request = v12;
}
if ( (v25 & 1) != 0 )
{
v11 = Request;
operator delete(v27);
Request = v11;
}
MusicDownloadManager::addDLToActive(this, SFXDownloadKey, Request);
if ( (v19 & 1) != 0 )
operator delete(v21);
if ( (v16 & 1) != 0 )
operator delete(v18);
if ( (v13 & 1) != 0 )
operator delete(v15);
}
}
return _stack_chk_guard;
}