mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
joystick/vita: fix index value use returned by SDL_GetJoystickInstanceID
Reference issue: https://github.com/libsdl-org/SDL/issues/7051
This commit is contained in:
@@ -226,7 +226,7 @@ static void VITA_JoystickUpdate(SDL_Joystick *joystick)
|
|||||||
SceCtrlData *pad = NULL;
|
SceCtrlData *pad = NULL;
|
||||||
Uint64 timestamp = SDL_GetTicksNS();
|
Uint64 timestamp = SDL_GetTicksNS();
|
||||||
|
|
||||||
int index = (int)SDL_GetJoystickInstanceID(joystick);
|
int index = (int)SDL_GetJoystickInstanceID(joystick) - 1;
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
pad = &pad0;
|
pad = &pad0;
|
||||||
@@ -319,7 +319,7 @@ SDL_JoystickGUID VITA_JoystickGetDeviceGUID(int device_index)
|
|||||||
|
|
||||||
static int VITA_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
static int VITA_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||||
{
|
{
|
||||||
int index = (int)SDL_GetJoystickInstanceID(joystick);
|
int index = (int)SDL_GetJoystickInstanceID(joystick) - 1;
|
||||||
SceCtrlActuator act;
|
SceCtrlActuator act;
|
||||||
SDL_zero(act);
|
SDL_zero(act);
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ static Uint32 VITA_JoystickGetCapabilities(SDL_Joystick *joystick)
|
|||||||
|
|
||||||
static int VITA_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
static int VITA_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||||
{
|
{
|
||||||
int index = (int)SDL_GetJoystickInstanceID(joystick);
|
int index = (int)SDL_GetJoystickInstanceID(joystick) - 1;
|
||||||
if (sceCtrlSetLightBar(ext_port_map[index], red, green, blue) < 0) {
|
if (sceCtrlSetLightBar(ext_port_map[index], red, green, blue) < 0) {
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user