dinput: Call *_create_device directly in IDirectInput7WImpl_CreateDeviceEx.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8932f53947
commit
a83e6db353
|
@ -610,7 +610,6 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx( IDirectInput7W *iface,
|
||||||
{
|
{
|
||||||
IDirectInputImpl *impl = impl_from_IDirectInput7W( iface );
|
IDirectInputImpl *impl = impl_from_IDirectInput7W( iface );
|
||||||
IDirectInputDevice8W *device;
|
IDirectInputDevice8W *device;
|
||||||
unsigned int i;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE( "iface %p, guid %s, iid %s, out %p, outer %p\n", iface, debugstr_guid( guid ),
|
TRACE( "iface %p, guid %s, iid %s, out %p, outer %p\n", iface, debugstr_guid( guid ),
|
||||||
|
@ -622,20 +621,14 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx( IDirectInput7W *iface,
|
||||||
if (!guid) return E_POINTER;
|
if (!guid) return E_POINTER;
|
||||||
if (!impl->initialized) return DIERR_NOTINITIALIZED;
|
if (!impl->initialized) return DIERR_NOTINITIALIZED;
|
||||||
|
|
||||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
if (IsEqualGUID( &GUID_SysKeyboard, guid )) hr = keyboard_create_device( impl, guid, &device );
|
||||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
else if (IsEqualGUID( &GUID_SysMouse, guid )) hr = mouse_create_device( impl, guid, &device );
|
||||||
{
|
else hr = hid_joystick_create_device( impl, guid, &device );
|
||||||
if (!dinput_devices[i]->create_device) continue;
|
|
||||||
if (SUCCEEDED(hr = dinput_devices[i]->create_device( impl, guid, &device )))
|
|
||||||
{
|
|
||||||
hr = IDirectInputDevice8_QueryInterface( device, iid, out );
|
|
||||||
IDirectInputDevice8_Release( device );
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WARN( "invalid device GUID %s\n", debugstr_guid( guid ) );
|
if (FAILED(hr)) return hr;
|
||||||
return DIERR_DEVICENOTREG;
|
hr = IDirectInputDevice8_QueryInterface( device, iid, out );
|
||||||
|
IDirectInputDevice8_Release( device );
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7W iface, REFGUID rguid,
|
static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7W iface, REFGUID rguid,
|
||||||
|
|
|
@ -60,8 +60,11 @@ struct dinput_device {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
extern HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||||
|
extern HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out );
|
||||||
extern HRESULT keyboard_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 keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out );
|
||||||
extern HRESULT hid_joystick_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 );
|
||||||
|
extern HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out );
|
||||||
|
|
||||||
struct DevicePlayer {
|
struct DevicePlayer {
|
||||||
GUID instance_guid;
|
GUID instance_guid;
|
||||||
|
|
|
@ -1737,7 +1737,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap
|
||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
||||||
{
|
{
|
||||||
static const DIPROPHEADER filter =
|
static const DIPROPHEADER filter =
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,7 +174,7 @@ HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instan
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
||||||
{
|
{
|
||||||
SysKeyboardImpl *impl;
|
SysKeyboardImpl *impl;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
|
@ -104,7 +104,7 @@ HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance,
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out )
|
||||||
{
|
{
|
||||||
SysMouseImpl *impl;
|
SysMouseImpl *impl;
|
||||||
HKEY hkey, appkey;
|
HKEY hkey, appkey;
|
||||||
|
|
Loading…
Reference in New Issue