//
// MusicDownloadManager::onDownloadMusicLibraryCompleted from 0x1001dbb48 to 0x1001dbc64 (284 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::downloadMusicLibrary @ 0x1001dba44
//
// 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 11:00:27 +0000
//
void __fastcall MusicDownloadManager::onDownloadMusicLibraryCompleted(__int64 a1, __int64 a2, __int64 a3)
{
std::string *v5; // x0
FILE *v6; // x21
__int64 v7; // x0
std::string v8; // [xsp+8h] [xbp-38h] BYREF
sub_1001D2EE4(a1, "dl_music_l");
if ( a3 && (*(_BYTE *)(a3 + 64) & 1) != 0 )
{
MusicDownloadManager::pathForSongFolder(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(*(const void **)(a3 + 72), 1u, *(_QWORD *)(a3 + 80) - *(_QWORD *)(a3 + 72), v6),
fclose(v6),
MusicDownloadManager::parseMusicLibrary(a1),
(v7 = *(_QWORD *)(a1 + 440)) != 0)
&& (unsigned int)cocos2d::CCDictionary::count(v7) )
{
MusicDownloadManager::downloadSFXFinished(a1, 7);
}
else
{
MusicDownloadManager::musicActionFailed(a1, 7);
}
if ( SHIBYTE(v8.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v8.__r_.__value_.__l.__data_);
}
else
{
MusicDownloadManager::musicActionFailed(a1, 7);
}
}