Commit 5726c77f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Call hid_joystick_enum_device directly in EnumDevicesBySemantics.

parent a83e6db3
...@@ -762,7 +762,8 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( ...@@ -762,7 +762,8 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
DIDEVICEINSTANCEW didevi; DIDEVICEINSTANCEW didevi;
LPDIRECTINPUTDEVICE8W lpdid; LPDIRECTINPUTDEVICE8W lpdid;
DWORD callbackFlags; DWORD callbackFlags;
int i, j; unsigned int i = 0;
HRESULT hr;
int device_count = 0; int device_count = 0;
int remain; int remain;
DIDEVICEINSTANCEW *didevis = 0; DIDEVICEINSTANCEW *didevis = 0;
...@@ -772,28 +773,17 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( ...@@ -772,28 +773,17 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
didevi.dwSize = sizeof(didevi); didevi.dwSize = sizeof(didevi);
/* Enumerate all the joysticks */ do
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
{ {
HRESULT enumSuccess; hr = hid_joystick_enum_device( DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, i++ );
if (hr != DI_OK) continue;
if (!dinput_devices[i]->enum_device) continue; if (should_enumerate_device( ptszUserName, dwFlags, &This->device_players, &didevi.guidInstance ))
for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
{ {
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); device_count++;
didevis = realloc( didevis, sizeof(DIDEVICEINSTANCEW) * device_count );
/* Default behavior is to enumerate attached game controllers */ didevis[device_count - 1] = didevi;
enumSuccess = dinput_devices[i]->enum_device(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
if (enumSuccess == S_OK &&
should_enumerate_device(ptszUserName, dwFlags, &This->device_players, &didevi.guidInstance))
{
device_count++;
didevis = realloc( didevis, sizeof(DIDEVICEINSTANCEW) * device_count );
didevis[device_count-1] = didevi;
}
} }
} } while (SUCCEEDED(hr));
remain = device_count; remain = device_count;
/* Add keyboard and mouse to remaining device count */ /* Add keyboard and mouse to remaining device count */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment