//
// MusicDownloadManager::onDownloadMusicLibraryCompleted from 0x14048cd40 to 0x14048cefb (443 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::downloadMusicLibrary @ 0x14048cc4f
// > ??> @ 0x140928dd8
//
// This function is hookable on this platform (idp: pc, 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:32:49 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall MusicDownloadManager::onDownloadMusicLibraryCompleted(__int64 a1, __int64 a2, __int64 a3)
{
void *v5; // rcx
const char *v6; // rcx
FILE *v7; // rax
FILE *v8; // rsi
cocos2d::CCDictionary *v9; // rcx
void *Block[2]; // [rsp+30h] [rbp-58h] BYREF
__m128i si128; // [rsp+40h] [rbp-48h]
char *FileName[4]; // [rsp+50h] [rbp-38h] BYREF
Block[1] = (void *)27743;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
Block[0] = (void *)0x636973756D5F6C64LL;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 328), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v5 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v5);
}
if ( a3 && *(_BYTE *)(a3 + 64) )
{
MusicDownloadManager::pathForSongFolder(a1, FileName, 0);
sub_140044D80(FileName, "musiclibrary.dat", 0x10u);
v6 = (const char *)FileName;
if ( FileName[3] > (char *)0xF )
v6 = FileName[0];
v7 = fopen(v6, "wb");
v8 = v7;
if ( v7
&& (fwrite(*(const void **)(a3 + 72), 1u, *(_QWORD *)(a3 + 80) - *(_QWORD *)(a3 + 72), v7),
fclose(v8),
MusicDownloadManager::parseMusicLibrary(a1),
(v9 = *(cocos2d::CCDictionary **)(a1 + 448)) != nullptr)
&& cocos2d::CCDictionary::count(v9) )
{
MusicDownloadManager::musicActionFinished(a1, 7);
}
else
{
MusicDownloadManager::musicActionFailed(a1, 7);
}
sub_14003D310((__int64)FileName);
}
else
{
MusicDownloadManager::musicActionFailed(a1, 7);
}
}