From 379614ca1c7299c58a9214a3066e470c7f9fe688 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 4 Mar 2012 14:51:43 +0100 Subject: [PATCH] Attempt to fix set_keybind_digital. --- ps3/menu.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/ps3/menu.c b/ps3/menu.c index 6ebeb2afc0..0fb16230fe 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -1099,18 +1099,15 @@ static void select_directory(uint32_t menu_id) static void set_keybind_digital(uint64_t state, uint32_t system_joypad_id, uint32_t default_snes_joypad_id) { - bool found_keybind = false; - if(CTRL_LEFT(state) | CTRL_LSTICK_LEFT(state)) { - for(uint32_t i = 0; i < SSNES_FIRST_META_KEY && !found_keybind; i++) + for(uint32_t i = 1; i < SSNES_FIRST_META_KEY; 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 > 0) - g_settings.input.binds[currently_selected_controller_menu][i].id--; + g_settings.input.binds[currently_selected_controller_menu][i].joykey &= ~system_joypad_id; + g_settings.input.binds[currently_selected_controller_menu][i - 1].joykey |= system_joypad_id; + break; } } set_delay = DELAY_MEDIUM; @@ -1118,14 +1115,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 < SSNES_FIRST_META_KEY && !found_keybind; i++) + for(uint32_t i = 0; i < SSNES_FIRST_META_KEY - 1; 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 < SSNES_FIRST_META_KEY - 1) - g_settings.input.binds[currently_selected_controller_menu][i].id++; + g_settings.input.binds[currently_selected_controller_menu][i].joykey &= ~system_joypad_id; + g_settings.input.binds[currently_selected_controller_menu][i + 1].joykey |= system_joypad_id; + break; } } set_delay = DELAY_MEDIUM; @@ -1133,7 +1129,6 @@ static void set_keybind_digital(uint64_t state, uint32_t system_joypad_id, uint3 if(CTRL_START(state)) { - g_settings.input.binds[currently_selected_controller_menu][default_snes_joypad_id].id = default_snes_joypad_id; g_settings.input.binds[currently_selected_controller_menu][default_snes_joypad_id].joykey = default_keybind_lut[default_snes_joypad_id]; set_delay = DELAY_MEDIUM; }