//
// sub_1005DBEE4 from 0x1005dbee4 to 0x1005dbfd4 (240 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008610f0
//
// 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_1005DBEE4(_DWORD *a1, int a2, int a3, _DWORD *a4)
{
__int64 result; // x0
int *v8; // x19
int v9; // t1
result = 1;
if ( a2 <= 103 )
{
if ( (unsigned int)(a2 - 11) < 2 )
return result;
if ( a2 == 8 )
return (int)a1[7];
if ( a2 == 9 )
{
a1[7] = a3;
return 1;
}
return 0;
}
if ( a2 == 105 )
{
if ( a1[6] )
{
if ( a4 )
{
v9 = a1[10];
v8 = a1 + 10;
*a4 = v9;
}
else
{
v8 = a1 + 10;
}
return *v8;
}
else
{
return -1;
}
}
else
{
if ( a2 != 104 )
return 0;
if ( a1 && a1[7] )
{
if ( a1[6] )
{
shutdown(a1[10], 2);
close(a1[10]);
}
a1[6] = 0;
a1[8] = 0;
}
a1[10] = *a4;
a1[6] = 1;
a1[7] = a3;
return 1;
}
}