dinput: Factor out the dinput_device_init() call into dinput7_CreateDeviceEx().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-05-16 11:50:40 +02:00 committed by Alexandre Julliard
parent 39f903481c
commit cc5178fe73
4 changed files with 7 additions and 14 deletions

View File

@ -545,6 +545,13 @@ static HRESULT WINAPI dinput7_CreateDeviceEx( IDirectInput7W *iface, const GUID
else hr = hid_joystick_create_device( impl, guid, &device );
if (FAILED(hr)) return hr;
if (FAILED(hr = dinput_device_init( device )))
{
IDirectInputDevice8_Release( device );
return hr;
}
hr = IDirectInputDevice8_QueryInterface( device, iid, out );
IDirectInputDevice8_Release( device );
return hr;

View File

@ -2138,8 +2138,6 @@ HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDi
impl->base.caps.dwFFDriverVersion = 1;
}
if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) goto failed;
*out = &impl->base.IDirectInputDevice8W_iface;
return DI_OK;

View File

@ -183,12 +183,6 @@ HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirect
impl->base.caps.dwFirmwareRevision = 100;
impl->base.caps.dwHardwareRevision = 100;
if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface )))
{
IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface );
return hr;
}
*out = &impl->base.IDirectInputDevice8W_iface;
return DI_OK;
}

View File

@ -122,12 +122,6 @@ HRESULT mouse_create_device( struct dinput *dinput, const GUID *guid, IDirectInp
if (appkey) RegCloseKey(appkey);
if (hkey) RegCloseKey(hkey);
if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface )))
{
IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface );
return hr;
}
if (dinput->dwVersion >= 0x0800)
{
impl->base.use_raw_input = TRUE;