Re: [AD] joystick isn't detected

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Trent Gamblin wrote:
Just throwing out a guess here but does it uses the new XInput library that
is deprecating DirectInput? Maybe we need to support that too.
I checked MSDN, and even the XBox controllers are available via DirectInput. However, it is still recommended to use the two APIs side by side to get all of the features out of the XBox controllers.

But the fix is simple.

DIDEVTYPE_JOYSTICK was 0x04 in DirectInput 7, but now is 0x14 in DirectInput 8.

DI8DEVCLASS_GAMECTRL is the new 0x04 in DirectInput 8.

See dinput.h.

Attached is a patch for wjoydxnu.c that fixes it.

--
Matthew Leverton
--- wjoydxnu-old.c	2008-09-28 01:13:32.000000000 -0500
+++ wjoydxnu.c	2008-12-14 00:53:46.000000000 -0600
@@ -712,7 +712,7 @@ static bool joydx_init_joystick(void)
    }
 
    /* enumerate the joysticks attached to the system */
-   hr = IDirectInput8_EnumDevices(joystick_dinput, DI8DEVTYPE_JOYSTICK, joystick_enum_callback, NULL, DIEDFL_ATTACHEDONLY);
+   hr = IDirectInput8_EnumDevices(joystick_dinput, DI8DEVCLASS_GAMECTRL, joystick_enum_callback, NULL, DIEDFL_ATTACHEDONLY);
    if (FAILED(hr) || (joydx_num_joysticks == 0)) {
       IDirectInput8_Release(joystick_dinput);
       joystick_dinput = NULL;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/