Bruno,
On 11/12/2014 02:06 AM, Bruno Jesus wrote:
Related to bug https://bugs.winehq.org/show_bug.cgi?id=35954
using a switch statement instead of the ?: chain of death looks IMHO nicer. You can even use a macro like the popular #define X(x) case (x): return #x to make it more concise and avoid copy and paste errors.
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 0d61f57..2931832 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -402,14 +402,30 @@ HRESULT WINAPI JoystickAGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REF
void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) { + int type = GET_DIDEVICE_TYPE(lpDIDevCaps->dwDevType); TRACE("dwSize: %d\n", lpDIDevCaps->dwSize); TRACE("dwFlags: %08x\n", lpDIDevCaps->dwFlags); TRACE("dwDevType: %08x %s\n", lpDIDevCaps->dwDevType, - lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : - lpDIDevCaps->dwDevType == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : - lpDIDevCaps->dwDevType == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : "UNKNOWN"); + /* Directx <= 7 definitions */ + type == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : + type == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : + type == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : + type == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : + type == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : + /* Directx >= 8 definitions */ + type == DI8DEVTYPE_DEVICE ? "DI8DEVTYPE_DEVICE" : + type == DI8DEVTYPE_MOUSE ? "DI8DEVTYPE_MOUSE" : + type == DI8DEVTYPE_KEYBOARD ? "DI8DEVTYPE_KEYBOARD" : + type == DI8DEVTYPE_JOYSTICK ? "DI8DEVTYPE_JOYSTICK" : + type == DI8DEVTYPE_GAMEPAD ? "DI8DEVTYPE_GAMEPAD" : + type == DI8DEVTYPE_DRIVING ? "DI8DEVTYPE_DRIVING" : + type == DI8DEVTYPE_FLIGHT ? "DI8DEVTYPE_FLIGHT" : + type == DI8DEVTYPE_1STPERSON ? "DI8DEVTYPE_1STPERSON" : + type == DI8DEVTYPE_DEVICECTRL ? "DI8DEVTYPE_DEVICECTRL" : + type == DI8DEVTYPE_SCREENPOINTER ? "DI8DEVTYPE_SCREENPOINTER" : + type == DI8DEVTYPE_REMOTE ? "DI8DEVTYPE_REMOTE" : + type == DI8DEVTYPE_SUPPLEMENTAL ? "DI8DEVTYPE_SUPPLEMENTAL" : + "UNKNOWN"); TRACE("dwAxes: %d\n", lpDIDevCaps->dwAxes); TRACE("dwButtons: %d\n", lpDIDevCaps->dwButtons); TRACE("dwPOVs: %d\n", lpDIDevCaps->dwPOVs);
bye michael