(Menu) Toggle functions should trigger video state change since

a label is likely to be updated because of it
This commit is contained in:
twinaphex 2015-03-08 17:16:21 +01:00
parent beb68d559d
commit 581bc22e19
2 changed files with 49 additions and 1 deletions

View File

@ -484,6 +484,11 @@ struct runloop
{ {
bool dirty; bool dirty;
} framebuf; } framebuf;
struct
{
bool active;
} action;
} menu; } menu;
} current; } current;
} video; } video;

View File

@ -39,10 +39,12 @@ static int shader_action_parameter_toggle(unsigned type, const char *label,
{ {
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
param->current -= param->step; param->current -= param->step;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
param->current += param->step; param->current += param->step;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
default: default:
@ -74,10 +76,12 @@ static int shader_action_parameter_preset_toggle(unsigned type, const char *labe
{ {
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
param->current -= param->step; param->current -= param->step;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
param->current += param->step; param->current += param->step;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
default: default:
@ -105,6 +109,7 @@ static int action_toggle_cheat(unsigned type, const char *label,
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
cheat->cheats[idx].state = !cheat->cheats[idx].state; cheat->cheats[idx].state = !cheat->cheats[idx].state;
cheat_manager_update(cheat, idx); cheat_manager_update(cheat, idx);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }
@ -122,11 +127,17 @@ static int action_toggle_input_desc(unsigned type, const char *label,
{ {
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0) if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0)
{
g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]--; g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]--;
g_runloop.frames.video.current.menu.action.active = true;
}
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND) if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND)
{
g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++; g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++;
g_runloop.frames.video.current.menu.action.active = true;
}
break; break;
} }
@ -141,10 +152,14 @@ static int action_toggle_save_state(unsigned type, const char *label,
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
/* Slot -1 is (auto) slot. */ /* Slot -1 is (auto) slot. */
if (g_settings.state_slot >= 0) if (g_settings.state_slot >= 0)
{
g_settings.state_slot--; g_settings.state_slot--;
g_runloop.frames.video.current.menu.action.active = true;
}
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
g_settings.state_slot++; g_settings.state_slot++;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }
@ -170,15 +185,22 @@ static int action_toggle_scroll(unsigned type, const char *label,
menu->navigation.selection_ptr - fast_scroll_speed, true); menu->navigation.selection_ptr - fast_scroll_speed, true);
else else
menu_navigation_clear(&menu->navigation, false); menu_navigation_clear(&menu->navigation, false);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
if (menu->navigation.selection_ptr + fast_scroll_speed < (menu_list_get_size(menu->menu_list))) if (menu->navigation.selection_ptr + fast_scroll_speed < (menu_list_get_size(menu->menu_list)))
{
menu_navigation_set(&menu->navigation, menu_navigation_set(&menu->navigation,
menu->navigation.selection_ptr + fast_scroll_speed, true); menu->navigation.selection_ptr + fast_scroll_speed, true);
g_runloop.frames.video.current.menu.action.active = true;
}
else else
{ {
if ((menu_list_get_size(menu->menu_list) > 0)) if ((menu_list_get_size(menu->menu_list) > 0))
menu_navigation_set_last(&menu->navigation); {
menu_navigation_set_last(&menu->navigation);
g_runloop.frames.video.current.menu.action.active = true;
}
} }
break; break;
} }
@ -235,9 +257,12 @@ static int action_toggle_mainmenu(unsigned type, const char *label,
"", "",
"", "",
0); 0);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case 2: case 2:
action_toggle_scroll(0, "", action); action_toggle_scroll(0, "", action);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case 0: case 0:
default: default:
@ -276,6 +301,8 @@ static int action_toggle_shader_scale_pass(unsigned type, const char *label,
shader_pass->fbo.valid = current_scale; shader_pass->fbo.valid = current_scale;
shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale; shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale;
g_runloop.frames.video.current.menu.action.active = true;
} }
break; break;
} }
@ -308,6 +335,8 @@ static int action_toggle_shader_filter_pass(unsigned type, const char *label,
{ {
unsigned delta = (action == MENU_ACTION_LEFT) ? 2 : 1; unsigned delta = (action == MENU_ACTION_LEFT) ? 2 : 1;
shader_pass->filter = ((shader_pass->filter + delta) % 3); shader_pass->filter = ((shader_pass->filter + delta) % 3);
g_runloop.frames.video.current.menu.action.active = true;
} }
break; break;
} }
@ -344,11 +373,13 @@ static int action_toggle_cheat_num_passes(unsigned type, const char *label,
if (cheat->size) if (cheat->size)
new_size = cheat->size - 1; new_size = cheat->size - 1;
menu->need_refresh = true; menu->need_refresh = true;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
new_size = cheat->size + 1; new_size = cheat->size + 1;
menu->need_refresh = true; menu->need_refresh = true;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }
@ -377,12 +408,14 @@ static int action_toggle_shader_num_passes(unsigned type, const char *label,
if (shader->passes) if (shader->passes)
shader->passes--; shader->passes--;
menu->need_refresh = true; menu->need_refresh = true;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
if ((shader->passes < GFX_MAX_SHADERS)) if ((shader->passes < GFX_MAX_SHADERS))
shader->passes++; shader->passes++;
menu->need_refresh = true; menu->need_refresh = true;
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }
@ -425,12 +458,18 @@ static int action_toggle_video_resolution(unsigned type, const char *label,
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
if (driver.video_data && driver.video_poke && if (driver.video_data && driver.video_poke &&
driver.video_poke->get_video_output_prev) driver.video_poke->get_video_output_prev)
{
driver.video_poke->get_video_output_prev(driver.video_data); driver.video_poke->get_video_output_prev(driver.video_data);
g_runloop.frames.video.current.menu.action.active = true;
}
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
if (driver.video_data && driver.video_poke && if (driver.video_data && driver.video_poke &&
driver.video_poke->get_video_output_next) driver.video_poke->get_video_output_next)
{
driver.video_poke->get_video_output_next(driver.video_data); driver.video_poke->get_video_output_next(driver.video_data);
g_runloop.frames.video.current.menu.action.active = true;
}
break; break;
} }
#endif #endif
@ -449,10 +488,12 @@ static int core_setting_toggle(unsigned type, const char *label,
{ {
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
core_option_prev(g_extern.system.core_options, idx); core_option_prev(g_extern.system.core_options, idx);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
core_option_next(g_extern.system.core_options, idx); core_option_next(g_extern.system.core_options, idx);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }
@ -466,9 +507,11 @@ static int disk_options_disk_idx_toggle(unsigned type, const char *label,
{ {
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
rarch_main_command(RARCH_CMD_DISK_PREV); rarch_main_command(RARCH_CMD_DISK_PREV);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
rarch_main_command(RARCH_CMD_DISK_NEXT); rarch_main_command(RARCH_CMD_DISK_NEXT);
g_runloop.frames.video.current.menu.action.active = true;
break; break;
} }