Module: wine Branch: master Commit: 6b44c4f5cc501c7603bf98483dccb1a75f75ebe0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b44c4f5cc501c7603bf98483d...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Sat Aug 20 22:55:34 2016 -0300
dinput: Get the controller type from the device instance for Linux drivers.
Signed-off-by: Bruno Jesus 00cpxxx@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput/joystick_linux.c | 10 ++++++---- dlls/dinput/joystick_linuxinput.c | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index c0a885d..3086e68 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -406,6 +406,7 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, HRESULT hr; LPDIDATAFORMAT df = NULL; int idx = 0; + DIDEVICEINSTANCEW ddi;
TRACE("%s %p %p %hu\n", debugstr_guid(rguid), dinput, pdev, index);
@@ -496,10 +497,11 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps); newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED; - if (newDevice->generic.base.dinput->dwVersion >= 0x0800) - newDevice->generic.devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - newDevice->generic.devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + + ddi.dwSize = sizeof(ddi); + fill_joystick_dideviceinstanceW(&ddi, newDevice->generic.base.dinput->dwVersion, index); + newDevice->generic.devcaps.dwDevType = ddi.dwDevType; + newDevice->generic.devcaps.dwFFSamplePeriod = 0; newDevice->generic.devcaps.dwFFMinTimeResolution = 0; newDevice->generic.devcaps.dwFirmwareRevision = 0; diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index ecd239c..911700b 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -452,6 +452,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig LPDIDATAFORMAT df = NULL; int i, idx = 0; int default_axis_map[WINE_JOYSTICK_MAX_AXES + WINE_JOYSTICK_MAX_POVS*2]; + DIDEVICEINSTANCEW ddi;
newDevice = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(JoystickImpl)); if (!newDevice) return NULL; @@ -571,10 +572,10 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig /* Fill the caps */ newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps); newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED; - if (newDevice->generic.base.dinput->dwVersion >= 0x0800) - newDevice->generic.devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - newDevice->generic.devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + + ddi.dwSize = sizeof(ddi); + fill_joystick_dideviceinstanceW(&ddi, newDevice->generic.base.dinput->dwVersion, index); + newDevice->generic.devcaps.dwDevType = ddi.dwDevType;
if (newDevice->joydev->has_ff) newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;