Return an error if the joystick index isn't 0 on Android
authorSam Lantinga <slouken@libsdl.org>
Mon, 26 Nov 2012 22:09:34 -0800
changeset 6696 73e2ad636f6e
parent 6695 ec21e81c62aa
child 6697 dbda91031456
Return an error if the joystick index isn't 0 on Android
src/joystick/android/SDL_sysjoystick.c
--- a/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 22:02:01 2012 -0800
+++ b/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 22:09:34 2012 -0800
@@ -64,13 +64,18 @@
    It returns 0, or -1 if there is an error.
  */
 int
-SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index)
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
 {
-    joystick->nbuttons = 0;
-    joystick->nhats = 0;
-    joystick->nballs = 0;
-    joystick->naxes = 3;
-    return 0;
+    if (device_index == 0) {
+        joystick->nbuttons = 0;
+        joystick->nhats = 0;
+        joystick->nballs = 0;
+        joystick->naxes = 3;
+        return 0;
+	} else {
+		SDL_SetError("No joystick available with that index");
+		return (-1);
+	}
 }