Linux input driver fix 8+ joypads (#15374)

This commit is contained in:
sonninnos 2023-06-14 05:43:45 +03:00 committed by GitHub
parent 20e7107598
commit c4f43ff28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View File

@ -273,7 +273,7 @@ static int16_t dinput_joypad_state(
if (!pad || !pad->joypad)
return 0;
if (port_idx >= DEFAULT_MAX_PADS)
if (port_idx >= MAX_USERS)
return 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)

View File

@ -298,7 +298,7 @@ static int32_t linuxraw_joypad_button(unsigned port, uint16_t joykey)
{
const struct linuxraw_joypad *pad = (const struct linuxraw_joypad*)
&linuxraw_pads[port];
if (port >= DEFAULT_MAX_PADS)
if (port >= MAX_USERS)
return 0;
if (joykey < NUM_BUTTONS)
return (BIT32_GET(pad->buttons, joykey));
@ -356,7 +356,7 @@ static int16_t linuxraw_joypad_state(
const struct linuxraw_joypad *pad = (const struct linuxraw_joypad*)
&linuxraw_pads[port_idx];
if (port_idx >= DEFAULT_MAX_PADS)
if (port_idx >= MAX_USERS)
return 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)

View File

@ -374,7 +374,7 @@ static int32_t sdl_joypad_button(unsigned port, uint16_t joykey)
sdl_joypad_t *pad = (sdl_joypad_t*)&sdl_pads[port];
if (!pad || !pad->joypad)
return 0;
if (port >= DEFAULT_MAX_PADS)
if (port >= MAX_USERS)
return 0;
return sdl_joypad_button_state(pad, port, joykey);
}
@ -424,7 +424,7 @@ static int16_t sdl_joypad_state(
if (!pad || !pad->joypad)
return 0;
if (port_idx >= DEFAULT_MAX_PADS)
if (port_idx >= MAX_USERS)
return 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)

View File

@ -672,7 +672,7 @@ static int32_t udev_joypad_button(unsigned port, uint16_t joykey)
{
const struct udev_joypad *pad = (const struct udev_joypad*)
&udev_pads[port];
if (port >= DEFAULT_MAX_PADS)
if (port >= MAX_USERS)
return 0;
return udev_joypad_button_state(pad, port, joykey);
}
@ -736,7 +736,7 @@ static int16_t udev_joypad_state(
int16_t ret = 0;
uint16_t port_idx = joypad_info->joy_idx;
if (port_idx < DEFAULT_MAX_PADS)
if (port_idx < MAX_USERS)
{
unsigned i;
const struct udev_joypad *pad = (const struct udev_joypad*)

View File

@ -80,7 +80,7 @@
#define DEFAULT_MAX_PADS 4
#elif defined(HAVE_ODROIDGO2)
#define DEFAULT_MAX_PADS 8
#elif defined(__linux__) || (defined(BSD) && !defined(__MACH__))
#elif (defined(BSD) && !defined(__MACH__))
#define DEFAULT_MAX_PADS 8
#elif defined(__QNX__)
#define DEFAULT_MAX_PADS 8