//
// MusicDownloadManager::parseSFXLibrary from 0x571c90 to 0x57232e (1694 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::onDownloadSFXLibraryCompleted @ 0x5723be
// > MusicDownloadManager::tryLoadLibraries @ 0x5795e8
// > sub_6C6B24 @ 0x6c811c
//
// 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:38 +0000
//
int __fastcall MusicDownloadManager::parseSFXLibrary(cocos2d::CCArray **this)
{
cocos2d::CCFileUtils *v2; // r0
int v3; // r0
char *v4; // r1
unsigned __int8 *v5; // r0
int v6; // r0
int v7; // r1
_BYTE *v8; // r2
int v10; // r3
cocos2d::CCObject *v11; // r0
cocos2d::CCObject *v12; // r0
cocos2d::CCArray *v13; // r0
cocos2d::CCObject *v14; // r0
unsigned int i; // r5
int v16; // r6
int v17; // r6
const char *v18; // r0
int v19; // r0
const char *v20; // r6
int v21; // r7
size_t v22; // r0
int v23; // r6
const char *v24; // r0
int v25; // r8
const char *v26; // r0
int v27; // r9
const char *v28; // r0
const char *v29; // r0
char *v30; // r0
SFXInfoObject *v31; // r0
SFXInfoObject *v32; // r0
unsigned int j; // r7
int v34; // r5
cocos2d::CCArray *v35; // r9
int *v36; // r0
cocos2d::CCObject *v37; // r0
cocos2d::CCObject *v38; // r0
int v39; // r3
int v41; // r3
unsigned __int8 *v43; // r0
int v44; // r3
int v45; // r3
int v46; // r7
const char *v47; // r0
SFXChangelogEntry *v48; // r5
const char *v49; // r0
int v50; // r6
const char *v51; // r0
int v52; // r0
int v53; // r3
cocos2d::CCObject *v54; // r7
int v55; // r3
unsigned __int8 *v57; // r0
int v58; // r3
int v59; // r3
unsigned int m; // r6
int *v61; // r0
int v62; // [sp+10h] [bp-11Ch]
unsigned int k; // [sp+10h] [bp-11Ch]
int v64; // [sp+18h] [bp-114h]
cocos2d::CCArray *v65; // [sp+20h] [bp-10Ch]
int v66; // [sp+3Ch] [bp-F0h] BYREF
_DWORD v67[3]; // [sp+40h] [bp-ECh] BYREF
int v68; // [sp+4Ch] [bp-E0h] BYREF
int v69; // [sp+50h] [bp-DCh]
_BYTE *v70; // [sp+54h] [bp-D8h]
int v71; // [sp+58h] [bp-D4h] BYREF
int v72; // [sp+5Ch] [bp-D0h]
_BYTE *v73; // [sp+60h] [bp-CCh]
int v74; // [sp+64h] [bp-C8h] BYREF
int v75; // [sp+68h] [bp-C4h]
int v76; // [sp+6Ch] [bp-C0h]
int v77; // [sp+70h] [bp-BCh] BYREF
int v78; // [sp+74h] [bp-B8h]
int v79; // [sp+78h] [bp-B4h]
int v80; // [sp+7Ch] [bp-B0h] BYREF
int v81; // [sp+80h] [bp-ACh]
int v82; // [sp+84h] [bp-A8h]
int v83[3]; // [sp+88h] [bp-A4h] BYREF
int v84[3]; // [sp+94h] [bp-98h] BYREF
int v85; // [sp+A0h] [bp-8Ch] BYREF
int v86; // [sp+A4h] [bp-88h]
int v87; // [sp+A8h] [bp-84h]
int v88[3]; // [sp+ACh] [bp-80h] BYREF
int v89[3]; // [sp+B8h] [bp-74h] BYREF
int v90[3]; // [sp+C4h] [bp-68h] BYREF
int v91; // [sp+D0h] [bp-5Ch] BYREF
int v92; // [sp+D4h] [bp-58h]
int v93; // [sp+D8h] [bp-54h]
int v94; // [sp+DCh] [bp-50h] BYREF
int v95; // [sp+E0h] [bp-4Ch]
int v96; // [sp+E4h] [bp-48h]
int v97; // [sp+E8h] [bp-44h] BYREF
int v98; // [sp+ECh] [bp-40h]
int v99; // [sp+F0h] [bp-3Ch]
int v100; // [sp+F4h] [bp-38h] BYREF
int v101; // [sp+F8h] [bp-34h]
int v102; // [sp+FCh] [bp-30h]
int v103; // [sp+100h] [bp-2Ch] BYREF
int v104; // [sp+104h] [bp-28h]
int v105; // [sp+108h] [bp-24h]
int v106[3]; // [sp+10Ch] [bp-20h] BYREF
int v107[2]; // [sp+118h] [bp-14h] BYREF
char *v108; // [sp+120h] [bp-Ch]
MusicDownloadManager::pathForSFXFolder((MusicDownloadManager *)v67, (MusicDownloadManager *)this, 0);
v2 = (cocos2d::CCFileUtils *)std::string::append(v67, "sfxlibrary.dat");
v66 = 0;
v3 = cocos2d::CCFileUtils::sharedFileUtils(v2);
if ( (v67[0] & 1) != 0 )
v4 = (char *)v67[2];
else
v4 = (char *)v67 + 1;
v5 = (unsigned __int8 *)(*(int (__fastcall **)(int, char *, __int16 *, int *))(*(_DWORD *)v3 + 16))(
v3,
v4,
&a1i2r3e45s789g[3],
&v66);
v68 = 0;
v69 = 0;
v70 = nullptr;
if ( v5 )
{
cocos2d::ZipUtils::decompressString2((cocos2d::ZipUtils *)&v71, v5, 0, v66, 11);
if ( (v68 & 1) != 0 )
{
*v70 = 0;
v69 = 0;
}
else
{
LOWORD(v68) = 0;
}
std::string::reserve(&v68, 0);
v6 = v71;
v7 = v72;
v8 = v73;
v71 = 0;
v72 = 0;
v73 = nullptr;
v68 = v6;
v69 = v7;
v70 = v8;
std::string::~string((int)&v71);
if ( (v68 & 1) != 0 ? v69 : (int)(unsigned __int8)v68 >> 1 )
{
v74 = 0;
v75 = 0;
v76 = 0;
sub_56DAB4((unsigned __int8 *)&v68, "|", &v74);
if ( (unsigned int)(-1431655765 * ((v75 - v74) >> 2)) > 1 )
{
v77 = 0;
v78 = 0;
v79 = 0;
sub_56DAB4((unsigned __int8 *)v74, ";", &v77);
v10 = v74;
if ( (*(_BYTE *)v74 & 1) != 0 )
{
**(_BYTE **)&byte_8[v74] = 0;
*(_DWORD *)&byte_4[v10] = 0;
}
else
{
*((_BYTE *)&dword_0 + v74 + 1) = 0;
*(_BYTE *)v10 = 0;
}
v80 = 0;
v81 = 0;
v82 = 0;
if ( -1431655765 * ((v78 - v77) >> 2) )
{
v11 = *(this + 77);
if ( v11 )
{
cocos2d::CCObject::release(v11);
v11 = *(this + 78);
if ( v11 )
v11 = (cocos2d::CCObject *)cocos2d::CCObject::release(v11);
}
v12 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v11);
*(this + 77) = v12;
v13 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v12);
v14 = (cocos2d::CCObject *)cocos2d::CCArray::create(v13);
*(this + 78) = v14;
cocos2d::CCObject::retain(v14);
*(this + 81) = nullptr;
}
for ( i = 0; i < -1431655765 * ((v78 - v77) >> 2); ++i )
{
v16 = v80;
while ( v16 != v81 )
{
v81 -= 12;
std::string::~string(v81);
}
sub_56DAB4((unsigned __int8 *)(v77 + 12 * i), ",", &v80);
v17 = v80;
if ( (unsigned int)(-1431655765 * ((v81 - v80) >> 2)) > 5 )
{
if ( (*(_BYTE *)v80 & 1) != 0 )
v18 = *(const char **)(v80 + 8);
else
v18 = (const char *)(v80 + 1);
v19 = atoi(v18);
if ( (*(_BYTE *)(v17 + 12) & 1) != 0 )
v20 = *(const char **)(v17 + 20);
else
v20 = (const char *)(v17 + 13);
v107[0] = 0;
v107[1] = 0;
v108 = nullptr;
v21 = v19;
v22 = strlen(v20);
std::string::__init(v107, v20, v22);
v23 = v80;
if ( (*(_BYTE *)(v80 + 24) & 1) != 0 )
v24 = *(const char **)(v80 + 32);
else
v24 = (const char *)(v80 + 25);
v25 = atoi(v24);
if ( (*(_BYTE *)(v23 + 36) & 1) != 0 )
v26 = *(const char **)(v23 + 44);
else
v26 = (const char *)(v23 + 37);
v27 = atoi(v26);
if ( (*(_BYTE *)(v23 + 48) & 1) != 0 )
v28 = *(const char **)(v23 + 56);
else
v28 = (const char *)(v23 + 49);
v62 = atoi(v28);
if ( (*(_BYTE *)(v23 + 60) & 1) != 0 )
v29 = *(const char **)(v23 + 68);
else
v29 = (const char *)(v23 + 61);
v64 = atoi(v29);
if ( v21 == 1 )
{
if ( (v107[0] & 1) != 0 )
v30 = v108;
else
v30 = (char *)v107 + 1;
*(this + 80) = (cocos2d::CCArray *)atoi(v30);
std::string::assign(v107, "Root");
}
if ( v25 )
{
std::string::basic_string(v84, (int)v107);
v32 = SFXFolderObject::create(v21, (int)v84, v27);
MusicDownloadManager::storeSFXInfoObject(this, v32);
std::string::~string((int)v84);
}
else
{
std::string::basic_string(v83, (int)v107);
v31 = SFXInfoObject::create(v21, (int)v83, v27, v62, v64);
MusicDownloadManager::storeSFXInfoObject(this, v31);
std::string::~string((int)v83);
*(this + 81) = (cocos2d::CCArray *)((char *)*(this + 81) + 1);
}
std::string::~string((int)v107);
}
}
v85 = 0;
v86 = 0;
v87 = 0;
sub_56DAB4((unsigned __int8 *)(v74 + 12), ";", &v85);
for ( j = 0; j < -1431655765 * ((v86 - v85) >> 2); ++j )
{
v34 = v80;
while ( v34 != v81 )
{
v81 -= 12;
std::string::~string(v81);
}
sub_56DAB4((unsigned __int8 *)(v85 + 12 * j), ",", &v80);
if ( (unsigned int)(-1431655765 * ((v81 - v80) >> 2)) > 1 )
{
v35 = *(this + 78);
std::string::basic_string(v88, v80);
std::string::basic_string(v89, v80 + 12);
v36 = CCURLObject::create((int)v88, (int)v89);
cocos2d::CCArray::addObject(v35, (cocos2d::CCObject *)v36);
std::string::~string((int)v89);
std::string::~string((int)v88);
}
}
v37 = *(this + 79);
if ( v37 )
v37 = (cocos2d::CCObject *)cocos2d::CCObject::release(v37);
v38 = (cocos2d::CCObject *)cocos2d::CCArray::create(v37);
*(this + 79) = v38;
cocos2d::CCObject::retain(v38);
if ( (unsigned int)(-1431655765 * ((v75 - v74) >> 2)) > 2 )
{
v39 = *((unsigned __int8 *)&dword_18 + v74);
if ( (v39 & 1) != 0 ? *(int *)((char *)&dword_1C + v74) : v39 >> 1 )
{
std::string::basic_string(v90, v74 + 24);
LevelTools::base64DecodeString(v89, v90);
std::string::~string((int)v90);
if ( (v89[0] & 1) != 0 )
v41 = v89[1];
else
v41 = (int)LOBYTE(v89[0]) >> 1;
if ( v41 )
{
v91 = 0;
v92 = 0;
v93 = 0;
sub_56DAB4((unsigned __int8 *)v89, "$", &v91);
for ( k = 0; k < -1431655765 * ((v92 - v91) >> 2); ++k )
{
v43 = (unsigned __int8 *)(v91 + 12 * k);
v44 = *v43;
if ( (v44 & 1) != 0 )
v45 = *((_DWORD *)v43 + 1);
else
v45 = v44 >> 1;
if ( v45 )
{
v94 = 0;
v95 = 0;
v96 = 0;
sub_56DAB4(v43, ":", &v94);
if ( v94 != v95 )
{
v97 = 0;
v98 = 0;
v99 = 0;
sub_56DAB4((unsigned __int8 *)v94, ",", &v97);
v46 = v97;
if ( (unsigned int)(-1431655765 * ((v98 - v97) >> 2)) <= 2 )
{
std::__vector_base::~__vector_base((int)&v97);
}
else
{
if ( (*(_BYTE *)v97 & 1) != 0 )
v47 = *(const char **)&byte_8[v97];
else
v47 = (const char *)(v97 + 1);
v48 = (SFXChangelogEntry *)atoi(v47);
if ( (byte_9[v46 + 3] & 1) != 0 )
v49 = *(const char **)((char *)&dword_14 + v46);
else
v49 = (const char *)(v46 + 13);
v50 = atoi(v49);
if ( (*((_BYTE *)&dword_18 + v46) & 1) != 0 )
v51 = *(const char **)((char *)&dword_20 + v46);
else
v51 = (const char *)(v46 + 25);
v52 = atoi(v51);
v54 = SFXChangelogEntry::create(v48, v50, v52, v53);
if ( (unsigned int)(-1431655765 * ((v95 - v94) >> 2)) > 1 )
{
v55 = (unsigned __int8)byte_9[v94 + 3];
if ( (v55 & 1) != 0 ? *(_DWORD *)((char *)&word_10 + v94) : v55 >> 1 )
{
v100 = 0;
v101 = 0;
v102 = 0;
sub_56DAB4((unsigned __int8 *)(v94 + 12), ";", &v100);
for ( m = 0; m < -1431655765 * ((v101 - v100) >> 2); ++m )
{
v57 = (unsigned __int8 *)(v100 + 12 * m);
v58 = *v57;
if ( (v58 & 1) != 0 )
v59 = *((_DWORD *)v57 + 1);
else
v59 = v58 >> 1;
if ( v59 )
{
v103 = 0;
v104 = 0;
v105 = 0;
sub_56DAB4(v57, "~", &v103);
if ( (unsigned int)(-1431655765 * ((v104 - v103) >> 2)) > 1 )
{
v65 = *((cocos2d::CCArray **)v54 + 16);
std::string::basic_string(v106, v103);
std::string::basic_string(v107, v103 + 12);
v61 = CCURLObject::create((int)v106, (int)v107);
cocos2d::CCArray::addObject(v65, (cocos2d::CCObject *)v61);
std::string::~string((int)v107);
std::string::~string((int)v106);
}
std::__vector_base::~__vector_base((int)&v103);
}
}
std::__vector_base::~__vector_base((int)&v100);
}
}
cocos2d::CCArray::addObject(*(this + 79), v54);
std::__vector_base::~__vector_base((int)&v97);
}
}
std::__vector_base::~__vector_base((int)&v94);
}
}
std::__vector_base::~__vector_base((int)&v91);
}
std::string::~string((int)v89);
}
}
MusicDownloadManager::syncCustomSFXPlacements((cocos2d::CCDictionary *)this);
std::__vector_base::~__vector_base((int)&v85);
std::__vector_base::~__vector_base((int)&v80);
std::__vector_base::~__vector_base((int)&v77);
}
std::__vector_base::~__vector_base((int)&v74);
}
}
std::string::~string((int)&v68);
return std::string::~string((int)v67);
}