Created
February 29, 2012 17:53
-
-
Save Themaister/1942912 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From c1eed92b019561d35742bf6e6be1a085bebe0de7 Mon Sep 17 00:00:00 2001 | |
| From: Themaister <[email protected]> | |
| Date: Wed, 29 Feb 2012 18:52:13 +0100 | |
| Subject: [PATCH] Fix off-by-one bug in joypad ID handling. | |
| --- | |
| libsnes.hpp | 2 -- | |
| ps3/menu.c | 6 +++--- | |
| 2 files changed, 3 insertions(+), 5 deletions(-) | |
| diff --git a/libsnes.hpp b/libsnes.hpp | |
| index bd696b4..0116d4f 100755 | |
| --- a/libsnes.hpp | |
| +++ b/libsnes.hpp | |
| @@ -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 | |
| diff --git a/ps3/menu.c b/ps3/menu.c | |
| index 3dbb3d4..73f01b9 100644 | |
| --- a/ps3/menu.c | |
| +++ b/ps3/menu.c | |
| @@ -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 && !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 && !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) | |
| g_settings.input.binds[currently_selected_controller_menu][i].id++; | |
| } | |
| } | |
| -- | |
| 1.7.9.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment