// // sub_58CA8 from 0x58ca8 to 0x594cc (2084 bytes) // // 1 xrefs: // > FMOD::System::init @ 0xb8652 // // 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:40:47 +0000 // int __fastcall sub_58CA8(int a1, int a2, unsigned int a3, int a4) { int v5; // r6 int v9; // r0 int v10; // r11 int v11; // r11 int v12; // r0 int v13; // r1 int i; // r2 unsigned __int64 *v15; // r3 int v17; // r0 _DWORD *v18; // r0 int v19; // r0 int v20; // r1 unsigned int v21; // r10 int v22; // r0 int v23; // r0 int (__fastcall *v24)(int, _DWORD, unsigned int, int *, int *, int *, int *, unsigned int, int *, int *, int); // r12 int v25; // r1 int v26; // r1 int v27; // r0 int v28; // r8 int v29; // r0 int v30; // r0 int v31; // r0 int v32; // r0 int (__fastcall *v33)(int, _DWORD, unsigned int, int *, int *, int *, int *, _DWORD, int *, int *, _DWORD); // r6 int v34; // r1 int v35; // r2 int v36; // r6 int v37; // r0 int v38; // r3 int v39; // r0 int v40; // r0 int (__fastcall ***v41)(_DWORD, int, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // r0 int (__fastcall ***v42)(_DWORD, int, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // r0 int v43; // r0 int v44; // r1 int v45; // r2 int v46; // r0 int v47; // r2 int v48; // r0 int v49; // r6 int v50; // r5 int v51; // r1 int v52; // r0 int v53; // r0 int v54; // r0 int v55; // r0 int v56; // r0 int v57; // r0 int v58; // r2 _DWORD *v59; // r3 int *v60; // r5 int v61; // [sp+4h] [bp-64h] int v62; // [sp+8h] [bp-60h] int v63; // [sp+20h] [bp-48h] int v64; // [sp+24h] [bp-44h] _DWORD *v65; // [sp+28h] [bp-40h] int v66; // [sp+2Ch] [bp-3Ch] int v67; // [sp+30h] [bp-38h] int v68; // [sp+34h] [bp-34h] BYREF int v69; // [sp+38h] [bp-30h] BYREF int v70; // [sp+3Ch] [bp-2Ch] BYREF int v71; // [sp+40h] [bp-28h] BYREF int v72; // [sp+44h] [bp-24h] BYREF int v73; // [sp+48h] [bp-20h] BYREF if ( (unsigned int)a2 >> 12 ) return 31; if ( *(_BYTE *)(a1 + 4) ) return 27; v65 = (_DWORD *)(a1 + 66860); v66 = a1 + 66868; v67 = a1 + 68940; v9 = 0; while ( 1 ) { v10 = v9 + 4; if ( v9 == 96 ) break; v5 = j_FMOD_OS_CriticalSection_Create(v9 + a1 + 68544, 0); v9 = v10; if ( v5 ) return v5; } v63 = a2; v11 = *(_DWORD *)(v67 + 248); *(_DWORD *)(a1 + 60) = (a3 >> 5) & 0x10000 | a3; v64 = *(_DWORD *)(a1 + 1188); v12 = *(_DWORD *)(v66 + 1880); v13 = v12 ^ 0xCF2A112; v12 ^= 0xF30D5EED; *(_DWORD *)(v67 + 56) = v12; *(_DWORD *)(v67 + 60) = v13; *(_DWORD *)(v67 + 64) = 572572263 * v12; *(_DWORD *)(v67 + 68) = -1474208055 * v13; for ( i = 0; i != 3; ++i ) { __dmb(0xBu); v15 = (unsigned __int64 *)(a1 + 8 * i + 68648); do __ldrexd(v15); while ( __strexd(0, v15) ); __dmb(0xBu); } v5 = sub_610FC(a1, *(_DWORD *)(a1 + 1116), *(_DWORD *)(a1 + 1120)); if ( !v5 ) { if ( !sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 820, "../../src/fmod_systemi.cpp", 2880, 0) ) { *(_DWORD *)(a1 + 1172) = 0; v5 = 38; goto LABEL_15; } v17 = sub_BEE9C(); *(_DWORD *)(a1 + 1172) = v17; *(_DWORD *)(v17 + 36) = a1; *v65 = 0; v18 = (_DWORD *)((a1 + 66911) & 0xFFFFFFF0); v18[4] = 0; v18[5] = 0; v18[8] = 0; v18[9] = 0; v18[10] = 0; v18[11] = 0; *(_DWORD *)(v66 + 24) = v18; v18[8] = 1; *v18 = a1; v18[1] = 1024; v18[2] = 0; v18[3] = 1024; v19 = sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 4112, "../../src/fmod_systemi.cpp", 2895, 0); v20 = *(_DWORD *)(v66 + 24); *(_DWORD *)(v20 + 16) = v19; if ( !v19 ) goto LABEL_98; *(_DWORD *)(v20 + 20) = (v19 + 15) & 0xFFFFFFF0; v5 = sub_5C624(a1 + 1264, a1, 1024, 512, 1, 16, 1); if ( v5 ) goto LABEL_15; v5 = sub_BDA34(a1 + 67072, 0, 0x40000, 2); if ( v5 ) goto LABEL_15; v5 = sub_BDA34(a1 + 66996, 0, 4096, 2); if ( v5 ) goto LABEL_15; v5 = sub_64B58(a1); if ( v5 ) goto LABEL_15; *(_DWORD *)(a1 + 1128) = -1; *(_DWORD *)(a1 + 1132) = -1; *(_DWORD *)(a1 + 1136) = -1; *(_DWORD *)(a1 + 1140) = -1; sub_58398(a1, *(_DWORD *)(a1 + 1124), nullptr, 0, (_DWORD *)(a1 + 1128), nullptr, nullptr, nullptr); v21 = *(_DWORD *)(a1 + 1192); v22 = *(_DWORD *)(a1 + 1196) / v21; v72 = 0; v73 = v22; v23 = *(_DWORD *)(a1 + 1112); v24 = *(int (__fastcall **)(int, _DWORD, unsigned int, int *, int *, int *, int *, unsigned int, int *, int *, int))(v23 + 704); if ( !v24 ) { LABEL_55: v5 = sub_642EC(a1, *(_DWORD *)(v67 + 248), *(_DWORD *)(a1 + 1188)); if ( v5 ) goto LABEL_15; v39 = *(_DWORD *)(a1 + 1112); if ( *(_DWORD *)(v39 + 60) != *(_DWORD *)(a1 + 1184) ) { v5 = sub_61620(a1); if ( v5 ) goto LABEL_15; v39 = *(_DWORD *)(a1 + 1112); } if ( *(_DWORD *)(v39 + 692) == 1 ) { v5 = sub_61740(a1, v73, v72); if ( v5 ) goto LABEL_15; } v5 = sub_59514(a1, "FMOD master", a1 + 68868); if ( v5 ) goto LABEL_15; v5 = sub_59520(a1, "FMOD master", a1 + 68900); if ( v5 ) goto LABEL_15; v5 = (*(int (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 1172) + 4))( *(_DWORD *)(a1 + 1172), *(_DWORD *)(v66 + 1968)); if ( v5 ) goto LABEL_15; v40 = *(_DWORD *)(a1 + 1188); if ( v40 <= 2 ) v40 = 2; *(_DWORD *)(v66 + 20) = v40; *(_DWORD *)v66 = v66; *(_DWORD *)(v66 + 4) = v66; *(_DWORD *)(v66 + 8) = 0; v5 = sub_6183C(a1); if ( v5 ) goto LABEL_15; v41 = *(int (__fastcall ****)(_DWORD, int, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))(v66 + 296); if ( v41 && (**v41)( v41, a1, *(_DWORD *)(a1 + 1192), *(_DWORD *)(a1 + 1184), *(_DWORD *)(v67 + 248), *(_DWORD *)(a1 + 1188), *(_DWORD *)(*(_DWORD *)(a1 + 1112) + 44), *(_DWORD *)(*(_DWORD *)(a1 + 1112) + 48), 0) ) { v5 = (*(int (__fastcall **)(_DWORD))(**(_DWORD **)(v66 + 296) + 4))(*(_DWORD *)(v66 + 296)); if ( v5 ) goto LABEL_15; if ( !sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 124, "../../src/fmod_systemi.cpp", 3034, 0) ) { *(_DWORD *)(v66 + 296) = 0; goto LABEL_98; } v42 = (int (__fastcall ***)(_DWORD, int, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))sub_595CC(); *(_DWORD *)(v66 + 296) = v42; v5 = (**v42)( v42, a1, *(_DWORD *)(a1 + 1192), *(_DWORD *)(a1 + 1184), *(_DWORD *)(v67 + 248), *(_DWORD *)(a1 + 1188), *(_DWORD *)(*(_DWORD *)(a1 + 1112) + 44), *(_DWORD *)(*(_DWORD *)(a1 + 1112) + 48), 0); if ( v5 ) goto LABEL_15; } if ( a2 < 1 ) { if ( !a2 ) goto LABEL_81; } else { v61 = 0; v62 = 1; v43 = sub_BD410(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 820, "../../src/fmod_systemi.cpp", 3052); if ( !v43 ) { *(_DWORD *)(a1 + 1168) = 0; goto LABEL_98; } v46 = sub_BE9D0(v43, v44, v45); *(_DWORD *)(a1 + 1168) = v46; *(_DWORD *)(v46 + 36) = a1; v5 = sub_BE9F4(v46, a2, v47); if ( v5 ) goto LABEL_15; } v48 = sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 392 * a2, "../../src/fmod_systemi.cpp", 3070, 0); *(_DWORD *)(a1 + 304) = v48; if ( v48 ) { v49 = 0; v50 = 0; *(_DWORD *)(a1 + 296) = v63; while ( v50 < v63 ) { sub_4B398((_DWORD *)(*(_DWORD *)(a1 + 304) + v49)); sub_4B46C((_DWORD *)(*(_DWORD *)(a1 + 304) + v49), v50, a1); v51 = *(_DWORD *)(a1 + 984); v52 = *(_DWORD *)(a1 + 304) + v49; *(_DWORD *)(v52 + 280) = v51; *(_DWORD *)(v52 + 284) = a1 + 984; *(_DWORD *)(v51 + 4) = v52 + 280; **(_DWORD **)(v52 + 284) = v52 + 280; sub_4B4FA((float *)v52, 0, 0); v49 += 392; ++v50; v63 = *(_DWORD *)(a1 + 296); } LABEL_81: if ( !*(_BYTE *)(v67 + 2264) && !(*(unsigned __int8 *)(a1 + 60) << 31) ) { v5 = sub_BE65C(a1 + 70904, "FMOD stream thread", sub_65B64, a1, 2, 0, 10, a1, 1); if ( v5 ) goto LABEL_15; *(_BYTE *)(v67 + 2264) = 1; } if ( !*(_DWORD *)(v66 + 1812) || (v53 = sub_852D8(), (v5 = sub_61F10(a1, 2, v53, *(_DWORD *)(v66 + 1812), 2, v61, v62)) == 0) ) { if ( !*(_DWORD *)(v66 + 1808) || (v54 = sub_7B6C4(), (v5 = sub_61F10(a1, 3, v54, *(_DWORD *)(v66 + 1808), 2, v61, v62)) == 0) ) { if ( !*(_DWORD *)(v66 + 1820) || (v55 = sub_72058(), (v5 = sub_61F10(a1, 5, v55, *(_DWORD *)(v66 + 1820), 2, v61, v62)) == 0) ) { if ( !*(_DWORD *)(v66 + 1828) || (v56 = sub_66CA8(), (v5 = sub_61F10(a1, 7, v56, *(_DWORD *)(v66 + 1828), 2, v61, v62)) == 0) ) { v57 = a1 + 71760; v58 = 0; while ( v58 != 192 ) { v59 = (_DWORD *)(v57 + v58); *(v59 - 6) = 1148846080; *(v59 - 5) = 1088421888; *(v59 - 4) = 1093664768; *(v59 - 3) = 1167867904; *(v59 - 2) = 1120403456; *(v59 - 1) = 1120403456; *(_DWORD *)(v57 + v58) = 1120403456; v58 += 48; v59[1] = 1132068864; v59[2] = 0; v59[3] = 1101004800; v59[4] = 1119879168; v59[5] = -1029701632; } if ( !(*(unsigned __int8 *)(a1 + 62) << 31) || (v60 = (int *)(v67 + 3000), (v5 = sub_51FB8((int *)(v67 + 3000), 1, *(unsigned __int16 *)(v66 + 1856))) == 0) && (v5 = sub_6B990(*v60)) == 0 && (v5 = sub_5286C(*v60, a1, (int *)(a1 + 71944))) == 0 && (v5 = sub_66DF8(*v60, a1)) == 0 ) { v5 = sub_A2CD2(a1 + 71948, a1); if ( !v5 ) { *(_DWORD *)v67 = v67; *(_DWORD *)(v67 + 4) = v67; *(_DWORD *)(v67 + 8) = 0; v5 = sub_B4154(*(_DWORD *)(a1 + 1112)); if ( !v5 ) { v5 = 0; *(_BYTE *)(a1 + 4) = 1; } } } } } } } goto LABEL_15; } LABEL_98: v5 = 38; goto LABEL_15; } v71 = *(_DWORD *)(a1 + 1184); v25 = *(_DWORD *)(v67 + 248); v70 = v25; v69 = 2; if ( v25 == 1 ) { v26 = *(_DWORD *)(a1 + 1188); } else { v26 = sub_537B4(v25); v23 = *(_DWORD *)(a1 + 1112); v21 = *(_DWORD *)(a1 + 1192); v24 = *(int (__fastcall **)(int, _DWORD, unsigned int, int *, int *, int *, int *, unsigned int, int *, int *, int))(v23 + 704); } v68 = v26; if ( v23 ) v23 += 4; v5 = v24(v23, *(_DWORD *)(a1 + 1124), a3, &v71, &v70, &v68, &v69, v21, &v73, &v72, a4); if ( v5 == 52 ) { v27 = sub_B28F0(*(_DWORD *)(a1 + 1112)); if ( v27 ) { v5 = v27; LABEL_53: v28 = 0; LABEL_54: if ( !v28 ) goto LABEL_15; goto LABEL_55; } v28 = 0; v29 = sub_610FC(a1, 2, 0); if ( v29 ) { v5 = v29; goto LABEL_54; } v71 = *(_DWORD *)(a1 + 1184); v30 = *(_DWORD *)(v67 + 248); v69 = 2; v70 = v30; if ( v30 == 1 ) v31 = *(_DWORD *)(a1 + 1188); else v31 = sub_537B4(v30); v68 = v31; v32 = *(_DWORD *)(a1 + 1112); v33 = *(int (__fastcall **)(int, _DWORD, unsigned int, int *, int *, int *, int *, _DWORD, int *, int *, _DWORD))(v32 + 704); if ( v32 ) v32 += 4; v5 = v33(v32, *(_DWORD *)(a1 + 1124), a3, &v71, &v70, &v68, &v69, *(_DWORD *)(a1 + 1192), &v73, &v72, 0); } if ( v5 ) goto LABEL_53; v34 = v71; if ( (unsigned int)(v71 - 8000) <= 0x5BCC0 && (unsigned int)(v70 - 1) <= 7 ) { v35 = v69; if ( (unsigned int)(v69 - 1) <= 4 ) { v36 = v68; if ( (unsigned int)(v68 - 1) <= 0x1F ) { v28 = 1; if ( v70 == 1 ) { v37 = 1; LABEL_51: v38 = *(_DWORD *)(a1 + 1112); *(_DWORD *)(v38 + 60) = v34; *(_BYTE *)(v38 + 670) = 1; *(_DWORD *)(v38 + 40) = v35; *(_DWORD *)(v38 + 44) = v37; *(_DWORD *)(v38 + 48) = v36; v5 = 0; goto LABEL_54; } if ( v36 == sub_537B4(v70) ) { v36 = v68; v35 = v69; v37 = v70; v34 = v71; goto LABEL_51; } } } } v5 = 28; goto LABEL_53; } LABEL_15: if ( !*(_BYTE *)(a1 + 4) ) { *(_DWORD *)(v67 + 248) = v11; *(_DWORD *)(a1 + 1188) = v64; sub_57338(a1, 1); } return v5; }
GD Web Decomp Icon

GD Web Decomp

Raw Source