src/joystick/windows/SDL_dxjoystick.c
changeset 7831 214cd9137ea9
parent 7719 31b5f9ff36ca
child 7844 97fa86ce5a2e
equal deleted inserted replaced
7830:722c44cad199 7831:214cd9137ea9
    50 #include "SDL_dxjoystick_c.h"
    50 #include "SDL_dxjoystick_c.h"
    51 
    51 
    52 #ifndef DIDFT_OPTIONAL
    52 #ifndef DIDFT_OPTIONAL
    53 #define DIDFT_OPTIONAL      0x80000000
    53 #define DIDFT_OPTIONAL      0x80000000
    54 #endif
    54 #endif
       
    55 
       
    56 DEFINE_GUID(GUID_DEVINTERFACE_HID, 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
    55 
    57 
    56 
    58 
    57 #define INPUT_QSIZE 32      /* Buffer up to 32 input messages */
    59 #define INPUT_QSIZE 32      /* Buffer up to 32 input messages */
    58 #define AXIS_MIN    -32768  /* minimum value for axis coordinate */
    60 #define AXIS_MIN    -32768  /* minimum value for axis coordinate */
    59 #define AXIS_MAX    32767   /* maximum value for axis coordinate */
    61 #define AXIS_MAX    32767   /* maximum value for axis coordinate */
   385         &IID_X360WiredGamepad,   /* Microsoft's wired X360 controller for Windows. */
   387         &IID_X360WiredGamepad,   /* Microsoft's wired X360 controller for Windows. */
   386         &IID_X360WirelessGamepad /* Microsoft's wireless X360 controller for Windows. */
   388         &IID_X360WirelessGamepad /* Microsoft's wireless X360 controller for Windows. */
   387     };
   389     };
   388 
   390 
   389     size_t iDevice;
   391     size_t iDevice;
   390     SDL_bool retval = SDL_FALSE;
       
   391     UINT i;
   392     UINT i;
   392 
   393 
   393     if (!s_bXInputEnabled) {
   394     if (!s_bXInputEnabled) {
   394         return SDL_FALSE;
   395         return SDL_FALSE;
   395     }
   396     }
   505 
   506 
   506     SDL_zero(dbh);
   507     SDL_zero(dbh);
   507 
   508 
   508     dbh.dbcc_size = sizeof(dbh);
   509     dbh.dbcc_size = sizeof(dbh);
   509     dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
   510     dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
   510     dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
   511     dbh.dbcc_classguid = GUID_DEVINTERFACE_HID;
   511 
   512 
   512     hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE );
   513     hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE );
   513     if ( !hNotify )
   514     if ( !hNotify )
   514     {
   515     {
   515         return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError());
   516         return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError());