//
// MusicDownloadManager::onDownloadSFXCompleted from 0x45960c to 0x4596bc (176 bytes)
//
// 0 xrefs:
//
// 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 MusicDownloadManager::onDownloadSFXCompleted(
MusicDownloadManager *a1,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
int v5; // r9
const char *SFXDownloadKey; // r0
GJSongError v7; // r2
FILE *v8; // r6
char *filename[3]; // [sp+0h] [bp-Ch] BYREF
filename[0] = (char *)a1;
filename[1] = (char *)a2;
filename[2] = (char *)a3;
v5 = atoi((const char *)a3->_pHttpRequest->_tag.m_data.m_data);
SFXDownloadKey = MusicDownloadManager::getSFXDownloadKey(a1, v5);
MusicDownloadManager::removeDLFromActive(a1, SFXDownloadKey);
if ( a3->_succeed )
{
MusicDownloadManager::pathForSFX((MusicDownloadManager *)filename, a1, v5);
v8 = fopen(filename[0], "wb");
if ( v8 )
{
fwrite(a3->_responseData.m_start, 1u, a3->_responseData.m_finish - a3->_responseData.m_start, v8);
fclose(v8);
MusicDownloadManager::downloadSFXFinished(a1, v5);
}
else
{
MusicDownloadManager::downloadSFXFailed(a1, v5, (GJSongError)0);
}
sub_774008(filename);
}
else
{
if ( a3->_pHttpRequest->_shouldCancel )
v7 = DownloadCancelled;
else
v7 = 0;
MusicDownloadManager::downloadSFXFailed(a1, v5, v7);
}
}