//
// MusicDownloadManager::onDownloadSFXCompleted from 0x96b674 to 0x96b7d8 (356 bytes)
//
// 3 xrefs:
// > ??> @ 0x74b48
// > MusicDownloadManager::downloadSFX @ 0x96905c
// > ??> @ 0x1542f18
//
// 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 12:57:38 +0000
//
__int64 __fastcall MusicDownloadManager::onDownloadSFXCompleted(
MusicDownloadManager *this,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
__int64 v5; // x1
const char *v6; // x0
unsigned int v7; // w22
const char *SFXDownloadKey; // x0
unsigned int v9; // w2
const char *v11; // x0
FILE *v12; // x23
__int64 v13[2]; // [xsp+40h] [xbp+40h] BYREF
void *v14; // [xsp+50h] [xbp+50h]
v5 = *((_QWORD *)a3 + 7);
v6 = (const char *)(v5 + 113);
if ( (*(_BYTE *)(v5 + 112) & 1) != 0 )
v6 = *(const char **)(v5 + 128);
v7 = atoi(v6);
SFXDownloadKey = (const char *)MusicDownloadManager::getSFXDownloadKey(this, (const char *)v7);
MusicDownloadManager::removeDLFromActive(this, SFXDownloadKey);
if ( *((_BYTE *)a3 + 64) )
{
MusicDownloadManager::pathForSFX(v13, this, v7);
v11 = (char *)v13 + 1;
if ( (v13[0] & 1) != 0 )
v11 = (const char *)v14;
v12 = fopen(v11, "wb");
if ( v12 )
{
fwrite(*((const void **)a3 + 9), 1u, *((_QWORD *)a3 + 10) - *((_QWORD *)a3 + 9), v12);
fclose(v12);
MusicDownloadManager::downloadSFXFinished((cocos2d::CCArray **)this, v7);
}
else
{
MusicDownloadManager::downloadSFXFailed((__int64)this, v7, 0);
}
if ( (v13[0] & 1) != 0 )
operator delete(v14);
}
else
{
if ( *(_BYTE *)(*((_QWORD *)a3 + 7) + 196LL) )
v9 = 3;
else
v9 = 0;
MusicDownloadManager::downloadSFXFailed((__int64)this, v7, v9);
}
return _stack_chk_guard;
}