summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]Xcode/SDL/SDL.xcodeproj/project.pbxproj0
-rw-r--r--src/joystick/SDL_joystick.c7
-rw-r--r--src/joystick/hidapi/SDL_hidapi_xbox360.c4
-rw-r--r--src/joystick/hidapi/SDL_hidapi_xbox360w.c4
4 files changed, 9 insertions, 6 deletions
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 3c0ed66eb..3c0ed66eb 100644..100755
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 298a2c646..d70c77908 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -160,9 +160,6 @@ SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
int device_index;
int existing_player_index;
- if (player_index < 0) {
- return SDL_FALSE;
- }
if (player_index >= SDL_joystick_player_count) {
SDL_JoystickID *new_players = (SDL_JoystickID *)SDL_realloc(SDL_joystick_players, (player_index + 1)*sizeof(*SDL_joystick_players));
if (!new_players) {
@@ -184,7 +181,9 @@ SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
SDL_joystick_players[existing_player_index] = -1;
}
- SDL_joystick_players[player_index] = instance_id;
+ if (player_index >= 0) {
+ SDL_joystick_players[player_index] = instance_id;
+ }
/* Update the driver with the new index */
device_index = SDL_JoystickGetDeviceIndexFromInstanceID(instance_id);
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c
index 141d7fd09..7a12258a8 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c
@@ -133,7 +133,9 @@ HIDAPI_DriverXbox360_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_Joystic
if (!device->dev) {
return;
}
- SetSlotLED(device->dev, (player_index % 4));
+ if (player_index >= 0) {
+ SetSlotLED(device->dev, (player_index % 4));
+ }
}
static SDL_bool
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
index b77566951..25dbf35ac 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
@@ -131,7 +131,9 @@ HIDAPI_DriverXbox360W_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_Joysti
if (!device->dev) {
return;
}
- SetSlotLED(device->dev, (player_index % 4));
+ if (player_index >= 0) {
+ SetSlotLED(device->dev, (player_index % 4));
+ }
}
static SDL_bool