//
// MusicDownloadManager::exportCustomSFXToFile from 0x96e938 to 0x96eb74 (572 bytes)
//
// 2 xrefs:
// > SFXBrowser::onExportFile @ 0xb8f938
// > ??> @ 0xe3d10
//
// 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:39 +0000
//
__int64 __fastcall MusicDownloadManager::exportCustomSFXToFile(MusicDownloadManager *this)
{
void *v1; // x21
unsigned int v2; // w20
const char *v4; // x0
FILE *v5; // x21
size_t v6; // x2
char *v7; // x0
__int64 v8; // [xsp+38h] [xbp+38h] BYREF
size_t v9; // [xsp+40h] [xbp+40h]
void *v10; // [xsp+48h] [xbp+48h]
_QWORD *v11; // [xsp+50h] [xbp+50h] BYREF
_QWORD v12[2]; // [xsp+58h] [xbp+58h] BYREF
_QWORD v13[2]; // [xsp+68h] [xbp+68h] BYREF
void *v14; // [xsp+78h] [xbp+78h]
__int64 v15[2]; // [xsp+80h] [xbp+80h] BYREF
void *v16; // [xsp+90h] [xbp+90h]
v12[0] = 0;
v12[1] = 0;
v11 = v12;
MusicDownloadManager::encodeCustomSFX((__int64)this, &v11, &v8);
v1 = (void *)v12[0];
if ( v12[0] )
{
std::__tree::destroy((__int64)&v11, *(_QWORD **)v12[0]);
std::__tree::destroy((__int64)&v11, *(_QWORD **)&byte_8[(_QWORD)v1]);
operator delete(v1);
}
if ( (v8 & 1) != 0 )
{
if ( !v9 )
{
v2 = 0;
goto LABEL_13;
}
}
else if ( !((int)(unsigned __int8)v8 >> 1) )
{
return 0;
}
v13[0] = 0;
v13[1] = 0;
v14 = nullptr;
v15[0] = 0;
v15[1] = 0;
v16 = nullptr;
std::string::__init(v15, "customsfx.gdsfx", 0xFu);
v2 = (unsigned __int8)GameToolbox::showSaveFileDialog(
(__int64)"Export SFX Folders",
(__int64)"GD SFX Folder Files (*.gdsfx)",
(__int64)"gdsfx",
(__int64)v15,
(unsigned __int8 *)v13);
if ( (v15[0] & 1) != 0 )
{
operator delete(v16);
if ( !v2 )
goto LABEL_7;
}
else if ( !v2 )
{
goto LABEL_7;
}
v4 = (char *)v13 + 1;
if ( (v13[0] & 1) != 0 )
v4 = (const char *)v14;
v5 = fopen(v4, "w");
if ( !v5 )
{
LABEL_7:
v2 = 0;
if ( (v13[0] & 1) == 0 )
goto LABEL_8;
goto LABEL_20;
}
if ( (v8 & 1) != 0 )
{
v7 = (char *)v10;
v6 = v9;
}
else
{
v6 = (unsigned __int8)v8 >> 1;
v7 = (char *)&v8 + 1;
}
fwrite(v7, 1u, v6, v5);
fclose(v5);
if ( (v13[0] & 1) != 0 )
LABEL_20:
operator delete(v14);
LABEL_8:
if ( (v8 & 1) != 0 )
LABEL_13:
operator delete(v10);
return v2;
}