dinput: Make newly created device append itself to Direct Input's list.
This commit is contained in:
parent
2a219b948c
commit
9441d898f7
|
@ -506,14 +506,7 @@ static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, R
|
||||||
|
|
||||||
if (!dinput_devices[i]->create_deviceA) continue;
|
if (!dinput_devices[i]->create_deviceA) continue;
|
||||||
if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
|
if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
|
||||||
{
|
|
||||||
IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8A(*pvOut);
|
|
||||||
|
|
||||||
EnterCriticalSection( &This->crit );
|
|
||||||
list_add_tail( &This->devices_list, &dev->entry );
|
|
||||||
LeaveCriticalSection( &This->crit );
|
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == DIERR_NOINTERFACE)
|
if (ret == DIERR_NOINTERFACE)
|
||||||
ret_value = DIERR_NOINTERFACE;
|
ret_value = DIERR_NOINTERFACE;
|
||||||
|
@ -544,14 +537,7 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, R
|
||||||
|
|
||||||
if (!dinput_devices[i]->create_deviceW) continue;
|
if (!dinput_devices[i]->create_deviceW) continue;
|
||||||
if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
|
if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
|
||||||
{
|
|
||||||
IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(*pvOut);
|
|
||||||
|
|
||||||
EnterCriticalSection( &This->crit );
|
|
||||||
list_add_tail( &This->devices_list, &dev->entry );
|
|
||||||
LeaveCriticalSection( &This->crit );
|
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == DIERR_NOINTERFACE)
|
if (ret == DIERR_NOINTERFACE)
|
||||||
ret_value = DIERR_NOINTERFACE;
|
ret_value = DIERR_NOINTERFACE;
|
||||||
|
|
|
@ -390,6 +390,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
|
||||||
|
|
||||||
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
||||||
|
|
||||||
|
EnterCriticalSection(&dinput->crit);
|
||||||
|
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
|
||||||
|
LeaveCriticalSection(&dinput->crit);
|
||||||
|
|
||||||
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
|
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
|
||||||
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
|
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
|
||||||
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
|
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
|
||||||
|
|
|
@ -525,6 +525,11 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||||
newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;
|
newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;
|
||||||
|
|
||||||
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
||||||
|
|
||||||
|
EnterCriticalSection(&dinput->crit);
|
||||||
|
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
|
||||||
|
LeaveCriticalSection(&dinput->crit);
|
||||||
|
|
||||||
return newDevice;
|
return newDevice;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
|
@ -821,6 +821,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
|
||||||
|
|
||||||
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
|
||||||
|
|
||||||
|
EnterCriticalSection(&dinput->crit);
|
||||||
|
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
|
||||||
|
LeaveCriticalSection(&dinput->crit);
|
||||||
|
|
||||||
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
|
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
|
||||||
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
|
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
|
||||||
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
|
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
|
||||||
|
|
|
@ -255,6 +255,11 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
|
||||||
|
|
||||||
newDevice->base.data_format.wine_df = df;
|
newDevice->base.data_format.wine_df = df;
|
||||||
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
|
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
|
||||||
|
|
||||||
|
EnterCriticalSection(&dinput->crit);
|
||||||
|
list_add_tail(&dinput->devices_list, &newDevice->base.entry);
|
||||||
|
LeaveCriticalSection(&dinput->crit);
|
||||||
|
|
||||||
return newDevice;
|
return newDevice;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
|
@ -242,6 +242,11 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
|
||||||
|
|
||||||
newDevice->base.data_format.wine_df = df;
|
newDevice->base.data_format.wine_df = df;
|
||||||
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
|
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
|
||||||
|
|
||||||
|
EnterCriticalSection(&dinput->crit);
|
||||||
|
list_add_tail(&dinput->devices_list, &newDevice->base.entry);
|
||||||
|
LeaveCriticalSection(&dinput->crit);
|
||||||
|
|
||||||
return newDevice;
|
return newDevice;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
Loading…
Reference in New Issue