src/joystick/win32/SDL_dxjoystick.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/joystick/win32/SDL_dxjoystick.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/joystick/win32/SDL_dxjoystick.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -48,11 +48,11 @@
     1.4  #define INPUT_QSIZE	32      /* Buffer up to 32 input messages */
     1.5  
     1.6  extern HINSTANCE SDL_Instance;
     1.7 -extern int DX5_Load ();
     1.8 -extern void DX5_Unload ();
     1.9 -extern HRESULT (WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion,
    1.10 -                                        LPDIRECTINPUT * ppDI,
    1.11 -                                        LPUNKNOWN punkOuter);
    1.12 +extern int DX5_Load();
    1.13 +extern void DX5_Unload();
    1.14 +extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion,
    1.15 +                                       LPDIRECTINPUT * ppDI,
    1.16 +                                       LPUNKNOWN punkOuter);
    1.17  
    1.18  static LPDIRECTINPUT dinput = NULL;
    1.19  
    1.20 @@ -95,7 +95,7 @@
    1.21  
    1.22  /* Convert a DirectInput return code to a text message */
    1.23  static void
    1.24 -SetDIerror (char *function, int code)
    1.25 +SetDIerror(char *function, int code)
    1.26  {
    1.27      static char *error;
    1.28      static char errbuf[1024];
    1.29 @@ -124,23 +124,23 @@
    1.30          error = "Device not initialized";
    1.31          break;
    1.32      default:
    1.33 -        sprintf (errbuf, "%s: Unknown DirectInput error: 0x%x",
    1.34 -                 function, code);
    1.35 +        sprintf(errbuf, "%s: Unknown DirectInput error: 0x%x",
    1.36 +                function, code);
    1.37          break;
    1.38      }
    1.39      if (!errbuf[0]) {
    1.40 -        sprintf (errbuf, "%s: %s", function, error);
    1.41 +        sprintf(errbuf, "%s: %s", function, error);
    1.42      }
    1.43 -    SDL_SetError ("%s", errbuf);
    1.44 +    SDL_SetError("%s", errbuf);
    1.45      return;
    1.46  }
    1.47  
    1.48  
    1.49  BOOL CALLBACK
    1.50 -EnumJoysticksCallback (const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
    1.51 +EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
    1.52  {
    1.53 -    memcpy (&SYS_Joystick[SYS_NumJoysticks], pdidInstance,
    1.54 -            sizeof (DIDEVICEINSTANCE));
    1.55 +    memcpy(&SYS_Joystick[SYS_NumJoysticks], pdidInstance,
    1.56 +           sizeof(DIDEVICEINSTANCE));
    1.57      SYS_NumJoysticks++;
    1.58  
    1.59      if (SYS_NumJoysticks >= MAX_JOYSTICKS)
    1.60 @@ -150,7 +150,7 @@
    1.61  }
    1.62  
    1.63  static BOOL CALLBACK
    1.64 -DIJoystick_EnumDevObjectsProc (LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
    1.65 +DIJoystick_EnumDevObjectsProc(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
    1.66  {
    1.67      SDL_Joystick *joystick = (SDL_Joystick *) pvRef;
    1.68      HRESULT result;
    1.69 @@ -176,28 +176,28 @@
    1.70          in->type = AXIS;
    1.71          in->num = joystick->naxes;
    1.72  
    1.73 -        diprg.diph.dwSize = sizeof (diprg);
    1.74 -        diprg.diph.dwHeaderSize = sizeof (diprg.diph);
    1.75 +        diprg.diph.dwSize = sizeof(diprg);
    1.76 +        diprg.diph.dwHeaderSize = sizeof(diprg.diph);
    1.77          diprg.diph.dwObj = dev->dwOfs;
    1.78          diprg.diph.dwHow = DIPH_BYOFFSET;
    1.79          diprg.lMin = AXIS_MIN;
    1.80          diprg.lMax = AXIS_MAX;
    1.81  
    1.82          result =
    1.83 -            IDirectInputDevice2_SetProperty (joystick->hwdata->InputDevice,
    1.84 -                                             DIPROP_RANGE, &diprg.diph);
    1.85 +            IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice,
    1.86 +                                            DIPROP_RANGE, &diprg.diph);
    1.87          if (result != DI_OK)
    1.88              return DIENUM_CONTINUE;     /* don't use this axis */
    1.89  
    1.90          /* Set dead zone to 0. */
    1.91 -        dilong.diph.dwSize = sizeof (dilong);
    1.92 -        dilong.diph.dwHeaderSize = sizeof (dilong.diph);
    1.93 +        dilong.diph.dwSize = sizeof(dilong);
    1.94 +        dilong.diph.dwHeaderSize = sizeof(dilong.diph);
    1.95          dilong.diph.dwObj = dev->dwOfs;
    1.96          dilong.diph.dwHow = DIPH_BYOFFSET;
    1.97          dilong.dwData = 0;
    1.98          result =
    1.99 -            IDirectInputDevice2_SetProperty (joystick->hwdata->InputDevice,
   1.100 -                                             DIPROP_DEADZONE, &dilong.diph);
   1.101 +            IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice,
   1.102 +                                            DIPROP_DEADZONE, &dilong.diph);
   1.103          if (result != DI_OK)
   1.104              return DIENUM_CONTINUE;     /* don't use this axis */
   1.105  
   1.106 @@ -218,35 +218,35 @@
   1.107   * It should return 0, or -1 on an unrecoverable fatal error.
   1.108   */
   1.109  int
   1.110 -SDL_SYS_JoystickInit (void)
   1.111 +SDL_SYS_JoystickInit(void)
   1.112  {
   1.113      HRESULT result;
   1.114  
   1.115      SYS_NumJoysticks = 0;
   1.116  
   1.117      /* Create the DirectInput object */
   1.118 -    if (DX5_Load () < 0) {
   1.119 -        SDL_SetError ("Couldn't load DirectInput");
   1.120 +    if (DX5_Load() < 0) {
   1.121 +        SDL_SetError("Couldn't load DirectInput");
   1.122          return (-1);
   1.123      }
   1.124 -    result = DInputCreate (SDL_Instance, DIRECTINPUT_VERSION, &dinput, NULL);
   1.125 +    result = DInputCreate(SDL_Instance, DIRECTINPUT_VERSION, &dinput, NULL);
   1.126      if (result != DI_OK) {
   1.127 -        DX5_Unload ();
   1.128 -        SetDIerror ("DirectInputCreate", result);
   1.129 +        DX5_Unload();
   1.130 +        SetDIerror("DirectInputCreate", result);
   1.131          return (-1);
   1.132      }
   1.133  
   1.134 -    result = IDirectInput_EnumDevices (dinput,
   1.135 -                                       DIDEVTYPE_JOYSTICK,
   1.136 -                                       EnumJoysticksCallback,
   1.137 -                                       NULL, DIEDFL_ATTACHEDONLY);
   1.138 +    result = IDirectInput_EnumDevices(dinput,
   1.139 +                                      DIDEVTYPE_JOYSTICK,
   1.140 +                                      EnumJoysticksCallback,
   1.141 +                                      NULL, DIEDFL_ATTACHEDONLY);
   1.142  
   1.143      return SYS_NumJoysticks;
   1.144  }
   1.145  
   1.146  /* Function to get the device-dependent name of a joystick */
   1.147  const char *
   1.148 -SDL_SYS_JoystickName (int index)
   1.149 +SDL_SYS_JoystickName(int index)
   1.150  {
   1.151          /***-> test for invalid index ? */
   1.152      return (SYS_Joystick[index].tszProductName);
   1.153 @@ -258,81 +258,81 @@
   1.154     It returns 0, or -1 if there is an error.
   1.155   */
   1.156  int
   1.157 -SDL_SYS_JoystickOpen (SDL_Joystick * joystick)
   1.158 +SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
   1.159  {
   1.160      HRESULT result;
   1.161      LPDIRECTINPUTDEVICE device;
   1.162  
   1.163      /* allocate memory for system specific hardware data */
   1.164      joystick->hwdata =
   1.165 -        (struct joystick_hwdata *) malloc (sizeof (*joystick->hwdata));
   1.166 +        (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata));
   1.167      if (joystick->hwdata == NULL) {
   1.168 -        SDL_OutOfMemory ();
   1.169 +        SDL_OutOfMemory();
   1.170          return (-1);
   1.171      }
   1.172 -    memset (joystick->hwdata, 0, sizeof (*joystick->hwdata));
   1.173 +    memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
   1.174      joystick->hwdata->buffered = 1;
   1.175  
   1.176      result =
   1.177 -        IDirectInput_CreateDevice (dinput,
   1.178 -                                   &SYS_Joystick[joystick->index].
   1.179 -                                   guidInstance, &device, NULL);
   1.180 +        IDirectInput_CreateDevice(dinput,
   1.181 +                                  &SYS_Joystick[joystick->index].
   1.182 +                                  guidInstance, &device, NULL);
   1.183      if (result != DI_OK) {
   1.184 -        SetDIerror ("DirectInput::CreateDevice", result);
   1.185 +        SetDIerror("DirectInput::CreateDevice", result);
   1.186          return (-1);
   1.187      }
   1.188  
   1.189 -    result = IDirectInputDevice_QueryInterface (device,
   1.190 -                                                &IID_IDirectInputDevice2,
   1.191 -                                                (LPVOID *) & joystick->
   1.192 -                                                hwdata->InputDevice);
   1.193 -    IDirectInputDevice_Release (device);
   1.194 +    result = IDirectInputDevice_QueryInterface(device,
   1.195 +                                               &IID_IDirectInputDevice2,
   1.196 +                                               (LPVOID *) & joystick->
   1.197 +                                               hwdata->InputDevice);
   1.198 +    IDirectInputDevice_Release(device);
   1.199      if (result != DI_OK) {
   1.200 -        SetDIerror ("DirectInputDevice::QueryInterface", result);
   1.201 +        SetDIerror("DirectInputDevice::QueryInterface", result);
   1.202          return (-1);
   1.203      }
   1.204  
   1.205      result =
   1.206 -        IDirectInputDevice2_SetCooperativeLevel (joystick->hwdata->
   1.207 -                                                 InputDevice, SDL_Window,
   1.208 -                                                 DISCL_NONEXCLUSIVE |
   1.209 -                                                 DISCL_BACKGROUND);
   1.210 +        IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->
   1.211 +                                                InputDevice, SDL_Window,
   1.212 +                                                DISCL_NONEXCLUSIVE |
   1.213 +                                                DISCL_BACKGROUND);
   1.214      if (result != DI_OK) {
   1.215 -        SetDIerror ("DirectInputDevice::SetCooperativeLevel", result);
   1.216 +        SetDIerror("DirectInputDevice::SetCooperativeLevel", result);
   1.217          return (-1);
   1.218      }
   1.219  
   1.220      result =
   1.221 -        IDirectInputDevice2_SetDataFormat (joystick->hwdata->InputDevice,
   1.222 -                                           &c_dfDIJoystick);
   1.223 +        IDirectInputDevice2_SetDataFormat(joystick->hwdata->InputDevice,
   1.224 +                                          &c_dfDIJoystick);
   1.225      if (result != DI_OK) {
   1.226 -        SetDIerror ("DirectInputDevice::SetDataFormat", result);
   1.227 +        SetDIerror("DirectInputDevice::SetDataFormat", result);
   1.228          return (-1);
   1.229      }
   1.230  
   1.231 -    IDirectInputDevice2_EnumObjects (joystick->hwdata->InputDevice,
   1.232 -                                     DIJoystick_EnumDevObjectsProc,
   1.233 -                                     joystick,
   1.234 -                                     DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
   1.235 +    IDirectInputDevice2_EnumObjects(joystick->hwdata->InputDevice,
   1.236 +                                    DIJoystick_EnumDevObjectsProc,
   1.237 +                                    joystick,
   1.238 +                                    DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
   1.239  
   1.240      {
   1.241          DIPROPDWORD dipdw;
   1.242 -        memset (&dipdw, 0, sizeof (dipdw));
   1.243 -        dipdw.diph.dwSize = sizeof (dipdw);
   1.244 -        dipdw.diph.dwHeaderSize = sizeof (dipdw.diph);
   1.245 +        memset(&dipdw, 0, sizeof(dipdw));
   1.246 +        dipdw.diph.dwSize = sizeof(dipdw);
   1.247 +        dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
   1.248          dipdw.diph.dwObj = 0;
   1.249          dipdw.diph.dwHow = DIPH_DEVICE;
   1.250          dipdw.dwData = INPUT_QSIZE;
   1.251          result =
   1.252 -            IDirectInputDevice2_SetProperty (joystick->hwdata->InputDevice,
   1.253 -                                             DIPROP_BUFFERSIZE, &dipdw.diph);
   1.254 +            IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice,
   1.255 +                                            DIPROP_BUFFERSIZE, &dipdw.diph);
   1.256  
   1.257          if (result == DI_POLLEDDEVICE) {
   1.258              /* This device doesn't support buffering, so we're forced
   1.259               * to use less reliable polling. */
   1.260              joystick->hwdata->buffered = 0;
   1.261          } else if (result != DI_OK) {
   1.262 -            SetDIerror ("DirectInputDevice::SetProperty", result);
   1.263 +            SetDIerror("DirectInputDevice::SetProperty", result);
   1.264              return (-1);
   1.265          }
   1.266      }
   1.267 @@ -341,7 +341,7 @@
   1.268  }
   1.269  
   1.270  static Uint8
   1.271 -TranslatePOV (DWORD value)
   1.272 +TranslatePOV(DWORD value)
   1.273  {
   1.274      const int HAT_VALS[] = {
   1.275          SDL_HAT_UP,
   1.276 @@ -354,7 +354,7 @@
   1.277          SDL_HAT_UP | SDL_HAT_LEFT
   1.278      };
   1.279  
   1.280 -    if (LOWORD (value) == 0xFFFF)
   1.281 +    if (LOWORD(value) == 0xFFFF)
   1.282          return SDL_HAT_CENTERED;
   1.283  
   1.284      /* Round the value up: */
   1.285 @@ -371,28 +371,27 @@
   1.286  /* SDL_PrivateJoystick* doesn't discard duplicate events, so we need to
   1.287   * do it. */
   1.288  static int
   1.289 -SDL_PrivateJoystickAxis_Int (SDL_Joystick * joystick, Uint8 axis,
   1.290 -                             Sint16 value)
   1.291 +SDL_PrivateJoystickAxis_Int(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
   1.292  {
   1.293      if (joystick->axes[axis] != value)
   1.294 -        return SDL_PrivateJoystickAxis (joystick, axis, value);
   1.295 +        return SDL_PrivateJoystickAxis(joystick, axis, value);
   1.296      return 0;
   1.297  }
   1.298  
   1.299  static int
   1.300 -SDL_PrivateJoystickHat_Int (SDL_Joystick * joystick, Uint8 hat, Uint8 value)
   1.301 +SDL_PrivateJoystickHat_Int(SDL_Joystick * joystick, Uint8 hat, Uint8 value)
   1.302  {
   1.303      if (joystick->hats[hat] != value)
   1.304 -        return SDL_PrivateJoystickHat (joystick, hat, value);
   1.305 +        return SDL_PrivateJoystickHat(joystick, hat, value);
   1.306      return 0;
   1.307  }
   1.308  
   1.309  static int
   1.310 -SDL_PrivateJoystickButton_Int (SDL_Joystick * joystick, Uint8 button,
   1.311 -                               Uint8 state)
   1.312 +SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick, Uint8 button,
   1.313 +                              Uint8 state)
   1.314  {
   1.315      if (joystick->buttons[button] != state)
   1.316 -        return SDL_PrivateJoystickButton (joystick, button, state);
   1.317 +        return SDL_PrivateJoystickButton(joystick, button, state);
   1.318      return 0;
   1.319  }
   1.320  
   1.321 @@ -402,21 +401,21 @@
   1.322   * and update joystick device state.
   1.323   */
   1.324  void
   1.325 -SDL_SYS_JoystickUpdate_Polled (SDL_Joystick * joystick)
   1.326 +SDL_SYS_JoystickUpdate_Polled(SDL_Joystick * joystick)
   1.327  {
   1.328      DIJOYSTATE state;
   1.329      HRESULT result;
   1.330      int i;
   1.331  
   1.332      result =
   1.333 -        IDirectInputDevice2_GetDeviceState (joystick->hwdata->InputDevice,
   1.334 -                                            sizeof (state), &state);
   1.335 +        IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice,
   1.336 +                                           sizeof(state), &state);
   1.337      if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
   1.338 -        IDirectInputDevice2_Acquire (joystick->hwdata->InputDevice);
   1.339 +        IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
   1.340          result =
   1.341 -            IDirectInputDevice2_GetDeviceState (joystick->hwdata->
   1.342 -                                                InputDevice, sizeof (state),
   1.343 -                                                &state);
   1.344 +            IDirectInputDevice2_GetDeviceState(joystick->hwdata->
   1.345 +                                               InputDevice, sizeof(state),
   1.346 +                                               &state);
   1.347      }
   1.348  
   1.349      /* Set each known axis, button and POV. */
   1.350 @@ -427,54 +426,54 @@
   1.351          case AXIS:
   1.352              switch (in->ofs) {
   1.353              case DIJOFS_X:
   1.354 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.355 -                                             (Sint16) state.lX);
   1.356 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.357 +                                            (Sint16) state.lX);
   1.358                  break;
   1.359              case DIJOFS_Y:
   1.360 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.361 -                                             (Sint16) state.lY);
   1.362 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.363 +                                            (Sint16) state.lY);
   1.364                  break;
   1.365              case DIJOFS_Z:
   1.366 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.367 -                                             (Sint16) state.lZ);
   1.368 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.369 +                                            (Sint16) state.lZ);
   1.370                  break;
   1.371              case DIJOFS_RX:
   1.372 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.373 -                                             (Sint16) state.lRx);
   1.374 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.375 +                                            (Sint16) state.lRx);
   1.376                  break;
   1.377              case DIJOFS_RY:
   1.378 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.379 -                                             (Sint16) state.lRy);
   1.380 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.381 +                                            (Sint16) state.lRy);
   1.382                  break;
   1.383              case DIJOFS_RZ:
   1.384 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.385 -                                             (Sint16) state.lRz);
   1.386 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.387 +                                            (Sint16) state.lRz);
   1.388                  break;
   1.389 -            case DIJOFS_SLIDER (0):
   1.390 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.391 -                                             (Sint16) state.rglSlider[0]);
   1.392 +            case DIJOFS_SLIDER(0):
   1.393 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.394 +                                            (Sint16) state.rglSlider[0]);
   1.395                  break;
   1.396 -            case DIJOFS_SLIDER (1):
   1.397 -                SDL_PrivateJoystickAxis_Int (joystick, in->num,
   1.398 -                                             (Sint16) state.rglSlider[0]);
   1.399 +            case DIJOFS_SLIDER(1):
   1.400 +                SDL_PrivateJoystickAxis_Int(joystick, in->num,
   1.401 +                                            (Sint16) state.rglSlider[0]);
   1.402                  break;
   1.403              }
   1.404  
   1.405              break;
   1.406  
   1.407          case BUTTON:
   1.408 -            SDL_PrivateJoystickButton_Int (joystick, in->num,
   1.409 -                                           (Uint8) (state.
   1.410 -                                                    rgbButtons[in->ofs -
   1.411 -                                                               DIJOFS_BUTTON0]
   1.412 -                                                    ? SDL_PRESSED :
   1.413 -                                                    SDL_RELEASED));
   1.414 +            SDL_PrivateJoystickButton_Int(joystick, in->num,
   1.415 +                                          (Uint8) (state.
   1.416 +                                                   rgbButtons[in->ofs -
   1.417 +                                                              DIJOFS_BUTTON0]
   1.418 +                                                   ? SDL_PRESSED :
   1.419 +                                                   SDL_RELEASED));
   1.420              break;
   1.421          case HAT:
   1.422              {
   1.423                  Uint8 pos =
   1.424 -                    TranslatePOV (state.rgdwPOV[in->ofs - DIJOFS_POV (0)]);
   1.425 -                SDL_PrivateJoystickHat_Int (joystick, in->num, pos);
   1.426 +                    TranslatePOV(state.rgdwPOV[in->ofs - DIJOFS_POV(0)]);
   1.427 +                SDL_PrivateJoystickHat_Int(joystick, in->num, pos);
   1.428                  break;
   1.429              }
   1.430          }
   1.431 @@ -482,7 +481,7 @@
   1.432  }
   1.433  
   1.434  void
   1.435 -SDL_SYS_JoystickUpdate_Buffered (SDL_Joystick * joystick)
   1.436 +SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick * joystick)
   1.437  {
   1.438      int i;
   1.439      HRESULT result;
   1.440 @@ -491,16 +490,16 @@
   1.441  
   1.442      numevents = INPUT_QSIZE;
   1.443      result =
   1.444 -        IDirectInputDevice2_GetDeviceData (joystick->hwdata->InputDevice,
   1.445 -                                           sizeof (DIDEVICEOBJECTDATA),
   1.446 -                                           evtbuf, &numevents, 0);
   1.447 +        IDirectInputDevice2_GetDeviceData(joystick->hwdata->InputDevice,
   1.448 +                                          sizeof(DIDEVICEOBJECTDATA),
   1.449 +                                          evtbuf, &numevents, 0);
   1.450      if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
   1.451 -        IDirectInputDevice2_Acquire (joystick->hwdata->InputDevice);
   1.452 +        IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
   1.453          result =
   1.454 -            IDirectInputDevice2_GetDeviceData (joystick->hwdata->
   1.455 -                                               InputDevice,
   1.456 -                                               sizeof (DIDEVICEOBJECTDATA),
   1.457 -                                               evtbuf, &numevents, 0);
   1.458 +            IDirectInputDevice2_GetDeviceData(joystick->hwdata->
   1.459 +                                              InputDevice,
   1.460 +                                              sizeof(DIDEVICEOBJECTDATA),
   1.461 +                                              evtbuf, &numevents, 0);
   1.462      }
   1.463  
   1.464      /* Handle the events */
   1.465 @@ -518,19 +517,19 @@
   1.466  
   1.467              switch (in->type) {
   1.468              case AXIS:
   1.469 -                SDL_PrivateJoystickAxis (joystick, in->num,
   1.470 -                                         (Sint16) evtbuf[i].dwData);
   1.471 +                SDL_PrivateJoystickAxis(joystick, in->num,
   1.472 +                                        (Sint16) evtbuf[i].dwData);
   1.473                  break;
   1.474              case BUTTON:
   1.475 -                SDL_PrivateJoystickButton (joystick, in->num,
   1.476 -                                           (Uint8) (evtbuf[i].
   1.477 -                                                    dwData ? SDL_PRESSED
   1.478 -                                                    : SDL_RELEASED));
   1.479 +                SDL_PrivateJoystickButton(joystick, in->num,
   1.480 +                                          (Uint8) (evtbuf[i].
   1.481 +                                                   dwData ? SDL_PRESSED
   1.482 +                                                   : SDL_RELEASED));
   1.483                  break;
   1.484              case HAT:
   1.485                  {
   1.486 -                    Uint8 pos = TranslatePOV (evtbuf[i].dwData);
   1.487 -                    SDL_PrivateJoystickHat (joystick, in->num, pos);
   1.488 +                    Uint8 pos = TranslatePOV(evtbuf[i].dwData);
   1.489 +                    SDL_PrivateJoystickHat(joystick, in->num, pos);
   1.490                  }
   1.491              }
   1.492          }
   1.493 @@ -538,42 +537,42 @@
   1.494  }
   1.495  
   1.496  void
   1.497 -SDL_SYS_JoystickUpdate (SDL_Joystick * joystick)
   1.498 +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
   1.499  {
   1.500      HRESULT result;
   1.501  
   1.502 -    result = IDirectInputDevice2_Poll (joystick->hwdata->InputDevice);
   1.503 +    result = IDirectInputDevice2_Poll(joystick->hwdata->InputDevice);
   1.504      if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
   1.505 -        IDirectInputDevice2_Acquire (joystick->hwdata->InputDevice);
   1.506 -        IDirectInputDevice2_Poll (joystick->hwdata->InputDevice);
   1.507 +        IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
   1.508 +        IDirectInputDevice2_Poll(joystick->hwdata->InputDevice);
   1.509      }
   1.510  
   1.511      if (joystick->hwdata->buffered)
   1.512 -        SDL_SYS_JoystickUpdate_Buffered (joystick);
   1.513 +        SDL_SYS_JoystickUpdate_Buffered(joystick);
   1.514      else
   1.515 -        SDL_SYS_JoystickUpdate_Polled (joystick);
   1.516 +        SDL_SYS_JoystickUpdate_Polled(joystick);
   1.517  }
   1.518  
   1.519  /* Function to close a joystick after use */
   1.520  void
   1.521 -SDL_SYS_JoystickClose (SDL_Joystick * joystick)
   1.522 +SDL_SYS_JoystickClose(SDL_Joystick * joystick)
   1.523  {
   1.524 -    IDirectInputDevice2_Unacquire (joystick->hwdata->InputDevice);
   1.525 -    IDirectInputDevice2_Release (joystick->hwdata->InputDevice);
   1.526 +    IDirectInputDevice2_Unacquire(joystick->hwdata->InputDevice);
   1.527 +    IDirectInputDevice2_Release(joystick->hwdata->InputDevice);
   1.528  
   1.529      if (joystick->hwdata != NULL) {
   1.530          /* free system specific hardware data */
   1.531 -        free (joystick->hwdata);
   1.532 +        free(joystick->hwdata);
   1.533      }
   1.534  }
   1.535  
   1.536  /* Function to perform any system-specific joystick related cleanup */
   1.537  void
   1.538 -SDL_SYS_JoystickQuit (void)
   1.539 +SDL_SYS_JoystickQuit(void)
   1.540  {
   1.541 -    IDirectInput_Release (dinput);
   1.542 +    IDirectInput_Release(dinput);
   1.543      dinput = NULL;
   1.544 -    DX5_Unload ();
   1.545 +    DX5_Unload();
   1.546  }
   1.547  
   1.548  #endif /* SDL_JOYSTICK_DINPUT */