//
// MusicDownloadManager::onDownloadSFXLibraryCompleted from 0x140342c40 to 0x140342dc3 (387 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::downloadSFXLibrary @ 0x140342b70
// > ??> @ 0x1406d5810
//
// 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
//
// Hidden C++ exception states: #wind=2
void MusicDownloadManager::onDownloadSFXLibraryCompleted(
MusicDownloadManager *a1,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
void *v5; // rcx
const char *v6; // rcx
FILE *v7; // rax
FILE *v8; // rsi
void *Block[2]; // [rsp+20h] [rbp-58h] BYREF
__int64 v10; // [rsp+30h] [rbp-48h]
unsigned __int64 v11; // [rsp+38h] [rbp-40h]
char *FileName[4]; // [rsp+40h] [rbp-38h] BYREF
Block[1] = nullptr;
v10 = 8;
v11 = 15;
Block[0] = (void *)0x6C5F7866735F6C64LL;
cocos2d::CCDictionary::removeObjectForKey(a1->m_activeDownloads, Block);
if ( v11 > 0xF )
{
v5 = Block[0];
if ( v11 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
if ( a3 && a3->_succeed )
{
MusicDownloadManager::pathForSFXFolder((__int64)a1, FileName, 0);
sub_140041270(FileName, "sfxlibrary.dat", 0xEu);
v6 = (const char *)FileName;
if ( FileName[3] > (char *)0xF )
v6 = FileName[0];
v7 = fopen(v6, "wb");
v8 = v7;
if ( v7 )
{
fwrite(
a3->_responseData._Mypair._Myval2._Myfirst,
1u,
a3->_responseData._Mypair._Myval2._Mylast - a3->_responseData._Mypair._Myval2._Myfirst,
v7);
fclose(v8);
MusicDownloadManager::parseSFXLibrary(a1);
MusicDownloadManager::musicActionFinished(a1, (GJMusicAction)1);
}
else
{
MusicDownloadManager::musicActionFailed(a1, (GJMusicAction)1);
}
sub_14003A830((__int64)FileName);
}
else
{
MusicDownloadManager::musicActionFailed(a1, (GJMusicAction)1);
}
}