Add parameter to function signature of menu_iterate

This commit is contained in:
twinaphex 2015-08-21 04:33:55 +02:00
parent 180cddfc35
commit 8bf28544ef
5 changed files with 22 additions and 11 deletions

View File

@ -100,7 +100,7 @@ bool menu_load_content(enum rarch_core_type type)
if (disp)
disp->msg_force = true;
menu_iterate(MENU_ACTION_NOOP);
menu_iterate(true, MENU_ACTION_NOOP);
menu_iterate_main_render();
if (!(main_load_content(0, NULL, NULL, menu_environment_get,

View File

@ -165,13 +165,14 @@ void *menu_init(const void *data);
/**
* menu_iterate:
* @render_this_frame : Render this frame or not
* @action : Associated action for this frame
*
* Runs RetroArch menu for one frame.
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int menu_iterate(unsigned action);
int menu_iterate(bool render_this_frame, unsigned action);
int menu_iterate_main_render(void);

View File

@ -423,7 +423,7 @@ static enum action_iterate_type action_iterate_type(uint32_t hash)
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int menu_iterate(unsigned action)
int menu_iterate(bool render_this_frame, unsigned action)
{
menu_entry_t entry;
enum action_iterate_type iterate_type;
@ -455,12 +455,16 @@ int menu_iterate(unsigned action)
iterate_type = action_iterate_type(hash);
if (action != MENU_ACTION_NOOP || menu_entries_needs_refresh() || menu_display_update_pending())
{
if (render_this_frame)
menu->state.fb_is_dirty = true;
}
switch (iterate_type)
{
case ITERATE_TYPE_HELP:
ret = action_iterate_help(menu->state.msg, sizeof(menu->state.msg), label);
if (render_this_frame)
menu->state.do_render = true;
menu->state.pop_selected = NULL;
menu->state.do_messagebox = true;
@ -474,16 +478,19 @@ int menu_iterate(unsigned action)
menu_list_pop_stack(menu_list);
else
menu->state.do_messagebox = true;
if (render_this_frame)
menu->state.do_render = true;
break;
case ITERATE_TYPE_VIEWPORT:
ret = action_iterate_menu_viewport(menu->state.msg, sizeof(menu->state.msg), label, action, hash);
if (render_this_frame)
menu->state.do_render = true;
menu->state.do_messagebox = true;
break;
case ITERATE_TYPE_INFO:
ret = action_iterate_info(menu->state.msg, sizeof(menu->state.msg), label);
menu->state.pop_selected = &nav->selection_ptr;
if (render_this_frame)
menu->state.do_render = true;
menu->state.do_messagebox = true;
menu->state.do_pop_stack = true;
@ -507,6 +514,7 @@ int menu_iterate(unsigned action)
goto end;
menu->state.do_post_iterate = true;
if (render_this_frame)
menu->state.do_render = true;
/* Have to defer it so we let settings refresh. */

View File

@ -1039,7 +1039,7 @@ int rarch_main_iterate(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
if (menu_iterate(menu_input_frame(input, trigger_input)) == -1)
if (menu_iterate(true, menu_input_frame(input, trigger_input)) == -1)
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
if (!input && settings->menu.pause_libretro)

View File

@ -62,6 +62,8 @@ static void rarch_draw(void)
bool iterate = iterate_observer && !(rarch_main_is_paused());
int ret = iterate ? rarch_main_iterate() : 0;
if (ret == 0)
menu_iterate(false, MENU_ACTION_NOOP);
rarch_main_data_iterate();
if (ret == -1)
@ -478,7 +480,7 @@ static int ui_companion_cocoatouch_iterate(void *data, unsigned action)
static int ui_companion_cocoatouch_iterate_menu(void *data, unsigned action)
{
menu_iterate(MENU_ACTION_NOOP);
menu_iterate(false, MENU_ACTION_NOOP);
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
return 0;
}