Many typo and silly mistake fixes. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Tue, 15 Jul 2008 17:03:34 +0000
branchgsoc2008_force_feedback
changeset 25217aa91c21ce5f
parent 2520 6aee9eb4fc6d
child 2522 0877146be013
Many typo and silly mistake fixes.
src/haptic/darwin/SDL_syshaptic.c
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Tue Jul 15 16:35:14 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Tue Jul 15 17:03:34 2008 +0000
     1.3 @@ -29,6 +29,7 @@
     1.4  #include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
     1.5  /*#include "../../joystick/dawrin/SDL_sysjoystick_c.h"*/ /* For joystick hwdata */ 
     1.6  
     1.7 +#include <IOKit/IOTypes.h>
     1.8  #include <ForceFeedback/ForceFeedback.h>
     1.9  #include <ForceFeedback/ForceFeedbackConstants.h>
    1.10  
    1.11 @@ -75,7 +76,7 @@
    1.12     IOReturn result;
    1.13     io_iterator_t iter;
    1.14     CFDictionaryRef match;
    1.15 -   io_sercive_t device;
    1.16 +   io_service_t device;
    1.17  
    1.18     /* Get HID devices. */
    1.19     match = IOServiceMatching(kIOHIDDeviceKey);
    1.20 @@ -172,7 +173,7 @@
    1.21     }
    1.22  
    1.23     /* Checks if supports autocenter. */
    1.24 -   ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_FFAUTOCENTER,
    1.25 +   ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_AUTOCENTER,
    1.26                                            val, sizeof(val));
    1.27     if (ret == FF_OK) supported |= SDL_HAPTIC_AUTOCENTER;
    1.28     else if (ret != FFERR_UNSUPPORTED) {
    1.29 @@ -339,31 +340,31 @@
    1.30  static int
    1.31  SDL_SYS_SetDirection( FFEFFECT * effect, SDL_HapticDirection *dir, int axes )
    1.32  {
    1.33 -   LONG *dir;
    1.34 +   LONG *rglDir;
    1.35     dir = SDL_malloc( sizeof(LONG) * axes );
    1.36     if (dir == NULL) {
    1.37        SDL_OutOfMemory();
    1.38        return -1;
    1.39     }
    1.40     SDL_memset( dir, 0, sizeof(LONG) * axes );
    1.41 -   effect->rglDirection = dir;
    1.42 +   effect->rglDirection = rglDir;
    1.43  
    1.44     switch (dir->type) {
    1.45        case SDL_HAPTIC_POLAR:
    1.46           effect->dwFlags |= FFEFF_POLAR;
    1.47 -         dir[0] = dir->dir[0];
    1.48 +         rglDir[0] = dir->dir[0];
    1.49           return 0;
    1.50        case SDL_HAPTIC_CARTESIAN:
    1.51           effects->dwFlags |= FFEFF_CARTESIAN;
    1.52 -         dir[0] = dir->dir[0];
    1.53 -         dir[1] = dir->dir[1];
    1.54 -         dir[2] = dir->dir[2];
    1.55 +         rglDir[0] = dir->dir[0];
    1.56 +         rglDir[1] = dir->dir[1];
    1.57 +         rglDir[2] = dir->dir[2];
    1.58           return 0;
    1.59 -      case SDL_HAPTIC_SHPERICAL:
    1.60 +      case SDL_HAPTIC_SPHERICAL:
    1.61           effects->dwFlags |= FFEFF_SPHERICAL;
    1.62 -         dir[0] = dir->dir[0];
    1.63 -         dir[1] = dir->dir[1];
    1.64 -         dir[2] = dir->dir[2];
    1.65 +         rglDir[0] = dir->dir[0];
    1.66 +         rglDir[1] = dir->dir[1];
    1.67 +         rglDir[2] = dir->dir[2];
    1.68           return 0;
    1.69  
    1.70        default:
    1.71 @@ -385,7 +386,7 @@
    1.72     FFRAMPFORCE *ramp;
    1.73     FFCUSTOMFORCE *custom;
    1.74     SDL_HapticConstant *hap_constant;
    1.75 -   SDL_HapticPeriodic *hap-periodic;
    1.76 +   SDL_HapticPeriodic *hap_periodic;
    1.77     SDL_HapticCondition *hap_condition;
    1.78     SDL_HapticRamp *hap_ramp;
    1.79  
    1.80 @@ -407,10 +408,10 @@
    1.81           dest->lpvTypeSpecificParams = constant;
    1.82  
    1.83           /* Generics */
    1.84 -         dest->dwDuration = src->length * 1000; /* In microseconds. */
    1.85 +         dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
    1.86           dest->dwTriggerButton = FFJOFS_BUTTON(hap_constant->button);
    1.87           dest->dwTriggerRepeatInterval = hap_constant->interval;
    1.88 -         dest->dwStartDelay = src->delay * 1000; /* In microseconds. */
    1.89 +         dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */
    1.90  
    1.91           /* Axes */
    1.92           dest->cAxes = 2; /* TODO handle */
    1.93 @@ -468,7 +469,7 @@
    1.94   */
    1.95  CFUUIDRef SDL_SYS_HapticEffectType(struct haptic_effect * effect)
    1.96  {
    1.97 -   switch (effect->effect->type) {
    1.98 +   switch (effect->effect.type) {
    1.99        case SDL_HAPTIC_CONSTANT:
   1.100           return kFFEffectType_ConstantForce_ID;
   1.101  
   1.102 @@ -481,7 +482,7 @@
   1.103        case SDL_HAPTIC_SINE:
   1.104           return kFFEffectType_Sine_ID;
   1.105  
   1.106 -      case SDL_HAPTIC_TRIANGLE;
   1.107 +      case SDL_HAPTIC_TRIANGLE:
   1.108           return kFFEffectType_Triangle_ID;
   1.109  
   1.110        case SDL_HAPTIC_SAWTOOTHUP:
   1.111 @@ -539,7 +540,7 @@
   1.112     }
   1.113  
   1.114     /* Get the effect. */
   1.115 -   if (SDL_SYS_ToFFEFFECT( &effect->hweffect->effect, &haptic_effect->effect ) < 0) {
   1.116 +   if (SDL_SYS_ToFFEFFECT( &effect->hweffect->effect, &effect->effect ) < 0) {
   1.117        /* TODO cleanup alloced stuff. */
   1.118        return -1;
   1.119     }
   1.120 @@ -572,7 +573,7 @@
   1.121  
   1.122     /* Check if it's infinite. */
   1.123     if (iterations == SDL_HAPTIC_INFINITY) {
   1.124 -      iter = INFINITE;
   1.125 +      iter = FF_INFINITE;
   1.126     }
   1.127     else
   1.128        iter = iterations;
   1.129 @@ -634,7 +635,7 @@
   1.130     HRESULT ret;
   1.131     FFEffectStatusFlag status;
   1.132  
   1.133 -   ret = FFEffectGetEffectStatus(effect->hweffect.ref, &status);
   1.134 +   ret = FFEffectGetEffectStatus(effect->hweffect->ref, &status);
   1.135     if (ret != FF_OK) {
   1.136        SDL_SetError("Haptic: Unable to get effect status.");
   1.137        return -1;
   1.138 @@ -679,7 +680,7 @@
   1.139     else val = 1;
   1.140  
   1.141     ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
   1.142 -               FFPROP_FFAUTOCENTER, &val);
   1.143 +               FFPROP_AUTOCENTER, &val);
   1.144     if (ret != FF_OK) {
   1.145        SDL_SetError("Haptic: Error setting autocenter.");
   1.146        return -1;