//
// MusicDownloadManager::onDownloadSFXCompleted from 0x571b5c to 0x571c34 (216 bytes)
//
// 1 xrefs:
// > ??> @ 0xac3946
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:38 +0000
//
unsigned int __fastcall MusicDownloadManager::onDownloadSFXCompleted(
MusicDownloadManager *this,
cocos2d::extension::CCHttpClient *a2,
cocos2d::extension::CCHttpResponse *a3)
{
int v5; // r0
const char *v6; // r0
const char *v7; // r4
const char *SFXDownloadKey; // r0
int v9; // r2
char *v11; // r0
FILE *v12; // r6
char v13; // [sp+0h] [bp-14h] BYREF
char v14; // [sp+1h] [bp-13h] BYREF
char *filename; // [sp+8h] [bp-Ch]
v5 = *((_DWORD *)a3 + 13);
if ( (*(_BYTE *)(v5 + 80) & 1) != 0 )
v6 = *(const char **)(v5 + 88);
else
v6 = (const char *)(v5 + 81);
v7 = (const char *)atoi(v6);
SFXDownloadKey = (const char *)MusicDownloadManager::getSFXDownloadKey(this, v7);
MusicDownloadManager::removeDLFromActive(this, SFXDownloadKey);
if ( *((_BYTE *)a3 + 56) )
{
MusicDownloadManager::pathForSFX((MusicDownloadManager *)&v13, this, (unsigned int)v7);
if ( (v13 & 1) != 0 )
v11 = filename;
else
v11 = &v14;
v12 = fopen(v11, "wb");
if ( v12 )
{
fwrite(*((const void **)a3 + 15), 1u, *((_DWORD *)a3 + 16) - *((_DWORD *)a3 + 15), v12);
fclose(v12);
MusicDownloadManager::downloadSFXFinished((cocos2d::CCArray **)this, (int)v7);
}
else
{
MusicDownloadManager::downloadSFXFailed((int)this, (int)v7, 0);
}
return std::string::~string((int)&v13);
}
else
{
if ( *(_BYTE *)(*((_DWORD *)a3 + 13) + 124) )
v9 = 3;
else
v9 = 0;
return MusicDownloadManager::downloadSFXFailed((int)this, (int)v7, v9);
}
}