//
// MusicDownloadManager::onDownloadSFXCompleted from 0x1001de8b4 to 0x1001de9dc (296 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::downloadSFX @ 0x1001de784
//
// 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 11:00:29 +0000
//
void __fastcall MusicDownloadManager::onDownloadSFXCompleted(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v5; // x8
const char *v6; // x0
__int64 v7; // x20
__int64 v8; // x0
char *CString; // x0
std::string *p_p; // x0
FILE *v11; // x22
__int64 v12; // x2
std::string __p; // [xsp+8h] [xbp-38h] BYREF
v5 = *(_QWORD *)(a3 + 56);
v6 = (const char *)(v5 + 112);
if ( *(char *)(v5 + 135) < 0 )
v6 = *(const char **)v6;
v7 = atoi(v6);
v8 = sub_1003065B0("sfx_%i", v7);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_1001D2EE4(a1, CString);
if ( (*(_BYTE *)(a3 + 64) & 1) != 0 )
{
MusicDownloadManager::pathForSFX(v7, &__p);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
v11 = fopen((const char *)p_p, "wb");
if ( v11 )
{
fwrite(*(const void **)(a3 + 72), 1u, *(_QWORD *)(a3 + 80) - *(_QWORD *)(a3 + 72), v11);
fclose(v11);
sub_1001DEA6C(a1, v7);
}
else
{
sub_1001DE9F8(a1, v7, 0);
}
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
}
else
{
if ( *(_BYTE *)(*(_QWORD *)(a3 + 56) + 196LL) )
v12 = 3;
else
v12 = 0;
sub_1001DE9F8(a1, v7, v12);
}
}