//
// MusicDownloadManager::downloadSFXLibrary from 0x969454 to 0x9696d0 (636 bytes)
//
// 4 xrefs:
// > MusicDownloadManager::onTryUpdateSFXLibraryCompleted @ 0x969774
// > SFXBrowser::trySetupSFXBrowser @ 0xb947b4
// > AudioAssetsBrowser::trySetupAudioBrowser @ 0xbc1f18
// > ??> @ 0x103348
//
// 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::downloadSFXLibrary(MusicDownloadManager *this)
{
unsigned __int8 v2; // w0
__int64 v3; // x1
cocos2d::CCObject *Request; // x2
cocos2d::CCObject *v6; // [xsp+48h] [xbp+48h]
cocos2d::CCObject *v7; // [xsp+48h] [xbp+48h]
__int64 v8; // [xsp+50h] [xbp+50h] BYREF
size_t v9; // [xsp+58h] [xbp+58h]
void *v10; // [xsp+60h] [xbp+60h]
__int64 v11; // [xsp+68h] [xbp+68h] BYREF
size_t v12; // [xsp+70h] [xbp+70h]
void *v13; // [xsp+78h] [xbp+78h]
__int64 v14; // [xsp+80h] [xbp+80h] BYREF
size_t v15; // [xsp+88h] [xbp+88h]
void *v16; // [xsp+90h] [xbp+90h]
__int64 v17; // [xsp+98h] [xbp+98h] BYREF
size_t v18; // [xsp+A0h] [xbp+A0h]
void *v19; // [xsp+A8h] [xbp+A8h]
__int64 v20[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v21; // [xsp+C0h] [xbp+C0h]
v2 = *((_BYTE *)this + 368);
v3 = v2 >> 1;
if ( (v2 & 1) != 0 )
v3 = *((_QWORD *)this + 47);
if ( v3 && !MusicDownloadManager::isDLActive(this, "dl_sfx_l") )
{
*((_BYTE *)this + 432) = 1;
v8 = 0;
v9 = 0;
v10 = nullptr;
std::string::__init(&v8, "/sfx/sfxlibrary.dat", 0x13u);
v14 = 0;
v15 = 0;
v16 = nullptr;
if ( (v8 & 1) != 0 )
{
std::string::__init(&v14, v10, v9);
}
else
{
v14 = v8;
v15 = v9;
v16 = v10;
}
MusicDownloadManager::generateCustomContentURL((__int64)this, (__int64)&v14, &v11);
if ( (v14 & 1) != 0 )
operator delete(v16);
v17 = 0;
v18 = 0;
v19 = nullptr;
if ( (v11 & 1) != 0 )
{
std::string::__init(&v17, v13, v12);
}
else
{
v19 = v13;
v17 = v11;
v18 = v12;
}
v20[0] = 0;
v20[1] = 0;
v21 = nullptr;
std::string::__init(v20, &byte_11B8890, 0);
Request = (cocos2d::CCObject *)MusicDownloadManager::ProcessHttpGetRequest(
this,
(__int64)&v17,
(__int64)v20,
(__int64)MusicDownloadManager::onDownloadSFXLibraryCompleted,
0,
0,
0);
if ( (v20[0] & 1) != 0 )
{
v7 = Request;
operator delete(v21);
Request = v7;
}
if ( (v17 & 1) != 0 )
{
v6 = Request;
operator delete(v19);
Request = v6;
}
MusicDownloadManager::addDLToActive(this, "dl_sfx_l", Request);
if ( (v11 & 1) != 0 )
operator delete(v13);
if ( (v8 & 1) != 0 )
operator delete(v10);
}
return _stack_chk_guard;
}