//
// MusicDownloadManager::importCustomSFXSetup from 0x576138 to 0x576540 (1032 bytes)
//
// 4 xrefs:
// > MusicDownloadManager::importCustomSFXFromFile @ 0x57674c
// > MusicDownloadManager::decodeCustomSFX @ 0x576914
// > SFXBrowser::setTextPopupClosed @ 0x6c439c
// > SFXBrowser::FLAlert_Clicked @ 0x6c4a8e
//
// 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:42 +0000
//
cocos2d::CCDictionary **__fastcall MusicDownloadManager::importCustomSFXSetup(
cocos2d::CCDictionary **result,
unsigned __int8 *a2,
int a3,
int a4,
int *a5,
int *a6)
{
cocos2d::CCDictionary **v6; // r8
int v7; // r9
int v8; // r2
int v9; // r5
const char *v10; // r0
int v11; // r7
int v12; // r5
char *v13; // r10
const char *v14; // r0
const char *v15; // r0
int v16; // r3
int v17; // r6
int v18; // r7
char *v19; // r9
const char *v20; // r0
const char *v21; // r0
const char *v22; // r0
int CustomSFXRoot; // r0
int v24; // r3
int v25; // r5
int v26; // r4
_DWORD *v27; // r2
int *v28; // r5
int *v29; // r4
int v30; // r1
int v31; // t1
int v32; // [sp+18h] [bp-7Ch]
int v33; // [sp+18h] [bp-7Ch]
int v36; // [sp+2Ch] [bp-68h] BYREF
int v37; // [sp+30h] [bp-64h]
int v38; // [sp+34h] [bp-60h]
char *v39; // [sp+38h] [bp-5Ch] BYREF
char *v40; // [sp+3Ch] [bp-58h]
char *v41; // [sp+40h] [bp-54h]
int v42; // [sp+44h] [bp-50h] BYREF
int v43; // [sp+48h] [bp-4Ch]
int v44; // [sp+4Ch] [bp-48h]
int v45[3]; // [sp+50h] [bp-44h] BYREF
int v46[3]; // [sp+5Ch] [bp-38h] BYREF
char *v47; // [sp+68h] [bp-2Ch] BYREF
char *v48; // [sp+6Ch] [bp-28h]
char *v49; // [sp+70h] [bp-24h]
int v50[6]; // [sp+74h] [bp-20h] BYREF
v6 = result;
*a5 = 0;
*a6 = 0;
v7 = *a2;
if ( (v7 & 1) != 0 )
v8 = *((_DWORD *)a2 + 1);
else
v8 = v7 >> 1;
if ( v8 )
{
v36 = 0;
v37 = 0;
v38 = 0;
sub_56DAB4(a2, "|", &v36);
v9 = v36;
if ( (unsigned int)(-1431655765 * ((v37 - v36) >> 2)) > 2 )
{
v10 = (*(_BYTE *)v36 & 1) != 0 ? *(const char **)&byte_8[v36] : (const char *)(v36 + 1);
if ( atoi(v10) <= 1 )
{
v39 = nullptr;
v40 = nullptr;
v41 = nullptr;
v42 = 0;
v43 = 0;
v44 = 0;
sub_56DAB4((unsigned __int8 *)(v9 + 24), ";", &v42);
v11 = 0;
v12 = -2;
v32 = -1431655765 * ((v43 - v42) >> 2);
while ( v11 != v32 )
{
v47 = nullptr;
v48 = nullptr;
v49 = nullptr;
sub_56DAB4((unsigned __int8 *)(v42 + 12 * v11), ",", (int *)&v47);
v13 = v47;
if ( (unsigned int)(-1431655765 * ((v48 - v47) >> 2)) > 2 )
{
memset(v50, 0, sizeof(v50));
if ( (*v47 & 1) != 0 )
v14 = *((const char **)v47 + 2);
else
v14 = v47 + 1;
v50[0] = atoi(v14);
if ( (v13[12] & 1) != 0 )
v15 = *((const char **)v13 + 5);
else
v15 = v13 + 13;
v50[1] = atoi(v15);
std::string::basic_string(v45, (int)(v13 + 24));
LevelTools::base64DecodeString(&v50[3], v45);
std::string::~string((int)v45);
if ( (v50[3] & 1) != 0 )
v16 = v50[4];
else
v16 = (int)LOBYTE(v50[3]) >> 1;
if ( v16 )
{
if ( (unsigned int)(v50[0] - 2) > 0xFFFFFD )
v50[0] = v12--;
if ( v40 == v41 )
{
std::vector::__push_back_slow_path(
(int *)&v39,
(int)v50);
}
else
{
if ( v40 )
CustomSFXImportEntry::CustomSFXImportEntry((int)v40, (int)v50);
v40 += 24;
}
}
std::string::~string((int)&v50[3]);
}
++v11;
std::__vector_base::~__vector_base((int)&v47);
}
v17 = v42;
while ( v17 != v43 )
{
v43 -= 12;
std::string::~string(v43);
}
if ( (unsigned int)(-1431655765 * ((v37 - v36) >> 2)) > 3 )
sub_56DAB4((unsigned __int8 *)(v36 + 36), ";", &v42);
v18 = 0;
v33 = -1431655765 * ((v43 - v42) >> 2);
while ( v18 != v33 )
{
v47 = nullptr;
v48 = nullptr;
v49 = nullptr;
sub_56DAB4((unsigned __int8 *)(v42 + 12 * v18), ",", (int *)&v47);
v19 = v47;
if ( (unsigned int)(-1431655765 * ((v48 - v47) >> 2)) > 3 )
{
if ( (*v47 & 1) != 0 )
v20 = *((const char **)v47 + 2);
else
v20 = v47 + 1;
v50[0] = atoi(v20);
if ( (v19[12] & 1) != 0 )
v21 = *((const char **)v19 + 5);
else
v21 = v19 + 13;
v50[1] = atoi(v21);
if ( (v19[24] & 1) != 0 )
v22 = *((const char **)v19 + 8);
else
v22 = v19 + 25;
v50[2] = atoi(v22);
std::string::basic_string(v46, (int)(v19 + 36));
LevelTools::base64DecodeString(&v50[3], v46);
std::string::~string((int)v46);
if ( v50[2] > 0 )
{
if ( (unsigned int)(v50[0] - 2) > 0xFFFFFD )
v50[0] = v12--;
if ( v40 == v41 )
{
std::vector::__push_back_slow_path(
(int *)&v39,
(int)v50);
}
else
{
if ( v40 )
CustomSFXImportEntry::CustomSFXImportEntry((int)v40, (int)v50);
v40 += 24;
}
}
std::string::~string((int)&v50[3]);
}
++v18;
std::__vector_base::~__vector_base((int)&v47);
}
if ( v39 == v40 )
{
std::__vector_base::~__vector_base((int)&v42);
}
else
{
if ( a4 )
{
CustomSFXRoot = MusicDownloadManager::getCustomSFXRoot(v6);
v47 = nullptr;
v48 = nullptr;
v49 = nullptr;
v24 = *(_DWORD *)(CustomSFXRoot + 112);
if ( v24 )
{
v27 = *(_DWORD **)(v24 + 52);
if ( *v27 )
{
v28 = (int *)v27[3];
v29 = &v28[*v27 - 1];
while ( v28 <= v29 )
{
v31 = *v28++;
v30 = v31;
if ( !v31 )
break;
if ( v48 == v49 )
{
std::vector::__push_back_slow_path((int)&v47, (_DWORD *)(v30 + 72));
}
else
{
if ( v48 )
*(_DWORD *)v48 = *(_DWORD *)(v30 + 72);
v48 += 4;
}
}
}
}
v25 = 0;
v26 = (v48 - v47) >> 2;
while ( v25 != v26 )
MusicDownloadManager::deleteCustomSFXObject((int *)v6, *(_DWORD *)&v47[4 * v25++]);
std::__vector_base::~__vector_base(&v47);
memset(v50, 0, 12);
std::string::__init(v50, &unk_B6B226, 0);
}
else
{
std::string::basic_string(v50, a3);
}
sub_575E04(v6, (int *)&v39, (unsigned __int8 *)v50, a5, a6);
std::string::~string((int)v50);
std::__vector_base::~__vector_base((int)&v42);
}
std::__vector_base::~__vector_base((void **)&v39);
}
}
return (cocos2d::CCDictionary **)std::__vector_base::~__vector_base((int)&v36);
}
return result;
}