//
// MusicDownloadManager::importCustomSFXMappings from 0x576994 to 0x576cf2 (862 bytes)
//
// 1 xrefs:
// > SFXBrowser::setTextPopupClosed @ 0x6c43b8
//
// 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
//
char **__fastcall MusicDownloadManager::importCustomSFXMappings(
MusicDownloadManager *a1,
unsigned __int8 **a2,
unsigned __int8 *a3,
int *a4,
int *a5)
{
int v5; // r11
unsigned __int8 *v6; // r6
int v7; // r3
int CustomSFXObject; // r0
unsigned int v11; // r9
int v12; // r3
unsigned __int8 *v13; // r3
int v14; // r2
const void *v15; // r1
size_t v16; // r2
char *v17; // r2
_DWORD **v18; // r5
_DWORD *v19; // r4
int v20; // r12
char *v21; // r3
unsigned int v22; // r7
int v23; // r2
int v24; // r8
size_t v25; // r3
unsigned int v26; // r8
const void *v27; // r0
int v28; // r0
_DWORD *v29; // r2
int v30; // r4
unsigned int v31; // r4
_DWORD *v32; // r1
size_t v33; // r2
int v34; // r0
_DWORD *v35; // [sp+8h] [bp-B4h]
int v36; // [sp+14h] [bp-A8h]
int v37; // [sp+18h] [bp-A4h]
unsigned int v38; // [sp+1Ch] [bp-A0h]
size_t v39; // [sp+20h] [bp-9Ch]
unsigned int v43; // [sp+30h] [bp-8Ch]
const void *v44; // [sp+34h] [bp-88h]
char *v46; // [sp+48h] [bp-74h]
int v47; // [sp+4Ch] [bp-70h]
char *v48; // [sp+54h] [bp-68h] BYREF
char *v49; // [sp+58h] [bp-64h]
char *v50; // [sp+5Ch] [bp-60h]
int *v51; // [sp+60h] [bp-5Ch] BYREF
_DWORD *v52[2]; // [sp+64h] [bp-58h] BYREF
int v53; // [sp+6Ch] [bp-50h] BYREF
int v54; // [sp+70h] [bp-4Ch]
int v55; // [sp+74h] [bp-48h]
int v56; // [sp+78h] [bp-44h] BYREF
int v57; // [sp+7Ch] [bp-40h]
char *v58; // [sp+80h] [bp-3Ch]
int v59[3]; // [sp+84h] [bp-38h] BYREF
int v60[3]; // [sp+90h] [bp-2Ch] BYREF
_DWORD v61[6]; // [sp+9Ch] [bp-20h] BYREF
v5 = -2;
v48 = nullptr;
v49 = nullptr;
v50 = nullptr;
*a4 = 0;
v51 = (int *)v52;
*a5 = 0;
v6 = *a2;
v52[0] = nullptr;
v52[1] = nullptr;
while ( v6 != (unsigned __int8 *)(a2 + 1) )
{
v36 = *((_DWORD *)v6 + 4);
v37 = *((_DWORD *)v6 + 5);
if ( (unsigned int)(v36 - 2) <= 0xFFFFFD && v37 > 0 )
{
v7 = v6[24];
if ( (v7 & 1) != 0 ? *((_DWORD *)v6 + 7) : v7 >> 1 )
{
CustomSFXObject = MusicDownloadManager::getCustomSFXObject(a1, v36);
if ( CustomSFXObject && !*(_BYTE *)(CustomSFXObject + 68) && *(_DWORD *)(CustomSFXObject + 52) == v37 )
{
++*a5;
}
else
{
v53 = 0;
v54 = 0;
v55 = 0;
sub_56DAB4(v6 + 24, "/", &v53);
if ( v53 == v54 )
goto LABEL_77;
v56 = 0;
v11 = 0;
v57 = 0;
v58 = nullptr;
v35 = nullptr;
v43 = -1431655765 * ((v54 - v53) >> 2) - 1;
while ( 2 )
{
if ( v11 < v43 )
{
if ( (v56 & 1) != 0 )
v12 = v57;
else
v12 = (int)(unsigned __int8)v56 >> 1;
if ( v12 )
std::string::append(&v56, "/");
v13 = (unsigned __int8 *)(v53 + 12 * v11);
v14 = *v13;
if ( (v14 & 1) != 0 )
{
v15 = *((const void **)v13 + 2);
v16 = *((_DWORD *)v13 + 1);
}
else
{
v15 = v13 + 1;
v16 = v14 >> 1;
}
std::string::append(&v56, v15, v16);
v17 = (char *)&v56 + 1;
v18 = v52;
v19 = v52[0];
v20 = v56 & 1;
v38 = v57;
v21 = v58;
v22 = (int)(unsigned __int8)v56 >> 1;
if ( (v56 & 1) != 0 )
v17 = v58;
v44 = v17;
v23 = v57;
if ( (v56 & 1) == 0 )
v23 = (int)(unsigned __int8)v56 >> 1;
v39 = v23;
LABEL_33:
if ( !v19 )
{
if ( v18 == v52 )
goto LABEL_64;
v30 = *((unsigned __int8 *)v18 + 16);
if ( v20 )
v22 = v38;
if ( (v30 & 1) != 0 )
{
v31 = (unsigned int)v18[5];
if ( !v20 )
v21 = (char *)&v56 + 1;
v32 = v18[6];
}
else
{
v31 = v30 >> 1;
if ( !v20 )
v21 = (char *)&v56 + 1;
v32 = (_DWORD **)((char *)v18 + 17);
}
v33 = v31;
if ( v31 >= v22 )
v33 = v22;
v34 = std::char_traits::compare(v21, v32, v33);
if ( v34 )
{
if ( v34 < 0 || v18 == v52 )
goto LABEL_64;
LABEL_63:
v35 = v18[7];
}
else
{
if ( v22 >= v31 )
goto LABEL_63;
LABEL_64:
memset(v61, 0, sizeof(v61));
v61[1] = v35;
v61[0] = v5;
std::string::basic_string(v59, v53 + 12 * v11);
LevelTools::base64DecodeString(&v61[3], v59);
std::string::~string((int)v59);
if ( v49 == v50 )
{
std::vector::__push_back_slow_path(
(int *)&v48,
(int)v61);
}
else
{
if ( v49 )
CustomSFXImportEntry::CustomSFXImportEntry((int)v49, (int)v61);
v49 += 24;
}
*std::map::operator[](&v51, (unsigned __int8 *)&v56) = v5;
std::string::~string((int)&v61[3]);
v35 = (_DWORD *)v5--;
}
++v11;
continue;
}
v24 = *((unsigned __int8 *)v19 + 16);
v46 = v21;
v25 = v39;
if ( (v24 & 1) != 0 )
{
v26 = v19[5];
v27 = (const void *)v19[6];
}
else
{
v26 = v24 >> 1;
v27 = (char *)v19 + 17;
}
v47 = v20;
if ( v39 >= v26 )
v25 = v26;
v28 = std::char_traits::compare(v27, v44, v25);
v21 = v46;
v20 = v47;
if ( v28 )
{
if ( v28 >= 0 )
goto LABEL_43;
}
else if ( v26 >= v39 )
{
LABEL_43:
v29 = (_DWORD *)*v19;
LABEL_45:
v18 = (_DWORD **)v19;
v19 = v29;
goto LABEL_33;
}
v29 = (_DWORD *)v19[1];
v19 = v18;
goto LABEL_45;
}
break;
}
v61[0] = v36;
v61[1] = v35;
v61[2] = v37;
std::string::basic_string(v60, v54 - 12);
LevelTools::base64DecodeString(&v61[3], v60);
std::string::~string((int)v60);
if ( v49 == v50 )
{
std::vector::__push_back_slow_path((int *)&v48, (int)v61);
}
else
{
if ( v49 )
CustomSFXImportEntry::CustomSFXImportEntry((int)v49, (int)v61);
v49 += 24;
}
std::string::~string((int)&v61[3]);
std::string::~string((int)&v56);
LABEL_77:
std::__vector_base::~__vector_base((int)&v53);
}
}
}
v6 = (unsigned __int8 *)std::__tree_next *>(v6);
}
if ( v48 != v49 )
sub_575E04((cocos2d::CCDictionary **)a1, (int *)&v48, a3, a4, a5);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
(int)&v51,
v52[0]);
return std::__vector_base::~__vector_base((void **)&v48);
}