src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2639 668fee3b268a
parent 2637 2f826c229d77
child 2641 e1e1be935178
equal deleted inserted replaced
2638:db93456d4b26 2639:668fee3b268a
   160       SDL_SetError("Haptic: Couldn't create a HID object iterator.");
   160       SDL_SetError("Haptic: Couldn't create a HID object iterator.");
   161       return -1;
   161       return -1;
   162    }
   162    }
   163    /* IOServiceGetMatchingServices consumes dictionary. */
   163    /* IOServiceGetMatchingServices consumes dictionary. */
   164 
   164 
       
   165    if (!iter) { /* No iterator. */
       
   166       numhaptics = 0;
       
   167       return 0;
       
   168    }
       
   169 
   165    numhaptics = 0;
   170    numhaptics = 0;
   166    while ((device = IOIteratorNext(iter)) != IO_OBJECT_NULL) {
   171    while ((device = IOIteratorNext(iter)) != IO_OBJECT_NULL) {
   167 
   172 
   168       /* Check for force feedback. */
   173       /* Check for force feedback. */
   169       if (FFIsForceFeedback(device) == FF_OK) {
   174       if (FFIsForceFeedback(device) == FF_OK) {
   457  * Checks to see if the haptic device and joystick and in reality the same.
   462  * Checks to see if the haptic device and joystick and in reality the same.
   458  */
   463  */
   459 int
   464 int
   460 SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
   465 SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
   461 {
   466 {
   462    if (IOObjectIsEqualTo(haptic->hwdata->device, joystick->hwdata->ffservice))
   467    if (IOObjectIsEqualTo((io_object_t) haptic->hwdata->device,
       
   468                                        joystick->hwdata->ffservice))
   463       return 1;
   469       return 1;
   464    return 0;
   470    return 0;
   465 }
   471 }
   466 
   472 
   467 
   473