//
// MusicDownloadManager::onDownloadSFXCompleted from 0x14048f2b0 to 0x14048f405 (341 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::downloadSFX @ 0x14048f1f1
// > ??> @ 0x140928e14
//
// 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:50 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall MusicDownloadManager::onDownloadSFXCompleted(__int64 a1, __int64 a2, __int64 a3)
{
const char *Tag; // rax
unsigned int v6; // esi
cocos2d::CCString *v7; // rax
char *CString; // rax
const char *v9; // rcx
FILE *v10; // rax
FILE *v11; // rbp
unsigned int i; // ebx
struct cocos2d::CCObject *v13; // rax
char *FileName[4]; // [rsp+20h] [rbp-48h] BYREF
Tag = cocos2d::extension::CCHttpRequest::getTag(*(cocos2d::extension::CCHttpRequest **)(a3 + 56));
v6 = atoi(Tag);
v7 = cocos2d::CCString::createWithFormat("sfx_%i", v6);
CString = (char *)cocos2d::CCString::getCString(v7);
MusicDownloadManager::removeDLFromActive(a1, CString);
if ( *(_BYTE *)(a3 + 64) )
{
MusicDownloadManager::pathForSFX(a1, FileName, v6);
v9 = (const char *)FileName;
if ( FileName[3] > (char *)0xF )
v9 = FileName[0];
v10 = fopen(v9, "wb");
v11 = v10;
if ( v10 )
{
fwrite(*(const void **)(a3 + 72), 1u, *(_QWORD *)(a3 + 80) - *(_QWORD *)(a3 + 72), v10);
fclose(v11);
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)); ++i )
{
v13 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 336), i);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v13 + 40) + 48LL))(*((_QWORD *)v13 + 40), v6);
}
}
else
{
MusicDownloadManager::downloadSFXFailed(a1, v6, 0);
}
sub_14003D310((__int64)FileName);
}
else
{
MusicDownloadManager::downloadSFXFailed(a1, v6, *(_BYTE *)(*(_QWORD *)(a3 + 56) + 204LL) != 0 ? 3 : 0);
}
}