//
// sub_1004A16F0 from 0x1004a16f0 to 0x1004a1784 (148 bytes)
//
// 14 xrefs:
// > sub_10045007C @ 0x1004500d0
// > sub_10045ADE0 @ 0x10045aeec
// > sub_10045B1C4 @ 0x10045b340
// > sub_10045B1C4 @ 0x10045b370
// > sub_10045B938 @ 0x10045baa8
// > sub_1004661D0 @ 0x100468700
// > sub_1004661D0 @ 0x10046879c
// > sub_10046BCA0 @ 0x10046c4b0
// > sub_10046DFAC @ 0x10046ed8c
// > sub_10047CDD0 @ 0x10047dd8c
// > sub_10048319C @ 0x100484400
// > FMOD::DSP::setChannelFormat @ 0x1004859e0
// > sub_1004B7EC4 @ 0x1004b7f64
// > sub_1004BD248 @ 0x1004bd3b4
//
// 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_1004A16F0(__int64 a1, __int64 a2, unsigned int a3, int a4)
{
if ( a3 > 0x20 )
return 31;
if ( !a3 || a4 )
{
*(_DWORD *)(a1 + 196) = a4;
if ( !a3 )
{
if ( a4 )
{
LOWORD(a3) = 1;
switch ( a4 )
{
case 2:
break;
case 3:
LOWORD(a3) = 2;
break;
case 4:
LOWORD(a3) = 4;
break;
case 5:
LOWORD(a3) = 5;
break;
case 6:
LOWORD(a3) = 6;
break;
case 7:
LOWORD(a3) = 8;
break;
case 8:
LOWORD(a3) = 12;
break;
default:
if ( a4 == 1000 )
LOWORD(a3) = 2;
else
LOWORD(a3) = 0;
break;
}
}
}
}
*(_WORD *)(a1 + 272) = a3;
return 0;
}