//
// sub_1800DBDF0 from 0x1800dbdf0 to 0x1800dc044 (596 bytes)
//
// 4 xrefs:
// > sub_1800D9E40 @ 0x1800da2c8
// > ??> @ 0x1801432a8
// > ??> @ 0x1801432b8
// > ??> @ 0x1801bad64
//
// 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
//
void sub_1800DBDF0()
{
DWORD i; // ebx
int v1; // ecx
_DWORD *v2; // rax
char *v3; // rcx
char *v4; // rax
XINPUT_CAPABILITIES v5; // [rsp+30h] [rbp-58h] BYREF
char Buffer[40]; // [rsp+48h] [rbp-40h] BYREF
if ( qword_1801AC008 && DirectInput8Create(phModule, 0x800u, &stru_180121280, (LPVOID *)&qword_1801AC018, nullptr) < 0 )
sub_1800D3530(0x10008u, "Win32: Failed to create interface");
if ( hLibModule )
{
for ( i = 0; i < 4; ++i )
{
v1 = 0;
v2 = &unk_1801AA078;
do
{
if ( *(v2 - 63) && !*(_QWORD *)v2 && v2[2] == i )
break;
++v1;
v2 += 72;
}
while ( (__int64)v2 <= (__int64)dword_1801AB158 );
if ( v1 > 15 && !XInputGetCapabilities(i, 0, &v5) )
{
sub_180009530(Buffer, "78696e707574%02x000000000000000000", v5.SubType);
switch ( v5.SubType )
{
case 1u:
v3 = "Wireless Xbox Controller";
if ( (v5.Flags & 2) == 0 )
v3 = "Xbox Controller";
break;
case 2u:
v3 = "XInput Wheel";
break;
case 3u:
v3 = "XInput Arcade Stick";
break;
case 4u:
v3 = "XInput Flight Stick";
break;
case 5u:
v3 = "XInput Dance Pad";
break;
case 6u:
v3 = "XInput Guitar";
break;
case 8u:
v3 = "XInput Drum Kit";
break;
default:
v3 = "Unknown XInput Device";
break;
}
v4 = sub_1800D5040(v3, Buffer, 6, 10, 1);
if ( v4 )
{
*((_DWORD *)v4 + 66) = i;
sub_1800D5440((__int64)v4, 0x40001u);
}
}
}
}
if ( qword_1801AC018 )
{
if ( (*(int (__fastcall **)(__int64, __int64, __int64 (__fastcall *)()))(*(_QWORD *)qword_1801AC018 + 32LL))(
qword_1801AC018,
4,
sub_1800DC1C0) < 0 )
sub_1800D3530(0x10008u, "Failed to enumerate DirectInput8 devices");
}
}