This matches what Windows does with common controllers like xbox 360.
Signed-off-by: Andrew Eikum aeikum@codeweavers.com ---
This allows controllers to work in some games like Telltale games and Yakuza Kiwami.
dlls/dinput/dinput_main.c | 1 + dlls/dinput/joystick_linux.c | 9 +++------ dlls/dinput/joystick_linuxinput.c | 9 +++------ dlls/dinput/joystick_osx.c | 7 +++++-- 4 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 1b2020c7110..7b6a5b075cd 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -246,6 +246,7 @@ static const char *_dump_DIDEVTYPE_value(DWORD dwDevType, DWORD dwVersion) case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD"; case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK"; case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE"; + case DIDEVTYPE_GAMEPAD: return "DIDEVTYPE_GAMEPAD"; default: return "Unknown"; } } else { diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 963e62f017c..736a06e2b27 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -316,9 +316,9 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidProduct = joystick_devices[id].guid_product; /* we only support traditional joysticks for now */ if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joystick_devices[id].bus_type == BUS_USB && @@ -326,10 +326,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver { lpddi->dwDevType |= DIDEVTYPE_HID; lpddi->wUsagePage = 0x01; /* Desktop */ - if (lpddi->dwDevType == DI8DEVTYPE_JOYSTICK || lpddi->dwDevType == DIDEVTYPE_JOYSTICK) - lpddi->wUsage = 0x04; /* Joystick */ - else - lpddi->wUsage = 0x05; /* Game Pad */ + lpddi->wUsage = 0x05; /* Game Pad */ }
MultiByteToWideChar(CP_ACP, 0, joystick_devices[id].name, -1, lpddi->tszInstanceName, MAX_PATH); diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 910e755d3ed..cea669b90cb 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -355,9 +355,9 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidFFDriver = GUID_NULL;
if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joydevs[id].bus_type == BUS_USB && @@ -365,10 +365,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver { lpddi->dwDevType |= DIDEVTYPE_HID; lpddi->wUsagePage = 0x01; /* Desktop */ - if (lpddi->dwDevType == DI8DEVTYPE_JOYSTICK || lpddi->dwDevType == DIDEVTYPE_JOYSTICK) - lpddi->wUsage = 0x04; /* Joystick */ - else - lpddi->wUsage = 0x05; /* Game Pad */ + lpddi->wUsage = 0x05; /* Game Pad */ }
MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszInstanceName, MAX_PATH); diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 0701b9f42cc..daef1a12ed5 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -969,9 +969,12 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS lpddi->guidProduct.Data1 = make_vid_pid(device); /* we only support traditional joysticks for now */ if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8); + lpddi->dwDevType |= DIDEVTYPE_HID; + lpddi->wUsagePage = 0x01; /* Desktop */ + lpddi->wUsage = 0x05; /* Game Pad */ sprintf(lpddi->tszInstanceName, "Joystick %d", id);
/* get the device name */