mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
Fix off-by-one bug in joypad ID handling.
This commit is contained in:
parent
452f3f4c43
commit
47c9fda3c9
@ -31,8 +31,6 @@ extern "C" {
|
||||
#define SNES_DEVICE_ID_JOYPAD_L 10
|
||||
#define SNES_DEVICE_ID_JOYPAD_R 11
|
||||
|
||||
#define SNES_DEVICE_ID_MAX_JOYPAD_BUTTON (SNES_DEVICE_ID_JOYPAD_R)
|
||||
|
||||
#define SNES_DEVICE_ID_MOUSE_X 0
|
||||
#define SNES_DEVICE_ID_MOUSE_Y 1
|
||||
#define SNES_DEVICE_ID_MOUSE_LEFT 2
|
||||
|
@ -1036,7 +1036,7 @@ static void set_keybind_digital(uint64_t state, uint32_t system_joypad_id, uint3
|
||||
|
||||
if(CTRL_LEFT(state) | CTRL_LSTICK_LEFT(state))
|
||||
{
|
||||
for(uint32_t i = 0; i < (SNES_DEVICE_ID_MAX_JOYPAD_BUTTON+1) && !found_keybind; i++)
|
||||
for(uint32_t i = 0; i < SSNES_FIRST_META_KEY && !found_keybind; i++)
|
||||
{
|
||||
if(g_settings.input.binds[currently_selected_controller_menu][i].joykey == system_joypad_id)
|
||||
{
|
||||
@ -1051,13 +1051,13 @@ static void set_keybind_digital(uint64_t state, uint32_t system_joypad_id, uint3
|
||||
|
||||
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
|
||||
{
|
||||
for(uint32_t i = 0; i < (SNES_DEVICE_ID_MAX_JOYPAD_BUTTON+1) && !found_keybind; i++)
|
||||
for(uint32_t i = 0; i < SSNES_FIRST_META_KEY && !found_keybind; i++)
|
||||
{
|
||||
if(g_settings.input.binds[currently_selected_controller_menu][i].joykey == system_joypad_id)
|
||||
{
|
||||
found_keybind = true;
|
||||
|
||||
if(g_settings.input.binds[currently_selected_controller_menu][i].id < SNES_DEVICE_ID_MAX_JOYPAD_BUTTON)
|
||||
if(g_settings.input.binds[currently_selected_controller_menu][i].id < SSNES_FIRST_META_KEY - 1)
|
||||
g_settings.input.binds[currently_selected_controller_menu][i].id++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user