Attempt to fix set_keybind_digital.

This commit is contained in:
Themaister 2012-03-04 14:51:43 +01:00
parent 24e807f520
commit 379614ca1c

View File

@ -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;
}