//
// sub_1801089F0 from 0x1801089f0 to 0x180108cbc (716 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801b0780
// > ??> @ 0x18020164c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1801089F0(__int64 a1)
{
struct _RTL_CRITICAL_SECTION *v1; // r15
unsigned int v3; // esi
__int64 v4; // rax
__int64 v5; // rax
int v6; // r8d
__int64 i; // rdx
__int64 v8; // rcx
__int64 v9; // rbx
int v10; // edi
__int64 v11; // rbp
__int64 v12; // r14
float *v13; // rcx
unsigned int v14; // eax
__int64 v15; // rdx
int v17; // [rsp+60h] [rbp+8h] BYREF
int v18; // [rsp+68h] [rbp+10h] BYREF
v1 = lpCriticalSection;
FMOD_OS_CriticalSection_Enter(lpCriticalSection);
if ( qword_1801F24F0[*(int *)(a1 + 48)] )
{
LABEL_19:
v9 = *(_QWORD *)a1;
v10 = 0;
v11 = *(_QWORD *)(v9 + 232);
if ( *(int *)(v11 + 96) <= 0 )
{
LABEL_27:
v15 = *(_QWORD *)(v9 + 168);
*(_QWORD *)(v9 + 548) = 0;
*(_QWORD *)(v9 + 748) = 0;
*(_QWORD *)(v9 + 564) = -1;
*(_DWORD *)(v9 + 560) = -1;
*(_DWORD *)(v9 + 760) = -1;
*(_DWORD *)(v9 + 556) = 0;
*(_DWORD *)(v9 + 756) = 0;
*(_DWORD *)(v9 + 764) = 1065353216;
*(_BYTE *)(v9 + 744) = 1;
sub_1800580D0(v9 + 576, v15, 1.0);
v3 = 0;
goto LABEL_28;
}
v12 = 0;
while ( 1 )
{
v13 = *(float **)(v12 + *(_QWORD *)(v11 + 104));
if ( !*(_DWORD *)v13 )
break;
if ( *(_DWORD *)v13 == 1 )
{
v14 = sub_18009C140(v9, (unsigned int)v10, *((_DWORD *)v13 + 14));
LABEL_25:
v3 = v14;
if ( v14 )
goto LABEL_28;
}
++v10;
v12 += 8;
if ( v10 >= *(_DWORD *)(v11 + 96) )
goto LABEL_27;
}
v14 = sub_18009C0C0(v9, v10, v13[14]);
goto LABEL_25;
}
qword_1801F24F0[*(int *)(a1 + 48)] = (__int64)sub_1800B6880(
*((_QWORD *)off_1801AED20 + 52),
3584,
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_dsp_transceiver.cpp",
536,
0);
if ( !qword_1801F24F0[*(int *)(a1 + 48)] )
{
v3 = 38;
goto LABEL_28;
}
v4 = *(_QWORD *)(a1 + 40);
v18 = 0;
v3 = (*(__int64 (__fastcall **)(__int64, int *))(v4 + 32))(a1, &v18);
if ( !v3 )
{
v5 = *(_QWORD *)(a1 + 40);
v17 = 0;
v3 = (*(__int64 (__fastcall **)(__int64, int *, _QWORD))(v5 + 56))(a1, &v17, 0);
if ( !v3 )
{
if ( v17 > 1000 )
{
LABEL_16:
v6 = 0;
}
else if ( v17 == 1000 )
{
LABEL_10:
v6 = 2;
}
else
{
switch ( v17 )
{
case 2:
v6 = 1;
break;
case 3:
goto LABEL_10;
case 4:
v6 = 4;
break;
case 5:
v6 = 5;
break;
case 6:
v6 = 6;
break;
case 7:
v6 = 8;
break;
case 8:
v6 = 12;
break;
default:
goto LABEL_16;
}
}
for ( i = 0; i < 3584; i += 112 )
{
v8 = qword_1801F24F0[*(int *)(a1 + 48)];
*(_DWORD *)(i + v8 + 96) = v18;
*(_QWORD *)(i + v8) = 0;
*(_QWORD *)(i + v8 + 32) = 0;
*(_QWORD *)(i + v8 + 24) = 0;
*(_QWORD *)(i + v8 + 72) = 0;
*(_DWORD *)(i + v8 + 100) = 0;
*(_QWORD *)(i + v8 + 8) = 0;
*(_QWORD *)(i + v8 + 48) = 0;
*(_QWORD *)(i + v8 + 40) = 0;
*(_QWORD *)(i + v8 + 16) = 0;
*(_QWORD *)(i + v8 + 64) = 0;
*(_QWORD *)(i + v8 + 56) = 0;
*(_DWORD *)(i + v8 + 80) = 0;
*(_WORD *)(i + v8 + 104) = 0;
*(_DWORD *)(i + v8 + 108) = 1;
*(_DWORD *)(i + v8 + 84) = 1;
*(_DWORD *)(i + v8 + 88) = 2;
*(_DWORD *)(i + v8 + 92) = v6;
}
goto LABEL_19;
}
}
LABEL_28:
FMOD_OS_CriticalSection_Leave(v1);
return v3;
}