dinput: Call *_enum_device directly in IDirectInputWImpl_EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c257d0ca8
commit
591be9d456
|
@ -324,7 +324,7 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices( IDirectInput7W *iface, DWOR
|
||||||
{
|
{
|
||||||
DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)};
|
DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)};
|
||||||
IDirectInputImpl *impl = impl_from_IDirectInput7W( iface );
|
IDirectInputImpl *impl = impl_from_IDirectInput7W( iface );
|
||||||
unsigned int i, j;
|
unsigned int i = 0;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE( "iface %p, type %#x, callback %p, context %p, flags %#x\n", iface, type, callback, context, flags );
|
TRACE( "iface %p, type %#x, callback %p, context %p, flags %#x\n", iface, type, callback, context, flags );
|
||||||
|
@ -339,19 +339,22 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices( IDirectInput7W *iface, DWOR
|
||||||
if (!impl->initialized)
|
if (!impl->initialized)
|
||||||
return DIERR_NOTINITIALIZED;
|
return DIERR_NOTINITIALIZED;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
hr = mouse_enum_device( type, flags, &instance, impl->dwVersion, 0 );
|
||||||
{
|
if (hr == DI_OK && enum_callback_wrapper( callback, &instance, context ) == DIENUM_STOP)
|
||||||
if (!dinput_devices[i]->enum_device) continue;
|
return DI_OK;
|
||||||
for (j = 0, hr = S_OK; SUCCEEDED(hr); j++)
|
hr = keyboard_enum_device( type, flags, &instance, impl->dwVersion, 0 );
|
||||||
{
|
if (hr == DI_OK && enum_callback_wrapper( callback, &instance, context ) == DIENUM_STOP)
|
||||||
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
|
return DI_OK;
|
||||||
hr = dinput_devices[i]->enum_device( type, flags, &instance, impl->dwVersion, j );
|
|
||||||
if (hr != S_OK) continue;
|
|
||||||
if (enum_callback_wrapper( callback, &instance, context ) == DIENUM_STOP) return S_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return S_OK;
|
do
|
||||||
|
{
|
||||||
|
hr = hid_joystick_enum_device( type, flags, &instance, impl->dwVersion, i++ );
|
||||||
|
if (hr == DI_OK && enum_callback_wrapper( callback, &instance, context ) == DIENUM_STOP)
|
||||||
|
return DI_OK;
|
||||||
|
}
|
||||||
|
while (SUCCEEDED(hr));
|
||||||
|
|
||||||
|
return DI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectInputWImpl_AddRef( IDirectInput7W *iface )
|
static ULONG WINAPI IDirectInputWImpl_AddRef( IDirectInput7W *iface )
|
||||||
|
|
|
@ -59,6 +59,10 @@ struct dinput_device {
|
||||||
HRESULT (*create_device)(IDirectInputImpl *dinput, REFGUID rguid, IDirectInputDevice8W **out);
|
HRESULT (*create_device)(IDirectInputImpl *dinput, REFGUID rguid, IDirectInputDevice8W **out);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||||
|
extern HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||||
|
extern HRESULT hid_joystick_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||||
|
|
||||||
struct DevicePlayer {
|
struct DevicePlayer {
|
||||||
GUID instance_guid;
|
GUID instance_guid;
|
||||||
WCHAR username[MAX_PATH];
|
WCHAR username[MAX_PATH];
|
||||||
|
|
|
@ -1450,8 +1450,7 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT hid_joystick_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance,
|
HRESULT hid_joystick_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index )
|
||||||
DWORD version, int index )
|
|
||||||
{
|
{
|
||||||
HIDD_ATTRIBUTES attrs = {.Size = sizeof(attrs)};
|
HIDD_ATTRIBUTES attrs = {.Size = sizeof(attrs)};
|
||||||
PHIDP_PREPARSED_DATA preparsed;
|
PHIDP_PREPARSED_DATA preparsed;
|
||||||
|
|
|
@ -144,7 +144,7 @@ static DWORD get_keyboard_subtype(void)
|
||||||
return dev_subtype;
|
return dev_subtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index )
|
HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index )
|
||||||
{
|
{
|
||||||
BYTE subtype = get_keyboard_subtype();
|
BYTE subtype = get_keyboard_subtype();
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
|
@ -75,7 +75,7 @@ static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W
|
||||||
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base);
|
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index )
|
HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index )
|
||||||
{
|
{
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue