فهرست منبع

Fixed signatures for internal haptics functions

Sam Lantinga 10 ماه پیش
والد
کامیت
26fc7a8060

+ 1 - 3
src/haptic/SDL_haptic.c

@@ -223,9 +223,7 @@ SDL_bool SDL_IsJoystickHaptic(SDL_Joystick *joystick)
         /* Must be a valid joystick */
         if (SDL_IsJoystickValid(joystick) &&
             !SDL_IsGamepad(SDL_GetJoystickInstanceID(joystick))) {
-            if (SDL_SYS_JoystickIsHaptic(joystick) > 0) {
-                result = SDL_TRUE;
-            }
+            result = SDL_SYS_JoystickIsHaptic(joystick);
         }
     }
     SDL_UnlockJoysticks();

+ 3 - 6
src/haptic/SDL_syshaptic.h

@@ -92,11 +92,8 @@ int SDL_SYS_HapticMouse(void);
 
 /*
  * Checks to see if the joystick has haptic capabilities.
- *
- * Returns >0 if haptic capabilities are detected, 0 if haptic
- * capabilities aren't detected and -1 on error.
  */
-extern int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick);
+extern SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick);
 
 /*
  * Opens the haptic device for usage using the same device as
@@ -109,9 +106,9 @@ extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic,
 /*
  * Checks to see if haptic device and joystick device are the same.
  *
- * Returns 1 if they are the same, 0 if they aren't.
+ * Returns SDL_TRUE if they are the same, SDL_FALSE if they aren't.
  */
-extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic,
+extern SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic,
                                       SDL_Joystick *joystick);
 
 /*

+ 4 - 4
src/haptic/android/SDL_syshaptic.c

@@ -138,9 +138,9 @@ int SDL_SYS_HapticMouse(void)
     return -1;
 }
 
-int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 {
-    return 0;
+    return SDL_FALSE;
 }
 
 int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
@@ -148,9 +148,9 @@ int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
     return SDL_Unsupported();
 }
 
-int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
 {
-    return 0;
+    return SDL_FALSE;
 }
 
 void SDL_SYS_HapticClose(SDL_Haptic *haptic)

+ 5 - 5
src/haptic/darwin/SDL_syshaptic.c

@@ -587,7 +587,7 @@ int SDL_SYS_HapticMouse(void)
 /*
  * Checks to see if a joystick has haptic features.
  */
-int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 {
 #ifdef SDL_JOYSTICK_IOKIT
     if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
@@ -603,18 +603,18 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 /*
  * Checks to see if the haptic device and joystick are in reality the same.
  */
-int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
 {
 #ifdef SDL_JOYSTICK_IOKIT
     if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
-        return 0;
+        return SDL_FALSE;
     }
     if (IOObjectIsEqualTo((io_object_t)((size_t)haptic->hwdata->device),
                           joystick->hwdata->ffservice)) {
-        return 1;
+        return SDL_TRUE;
     }
 #endif
-    return 0;
+    return SDL_FALSE;
 }
 
 /*

+ 4 - 4
src/haptic/dummy/SDL_syshaptic.c

@@ -61,9 +61,9 @@ int SDL_SYS_HapticMouse(void)
     return -1;
 }
 
-int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 {
-    return 0;
+    return SDL_FALSE;
 }
 
 int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
@@ -71,9 +71,9 @@ int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
     return SDL_SYS_LogicError();
 }
 
-int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
 {
-    return 0;
+    return SDL_FALSE;
 }
 
 void SDL_SYS_HapticClose(SDL_Haptic *haptic)

+ 5 - 5
src/haptic/linux/SDL_syshaptic.c

@@ -503,7 +503,7 @@ int SDL_SYS_HapticMouse(void)
 /*
  * Checks to see if a joystick has haptic features.
  */
-int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 {
 #ifdef SDL_JOYSTICK_LINUX
     SDL_AssertJoysticksLocked();
@@ -521,21 +521,21 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 /*
  * Checks to see if the haptic device and joystick are in reality the same.
  */
-int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
 {
 #ifdef SDL_JOYSTICK_LINUX
     SDL_AssertJoysticksLocked();
 
     if (joystick->driver != &SDL_LINUX_JoystickDriver) {
-        return 0;
+        return SDL_FALSE;
     }
     /* We are assuming Linux is using evdev which should trump the old
      * joystick methods. */
     if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) {
-        return 1;
+        return SDL_TRUE;
     }
 #endif
-    return 0;
+    return SDL_FALSE;
 }
 
 /*

+ 6 - 6
src/haptic/windows/SDL_windowshaptic.c

@@ -180,24 +180,24 @@ int SDL_SYS_HapticMouse(void)
 /*
  * Checks to see if a joystick has haptic features.
  */
-int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
 {
     if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
-        return 0;
+        return SDL_FALSE;
     }
     if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
-        return 1;
+        return SDL_TRUE;
     }
-    return 0;
+    return SDL_FALSE;
 }
 
 /*
  * Checks to see if the haptic device and joystick are in reality the same.
  */
-int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
+SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
 {
     if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
-        return 0;
+        return SDL_FALSE;
     }
     return SDL_DINPUT_JoystickSameHaptic(haptic, joystick);
 }