//
// MusicDownloadManager::onDownloadMusicLibraryCompleted from 0x100157ec4 to 0x100157fe0 (284 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::downloadMusicLibrary @ 0x100157dc0
//
// 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::onDownloadMusicLibraryCompleted(
MusicDownloadManager *a1,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
std::string *v5; // x0
FILE *v6; // x21
cocos2d::CCDictionary *m_musicObjects; // x0
std::string v8; // [xsp+8h] [xbp-38h] BYREF
MusicDownloadManager::removeDLFromActive(a1, "dl_music_l");
if ( a3 && a3->_succeed )
{
MusicDownloadManager::pathForSongFolder((__int64)a1, 0, (__int64)&v8);
std::string::append(&v8, "musiclibrary.dat");
if ( (v8.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v5 = &v8;
else
v5 = (std::string *)v8.__r_.__value_.__r.__words[0];
v6 = fopen((const char *)v5, "wb");
if ( v6
&& (fwrite(a3->_responseData.__begin_, 1u, a3->_responseData.__end_ - a3->_responseData.__begin_, v6),
fclose(v6),
MusicDownloadManager::parseMusicLibrary(a1),
(m_musicObjects = a1->m_musicObjects) != nullptr)
&& cocos2d::CCDictionary::count(m_musicObjects) )
{
MusicDownloadManager::musicActionFinished(a1, UpdateMusicLibrary|0x1);
}
else
{
MusicDownloadManager::musicActionFailed(a1, UpdateMusicLibrary|0x1);
}
if ( SHIBYTE(v8.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v8.__r_.__value_.__l.__data_);
}
else
{
MusicDownloadManager::musicActionFailed(a1, UpdateMusicLibrary|0x1);
}
}