//
// MusicDownloadManager::onDownloadSFXLibraryCompleted from 0x100595720 to 0x1005958cf (431 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::downloadSFXLibrary @ 0x10059564c
//
// 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
//
void __fastcall MusicDownloadManager::onDownloadSFXLibraryCompleted(
MusicDownloadManager *a1,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
const char *data; // rdi
unsigned int v6; // r14d
__int64 v7; // rax
FILE *v8; // rax
FILE *v9; // r15
unsigned int v10; // r14d
__int64 v11; // rax
unsigned int v12; // r14d
__int64 v13; // rax
std::string v14; // [rsp+0h] [rbp-30h] BYREF
MusicDownloadManager::removeDLFromActive(a1, "dl_sfx_l");
if ( a3 && a3->_succeed )
{
MusicDownloadManager::pathForSFXFolder(&v14, (__int64)a1, 0);
std::string::append(&v14, "sfxlibrary.dat");
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
data = v14.__r_.__value_.__l.__data_;
else
data = v14.__r_.__value_.__s.__data_;
v8 = fopen(data, "wb");
v9 = v8;
if ( v8 )
{
fwrite(a3->_responseData.__begin_, 1u, a3->_responseData.__end_ - a3->_responseData.__begin_, v8);
fclose(v9);
MusicDownloadManager::parseSFXLibrary(a1);
if ( (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
{
v10 = 0;
do
{
v11 = sub_1007200C0(a1->m_musicDownloadDelegates, v10);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v11 + 320) + 64LL))(*(_QWORD *)(v11 + 320), 1);
++v10;
}
while ( v10 < (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) );
}
}
else if ( (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
{
v12 = 0;
do
{
v13 = sub_1007200C0(a1->m_musicDownloadDelegates, v12);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v13 + 320) + 72LL))(*(_QWORD *)(v13 + 320), 1);
++v12;
}
while ( v12 < (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) );
}
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v14.__r_.__value_.__l.__data_);
}
else if ( (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
{
v6 = 0;
do
{
v7 = sub_1007200C0(a1->m_musicDownloadDelegates, v6);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v7 + 320) + 72LL))(*(_QWORD *)(v7 + 320), 1);
++v6;
}
while ( v6 < (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) );
}
}