SDL: Fix joysticks returning invalid device IDs

From dbf14df80ffe9edef36ec24505827baf86299148 Mon Sep 17 00:00:00 2001
From: zoey jodon <[EMAIL REDACTED]>
Date: Mon, 20 Nov 2023 13:26:20 -0500
Subject: [PATCH] Fix joysticks returning invalid device IDs

---
 src/joystick/haiku/SDL_haikujoystick.cc | 2 +-
 src/joystick/n3ds/SDL_sysjoystick.c     | 2 +-
 src/joystick/ps2/SDL_sysjoystick.c      | 2 +-
 src/joystick/psp/SDL_sysjoystick.c      | 2 +-
 src/joystick/vita/SDL_sysjoystick.c     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc
index 49e4d69fefbd..5c07affb2f0d 100644
--- a/src/joystick/haiku/SDL_haikujoystick.cc
+++ b/src/joystick/haiku/SDL_haikujoystick.cc
@@ -113,7 +113,7 @@ extern "C"
 /* Function to perform the mapping from device index to the instance id for this index */
     static SDL_JoystickID HAIKU_JoystickGetDeviceInstanceID(int device_index)
     {
-        return device_index;
+        return device_index + 1;
     }
 
     static void HAIKU_JoystickClose(SDL_Joystick *joystick);
diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c
index 5e17010f0058..e78d5a735e94 100644
--- a/src/joystick/n3ds/SDL_sysjoystick.c
+++ b/src/joystick/n3ds/SDL_sysjoystick.c
@@ -73,7 +73,7 @@ static SDL_JoystickGUID N3DS_JoystickGetDeviceGUID(int device_index)
 
 static SDL_JoystickID N3DS_JoystickGetDeviceInstanceID(int device_index)
 {
-    return device_index;
+    return device_index + 1;
 }
 
 static int N3DS_JoystickOpen(SDL_Joystick *joystick, int device_index)
diff --git a/src/joystick/ps2/SDL_sysjoystick.c b/src/joystick/ps2/SDL_sysjoystick.c
index 45ad16a6e836..e5f6201cbfbd 100644
--- a/src/joystick/ps2/SDL_sysjoystick.c
+++ b/src/joystick/ps2/SDL_sysjoystick.c
@@ -179,7 +179,7 @@ static SDL_JoystickGUID PS2_JoystickGetDeviceGUID(int device_index)
 /* Function to get the current instance id of the joystick located at device_index */
 static SDL_JoystickID PS2_JoystickGetDeviceInstanceID(int device_index)
 {
-    return device_index;
+    return device_index + 1;
 }
 
 /*  Function to open a joystick for use.
diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c
index 8db17dcec557..a3812fd2db37 100644
--- a/src/joystick/psp/SDL_sysjoystick.c
+++ b/src/joystick/psp/SDL_sysjoystick.c
@@ -140,7 +140,7 @@ static SDL_JoystickGUID PSP_JoystickGetDeviceGUID(int device_index)
 /* Function to perform the mapping from device index to the instance id for this index */
 static SDL_JoystickID PSP_JoystickGetDeviceInstanceID(int device_index)
 {
-    return device_index;
+    return device_index + 1;
 }
 
 /* Function to open a joystick for use.
diff --git a/src/joystick/vita/SDL_sysjoystick.c b/src/joystick/vita/SDL_sysjoystick.c
index cf0585f61a3c..f426d3aa9370 100644
--- a/src/joystick/vita/SDL_sysjoystick.c
+++ b/src/joystick/vita/SDL_sysjoystick.c
@@ -151,7 +151,7 @@ void VITA_JoystickDetect()
 /* Function to perform the mapping from device index to the instance id for this index */
 SDL_JoystickID VITA_JoystickGetDeviceInstanceID(int device_index)
 {
-    return device_index;
+    return device_index + 1;
 }
 
 const char *VITA_JoystickGetDeviceName(int index)