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 669673e2ad636f6e
parent 6695 ec21e81c62aa
child 6697 dbda91031456
Return an error if the joystick index isn't 0 on Android
src/joystick/android/SDL_sysjoystick.c
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 22:02:01 2012 -0800
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 22:09:34 2012 -0800
     1.3 @@ -64,13 +64,18 @@
     1.4     It returns 0, or -1 if there is an error.
     1.5   */
     1.6  int
     1.7 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index)
     1.8 +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
     1.9  {
    1.10 -    joystick->nbuttons = 0;
    1.11 -    joystick->nhats = 0;
    1.12 -    joystick->nballs = 0;
    1.13 -    joystick->naxes = 3;
    1.14 -    return 0;
    1.15 +    if (device_index == 0) {
    1.16 +        joystick->nbuttons = 0;
    1.17 +        joystick->nhats = 0;
    1.18 +        joystick->nballs = 0;
    1.19 +        joystick->naxes = 3;
    1.20 +        return 0;
    1.21 +	} else {
    1.22 +		SDL_SetError("No joystick available with that index");
    1.23 +		return (-1);
    1.24 +	}
    1.25  }
    1.26  
    1.27