//
// EditorSFXManager::deserializeAll from 0x780878 to 0x781038 (1984 bytes)
//
// 2 xrefs:
// > EditorSFXManager::ensureLoaded @ 0x781088
// > EditorSFXManager::importFromString @ 0x781346
//
// 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:59:28 +0000
//
int __fastcall EditorSFXManager::deserializeAll(EditorSFXManager *a1, unsigned __int8 *a2, int a3)
{
int v5; // r4
int v6; // r3
size_t v7; // r3
int v8; // r3
const char *v9; // r0
int v10; // r2
_BYTE *v11; // r1
char *v12; // r1
unsigned int v13; // r3
int *v14; // r0
int v15; // r3
char *v16; // r0
int v17; // r0
char *v18; // r0
signed int v19; // r9
int v20; // r3
float v22; // s16
char *v23; // r0
char *v24; // r0
int v25; // r3
char *v26; // r1
size_t v27; // r2
char *v28; // r1
size_t v29; // r2
unsigned int v30; // r2
cocos2d::CCArray **Binding; // r7
unsigned int v32; // r2
_BOOL4 v33; // r4
unsigned int i; // r10
int v35; // r0
unsigned int v36; // r0
unsigned int v37; // r4
int v38; // r5
int **v39; // r3
int *v40; // r6
size_t v41; // r8
unsigned int v42; // r0
int v43; // r1
int *v44; // r6
size_t v45; // r1
unsigned __int8 *v46; // r2
float v47; // s15
bool v48; // r5
unsigned int v49; // r5
unsigned int v50; // r1
int *v51; // r3
unsigned int v52; // r0
int v53; // r1
unsigned int v54; // r2
unsigned __int8 *v55; // r1
cocos2d::CCObject **v56; // r0
cocos2d::CCArray **v57; // r10
unsigned __int8 *v58; // r2
int *v59; // r1
unsigned __int8 *v60; // r0
int v61; // t1
cocos2d::CCObject *v62; // r1
unsigned int v63; // r0
unsigned int v64; // r4
unsigned int v65; // r8
unsigned int v66; // r9
int v67; // r5
int **v68; // r3
int *v69; // r6
size_t v70; // r7
unsigned int v71; // r0
int v72; // r1
int *v73; // r6
float v74; // s15
int v75; // r5
_BOOL4 v76; // r4
unsigned int v77; // r4
unsigned int v78; // r1
int *v79; // r3
unsigned int v80; // r0
int v81; // r1
unsigned int v82; // r2
int *v83; // r1
EditorSFXManager *v84; // r2
int *v85; // r1
unsigned __int8 *v86; // r0
int v87; // t1
int v88; // [sp+8h] [bp-C4h]
unsigned int v90; // [sp+10h] [bp-BCh]
int v91; // [sp+10h] [bp-BCh]
EditorSFXManager *v92; // [sp+14h] [bp-B8h]
int v93; // [sp+18h] [bp-B4h]
unsigned int v94; // [sp+1Ch] [bp-B0h]
int v95; // [sp+1Ch] [bp-B0h]
int v96; // [sp+20h] [bp-ACh]
int v97; // [sp+24h] [bp-A8h]
unsigned __int8 *v98; // [sp+28h] [bp-A4h]
int v99; // [sp+30h] [bp-9Ch]
int v100; // [sp+3Ch] [bp-90h] BYREF
unsigned int v101; // [sp+40h] [bp-8Ch] BYREF
unsigned int v102; // [sp+44h] [bp-88h] BYREF
_DWORD v103[2]; // [sp+48h] [bp-84h] BYREF
int v104; // [sp+50h] [bp-7Ch] BYREF
int v105; // [sp+54h] [bp-78h]
const char *v106; // [sp+58h] [bp-74h]
int v107; // [sp+5Ch] [bp-70h] BYREF
unsigned int v108; // [sp+60h] [bp-6Ch]
_BYTE *v109; // [sp+64h] [bp-68h]
int v110; // [sp+68h] [bp-64h] BYREF
int v111; // [sp+6Ch] [bp-60h]
int v112; // [sp+70h] [bp-5Ch]
int v113; // [sp+74h] [bp-58h] BYREF
size_t v114; // [sp+78h] [bp-54h]
char *v115; // [sp+7Ch] [bp-50h]
int v116; // [sp+80h] [bp-4Ch] BYREF
size_t v117; // [sp+84h] [bp-48h]
char *v118; // [sp+88h] [bp-44h]
_DWORD v119[3]; // [sp+8Ch] [bp-40h] BYREF
int v120; // [sp+98h] [bp-34h] BYREF
size_t v121; // [sp+9Ch] [bp-30h]
unsigned __int8 *v122; // [sp+A0h] [bp-2Ch]
int v123; // [sp+A4h] [bp-28h] BYREF
size_t v124; // [sp+A8h] [bp-24h]
EditorSFXManager *v125; // [sp+ACh] [bp-20h]
int v126; // [sp+B0h] [bp-1Ch] BYREF
unsigned int v127; // [sp+B4h] [bp-18h]
int *v128; // [sp+B8h] [bp-14h] BYREF
int v129; // [sp+BCh] [bp-10h]
float v130; // [sp+C0h] [bp-Ch]
v5 = *a2;
if ( (v5 & 1) != 0 )
v6 = *((_DWORD *)a2 + 1);
else
v6 = v5 >> 1;
if ( !v6 )
return 0;
v7 = std::string::find(a2, 59, 0);
if ( v7 == -1 )
std::string::basic_string(&v104, (int)a2);
else
std::string::basic_string(&v104, a2, 0, v7);
if ( (v104 & 1) == 0 )
{
v8 = (int)(unsigned __int8)v104 >> 1;
if ( v8 )
{
v9 = (char *)&v104 + 1;
goto LABEL_13;
}
LABEL_62:
v88 = v8;
goto LABEL_64;
}
v8 = v105;
if ( !v105 )
goto LABEL_62;
v9 = v106;
LABEL_13:
if ( (unsigned int)(atoi(v9) - 1) > 1 )
{
v88 = 0;
goto LABEL_64;
}
if ( a3 )
EditorSFXManager::clearAll(a1);
v103[1] = a2;
v100 = 0;
v107 = 0;
v103[0] = &v100;
v108 = 0;
v109 = nullptr;
v88 = sub_77F7F0((int)v103, (int)&v107);
if ( !v88 )
goto LABEL_61;
while ( 1 )
{
while ( 1 )
{
do
{
while ( 1 )
{
if ( !sub_77F7F0((int)v103, (int)&v107) )
goto LABEL_61;
v10 = v107 & 1;
if ( !v10 )
break;
if ( v108 )
{
v11 = v109;
goto LABEL_21;
}
}
}
while ( !((unsigned __int8)v107 >> 1) );
v11 = (char *)&v107 + 1;
LABEL_21:
if ( *v11 != 77 )
break;
if ( v10 )
{
if ( v108 == 1 )
goto LABEL_27;
v12 = v109;
}
else
{
if ( (int)(unsigned __int8)v107 >> 1 == 1 )
goto LABEL_34;
v12 = (char *)&v107 + 1;
}
if ( v12[1] != 124 )
break;
if ( !v10 )
{
LABEL_34:
v13 = (int)(unsigned __int8)v107 >> 1;
goto LABEL_28;
}
LABEL_27:
v13 = v108;
LABEL_28:
if ( v13 > 2 )
{
std::string::basic_string(&v123, (unsigned __int8 *)&v107, 2u, 0xFFFFFFFF);
MusicDownloadManager::decodeCustomSFXMappingEntries((unsigned __int8 *)&v123, (int)a1 + 60, 1);
v14 = &v123;
goto LABEL_42;
}
}
v22 = 0.0;
v110 = 0;
v19 = -1;
v111 = 0;
v112 = 0;
v101 = 0;
v113 = 0;
v114 = 0;
v115 = nullptr;
v116 = 0;
v117 = 0;
v118 = nullptr;
v93 = 0;
v96 = 0;
while ( sub_77F0C4((unsigned __int8 *)&v107, &v101, &v113, 44) )
{
if ( (v113 & 1) != 0 )
v20 = v114;
else
v20 = (int)(unsigned __int8)v113 >> 1;
if ( v20 )
{
if ( !sub_77F0C4((unsigned __int8 *)&v107, &v101, &v116, 44) )
break;
if ( (v113 & 1) != 0 )
v16 = v115;
else
v16 = (char *)&v113 + 1;
v17 = atoi(v16);
switch ( v17 )
{
case 2:
if ( (v116 & 1) != 0 )
v23 = v118;
else
v23 = (char *)&v116 + 1;
v96 = atoi(v23);
break;
case 3:
if ( (v116 & 1) != 0 )
v24 = v118;
else
v24 = (char *)&v116 + 1;
v93 = 1;
v22 = atof(v24);
break;
case 1:
if ( (v116 & 1) != 0 )
v18 = v118;
else
v18 = (char *)&v116 + 1;
v19 = atoi(v18);
break;
default:
if ( (v110 & 1) != 0 )
v25 = v111;
else
v25 = (int)(unsigned __int8)v110 >> 1;
if ( v25 )
std::string::push_back(&v110, 44);
if ( (v113 & 1) != 0 )
{
v26 = v115;
v27 = v114;
}
else
{
v27 = (int)(unsigned __int8)v113 >> 1;
v26 = (char *)&v113 + 1;
}
std::string::append(&v110, v26, v27);
std::string::push_back(&v110, 44);
if ( (v116 & 1) != 0 )
{
v28 = v118;
v29 = v117;
}
else
{
v29 = (int)(unsigned __int8)v116 >> 1;
v28 = (char *)&v116 + 1;
}
std::string::append(&v110, v28, v29);
break;
}
}
}
if ( v19 < 0 )
goto LABEL_60;
memset(v119, 0, sizeof(v119));
if ( !sub_77F7F0((int)v103, (int)v119) )
break;
if ( a3 )
Binding = nullptr;
else
Binding = (cocos2d::CCArray **)EditorSFXManager::findBinding(a1, v19, v30);
v32 = 1065353216;
v126 = 0;
v127 = 0;
v128 = nullptr;
v129 = 0;
v130 = 1.0;
if ( !Binding )
{
LABEL_93:
v33 = 1;
goto LABEL_136;
}
v32 = (unsigned int)*Binding;
if ( *Binding )
{
for ( i = 0; ; ++i )
{
if ( i >= cocos2d::CCArray::count(*Binding) )
goto LABEL_134;
v35 = cocos2d::CCArray::objectAtIndex(*Binding, i);
EditorSFXManager::encodeSound((EditorSFXManager *)&v120, a1, v35);
v36 = sub_77CCBC((unsigned __int8 *)&v120);
v37 = v127;
v90 = v36;
if ( v127 )
{
v94 = v127 - 1;
v99 = (v127 - 1) & v127;
if ( v99 )
v38 = v36 % v127;
else
v38 = v36 & v94;
v39 = *(int ***)(v126 + 4 * v38);
if ( v39 )
{
v40 = *v39;
v97 = v120 & 1;
v98 = v122;
if ( v97 )
v41 = v121;
else
v41 = (int)(unsigned __int8)v120 >> 1;
while ( v40 )
{
v42 = v40[1];
v43 = v99 ? v42 % v37 : v94 & v42;
if ( v43 != v38 )
break;
v54 = *((unsigned __int8 *)v40 + 8);
if ( (v54 & 1) != 0 )
{
if ( v40[3] == v41 )
{
v55 = v97 ? v98 : (unsigned __int8 *)&v120 + 1;
if ( !v41 || !memcmp((const void *)v40[4], v55, v41) )
goto LABEL_133;
}
}
else if ( v41 == v54 >> 1 )
{
if ( v97 )
v58 = v98;
else
v58 = (unsigned __int8 *)&v120 + 1;
v59 = v40 + 2;
v60 = &v58[v41];
while ( v58 != v60 )
{
v61 = *((unsigned __int8 *)v59 + 1);
v59 = (int *)((char *)v59 + 1);
if ( v61 != *v58 )
goto LABEL_157;
++v58;
}
goto LABEL_133;
}
LABEL_157:
v40 = (int *)*v40;
}
}
}
else
{
v38 = 0;
}
v44 = (int *)operator new(0x14u);
v45 = v121;
v46 = v122;
v44[2] = v120;
v44[3] = v45;
v44[4] = (int)v46;
v120 = 0;
v121 = 0;
v122 = nullptr;
v44[1] = v90;
*v44 = 0;
v47 = (float)(unsigned int)(v129 + 1);
if ( v47 > (float)((float)v37 * v130) )
break;
if ( !v37 )
{
v48 = 0;
LABEL_115:
v49 = 2 * v37 + !v48;
v50 = (unsigned int)ceilf(v47 / v130);
if ( v50 < v49 )
v50 = v49;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(int)&v126,
v50);
v37 = v127;
if ( ((v127 - 1) & v127) != 0 )
v38 = v90 % v127;
else
v38 = v90 & (v127 - 1);
}
v51 = *(int **)(v126 + 4 * v38);
if ( v51 )
{
*v44 = *v51;
*v51 = (int)v44;
}
else
{
*v44 = (int)v128;
v128 = v44;
*(_DWORD *)(v126 + 4 * v38) = &v128;
if ( *v44 )
{
v52 = *(_DWORD *)(*v44 + 4);
if ( ((v37 - 1) & v37) != 0 )
v53 = v52 % v37;
else
v53 = (v37 - 1) & v52;
*(_DWORD *)(v126 + 4 * v53) = v44;
}
}
++v129;
LABEL_133:
std::string::~string((int)&v120);
}
v48 = v37 > 2 && ((v37 - 1) & v37) == 0;
goto LABEL_115;
}
LABEL_134:
if ( !*Binding )
goto LABEL_93;
v33 = cocos2d::CCArray::count(*Binding) == 0;
LABEL_136:
v56 = EditorSFXManager::getOrCreateBinding(a1, v19, v32);
v57 = v56;
if ( a3 || v33 )
{
v56[1] = (cocos2d::CCObject *)v96;
std::string::operator=((unsigned __int8 *)v56 + 12, (unsigned __int8 *)&v110);
if ( v93 )
EditorSFXManager::setActionMinInterval(a1, v19, v22);
}
v102 = 0;
v123 = 0;
v124 = 0;
v125 = nullptr;
LABEL_40:
while ( sub_77F0C4((unsigned __int8 *)v119, &v102, &v123, 58) )
{
if ( (v123 & 1) != 0 )
v15 = v124;
else
v15 = (int)(unsigned __int8)v123 >> 1;
if ( v15
&& (a3
|| !std::__hash_table,std::equal_to,std::allocator>::find(
&v126,
(unsigned __int8 *)&v123)) )
{
v62 = EditorSFXManager::decodeSound((int)a1, (char *)&v123);
if ( v62 )
{
cocos2d::CCArray::addObject(*v57, v62);
if ( !a3 )
{
v63 = sub_77CCBC((unsigned __int8 *)&v123);
v64 = v127;
v65 = v63;
if ( v127 )
{
v66 = v127 - 1;
v95 = (v127 - 1) & v127;
if ( v95 )
v67 = v63 % v127;
else
v67 = v63 & v66;
v68 = *(int ***)(v126 + 4 * v67);
if ( v68 )
{
v69 = *v68;
v91 = v123 & 1;
v92 = v125;
if ( v91 )
v70 = v124;
else
v70 = (int)(unsigned __int8)v123 >> 1;
while ( v69 )
{
v71 = v69[1];
v72 = v95 ? v71 % v64 : v66 & v71;
if ( v72 != v67 )
break;
v82 = *((unsigned __int8 *)v69 + 8);
if ( (v82 & 1) != 0 )
{
if ( v69[3] == v70 )
{
v83 = v91 ? (int *)v92 : (int *)((char *)&v123 + 1);
if ( !v70 || !memcmp((const void *)v69[4], v83, v70) )
goto LABEL_40;
}
}
else if ( v70 == v82 >> 1 )
{
if ( v91 )
v84 = v92;
else
v84 = (EditorSFXManager *)((char *)&v123 + 1);
v85 = v69 + 2;
v86 = (unsigned __int8 *)v84 + v70;
while ( v84 != (EditorSFXManager *)v86 )
{
v87 = *((unsigned __int8 *)v85 + 1);
v85 = (int *)((char *)v85 + 1);
if ( v87 != *(unsigned __int8 *)v84 )
goto LABEL_213;
v84 = (EditorSFXManager *)((char *)v84 + 1);
}
goto LABEL_40;
}
LABEL_213:
v69 = (int *)*v69;
}
}
}
else
{
v67 = 0;
}
v73 = (int *)operator new(0x14u);
std::string::basic_string(v73 + 2, (int)&v123);
v73[1] = v65;
*v73 = 0;
v74 = (float)(unsigned int)(v129 + 1);
if ( v74 > (float)((float)v64 * v130) || !v64 )
{
v75 = 2 * v64;
v76 = v64 > 2 && ((v64 - 1) & v64) == 0;
v77 = !v76 + v75;
v78 = (unsigned int)ceilf(v74 / v130);
if ( v78 < v77 )
v78 = v77;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(int)&v126,
v78);
v64 = v127;
if ( ((v127 - 1) & v127) != 0 )
v67 = v65 % v127;
else
v67 = v65 & (v127 - 1);
}
v79 = *(int **)(v126 + 4 * v67);
if ( v79 )
{
*v73 = *v79;
*v79 = (int)v73;
}
else
{
*v73 = (int)v128;
v128 = v73;
*(_DWORD *)(v126 + 4 * v67) = &v128;
if ( *v73 )
{
v80 = *(_DWORD *)(*v73 + 4);
if ( ((v64 - 1) & v64) != 0 )
v81 = v80 % v64;
else
v81 = (v64 - 1) & v80;
*(_DWORD *)(v126 + 4 * v81) = v73;
}
}
++v129;
}
}
}
}
std::string::~string((int)&v123);
std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v126);
std::string::~string((int)v119);
std::string::~string((int)&v116);
std::string::~string((int)&v113);
v14 = &v110;
LABEL_42:
std::string::~string((int)v14);
}
std::string::~string((int)v119);
LABEL_60:
std::string::~string((int)&v116);
std::string::~string((int)&v113);
std::string::~string((int)&v110);
v88 = 0;
LABEL_61:
std::string::~string((int)&v107);
LABEL_64:
std::string::~string((int)&v104);
return v88;
}