RetroArch/menu/menu_iterate.c

581 lines
18 KiB
C
Raw Normal View History

2015-02-27 02:05:19 +00:00
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
2015-06-13 17:12:10 +00:00
#include <compat/strl.h>
2015-02-27 02:05:19 +00:00
#include <file/file_path.h>
2015-03-15 03:52:46 +00:00
#include <retro_inline.h>
#include "menu.h"
#include "menu_hash.h"
#include "menu_setting.h"
#include "menu_navigation.h"
#include "../general.h"
#include "../input/input_common.h"
#include "../input/input_autodetect.h"
2015-02-27 02:05:19 +00:00
2015-05-18 20:26:00 +00:00
static int action_iterate_help(char *s, size_t len, const char *label)
2015-02-27 02:05:19 +00:00
{
unsigned i;
2015-07-08 03:45:43 +00:00
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
2015-07-08 03:45:43 +00:00
switch (menu->help_screen_type)
2015-02-27 02:05:19 +00:00
{
case MENU_HELP_WELCOME:
2015-07-08 03:45:43 +00:00
{
static int64_t timeout_end;
int64_t timeout;
static bool timer_begin = false;
static bool timer_end = false;
int64_t current = rarch_get_time_usec();
if (!timer_begin)
{
timeout_end = rarch_get_time_usec() +
3 /* seconds */ * 1000000;
timer_begin = true;
timer_end = false;
}
timeout = (timeout_end - current) / 1000000;
menu_hash_get_help(MENU_LABEL_WELCOME_TO_RETROARCH,
s, len);
if (!timer_end && timeout <= 0)
{
timer_end = true;
timer_begin = false;
timeout_end = 0;
menu->help_screen_type = MENU_HELP_NONE;
return 1;
}
}
break;
case MENU_HELP_CONTROLS:
{
char s2[PATH_MAX_LENGTH];
const unsigned binds[] = {
RETRO_DEVICE_ID_JOYPAD_UP,
RETRO_DEVICE_ID_JOYPAD_DOWN,
RETRO_DEVICE_ID_JOYPAD_A,
RETRO_DEVICE_ID_JOYPAD_B,
RETRO_DEVICE_ID_JOYPAD_SELECT,
2015-07-17 19:50:51 +00:00
RETRO_DEVICE_ID_JOYPAD_START,
RARCH_MENU_TOGGLE,
RARCH_QUIT_KEY,
RETRO_DEVICE_ID_JOYPAD_X,
RETRO_DEVICE_ID_JOYPAD_Y,
};
2015-07-08 03:45:43 +00:00
char desc[ARRAY_SIZE(binds)][64] = {{0}};
2015-02-27 02:05:19 +00:00
2015-07-08 03:45:43 +00:00
for (i = 0; i < ARRAY_SIZE(binds); i++)
{
const struct retro_keybind *keybind = (const struct retro_keybind*)
&settings->input.binds[0][binds[i]];
const struct retro_keybind *auto_bind = (const struct retro_keybind*)
input_get_auto_bind(0, binds[i]);
2015-02-27 02:05:19 +00:00
2015-07-08 03:45:43 +00:00
input_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i]));
}
2015-02-27 02:05:19 +00:00
menu_hash_get_help(MENU_LABEL_VALUE_MENU_CONTROLS_PROLOG,
s2, sizeof(s2));
2015-07-08 03:45:43 +00:00
snprintf(s, len,
"%s"
2015-07-17 13:53:02 +00:00
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
"[%s]: "
"%-20s\n"
2015-07-17 19:50:51 +00:00
"[%s]: "
"%-20s\n",
s2,
2015-07-17 13:53:02 +00:00
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP), desc[0],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN), desc[1],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM), desc[2],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), desc[3],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO), desc[4],
2015-07-17 19:50:51 +00:00
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_START), desc[5],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU), desc[6],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT), desc[7],
menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD), desc[8]
);
2015-07-08 03:45:43 +00:00
}
break;
2015-07-18 09:29:37 +00:00
case MENU_HELP_WHAT_IS_A_CORE:
menu_hash_get_help(MENU_LABEL_VALUE_WHAT_IS_A_CORE_DESC,
s, len);
break;
2015-07-17 20:11:24 +00:00
case MENU_HELP_LOADING_CONTENT:
menu_hash_get_help(MENU_LABEL_LOAD_CONTENT,
s, len);
break;
2015-07-18 12:01:37 +00:00
case MENU_HELP_CHANGE_VIRTUAL_GAMEPAD:
menu_hash_get_help(MENU_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC,
s, len);
break;
2015-07-18 12:57:20 +00:00
case MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING:
menu_hash_get_help(MENU_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC,
s, len);
break;
case MENU_HELP_SCANNING_CONTENT:
menu_hash_get_help(MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC,
s, len);
break;
case MENU_HELP_EXTRACT:
2015-07-17 16:22:59 +00:00
menu_hash_get_help(MENU_LABEL_VALUE_EXTRACTING_PLEASE_WAIT,
s, len);
2015-07-08 03:45:43 +00:00
break;
case MENU_HELP_NONE:
2015-07-08 03:45:43 +00:00
default:
break;
}
2015-02-27 02:05:19 +00:00
2015-07-18 12:57:20 +00:00
return 0;
2015-02-27 02:05:19 +00:00
}
2015-05-18 20:26:00 +00:00
static int action_iterate_info(char *s, size_t len, const char *label)
2015-02-27 02:05:19 +00:00
{
2015-08-17 19:58:05 +00:00
uint32_t label_hash = 0;
2015-08-17 19:53:08 +00:00
menu_file_list_cbs_t *cbs = NULL;
menu_list_t *menu_list = menu_list_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
size_t i = menu_navigation_get_selection(nav);
2015-08-17 19:53:08 +00:00
2015-06-15 15:19:58 +00:00
if (!menu_list)
2015-02-27 02:05:19 +00:00
return 0;
2015-08-17 19:53:08 +00:00
cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);
2015-02-27 02:05:19 +00:00
2015-08-17 19:53:08 +00:00
if (cbs->setting)
2015-02-27 02:05:19 +00:00
{
2015-08-17 20:10:12 +00:00
char needle[PATH_MAX_LENGTH];
strlcpy(needle, cbs->setting->name, sizeof(needle));
label_hash = menu_hash_calculate(needle);
2015-02-27 02:05:19 +00:00
}
2015-08-17 19:58:05 +00:00
return menu_hash_get_help(label_hash, s, len);
2015-02-27 02:05:19 +00:00
}
2015-06-22 00:19:29 +00:00
static int action_iterate_menu_viewport(char *s, size_t len,
const char *label, unsigned action, uint32_t hash)
2015-02-27 02:05:19 +00:00
{
int stride_x = 1, stride_y = 1;
menu_displaylist_info_t info = {0};
2015-02-27 02:05:19 +00:00
struct retro_game_geometry *geom = NULL;
2015-03-23 02:09:30 +00:00
const char *base_msg = NULL;
unsigned type = 0;
video_viewport_t *custom = video_viewport_get_custom();
2015-06-15 00:37:32 +00:00
menu_display_t *disp = menu_display_get_ptr();
2015-06-13 14:22:05 +00:00
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
2015-03-23 02:09:30 +00:00
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
2015-03-20 20:22:38 +00:00
2015-06-15 15:19:58 +00:00
if (!menu_list)
2015-02-27 02:05:19 +00:00
return -1;
menu_list_get_last_stack(menu_list, NULL, NULL, &type, NULL);
2015-02-27 02:05:19 +00:00
geom = (struct retro_game_geometry*)&av_info->geometry;
2015-02-27 02:05:19 +00:00
2015-03-20 20:22:38 +00:00
if (settings->video.scale_integer)
2015-02-27 02:05:19 +00:00
{
stride_x = geom->base_width;
stride_y = geom->base_height;
}
switch (action)
{
case MENU_ACTION_UP:
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
{
2015-03-23 02:09:30 +00:00
custom->y -= stride_y;
2015-02-27 02:05:19 +00:00
custom->height += stride_y;
}
else if (custom->height >= (unsigned)stride_y)
custom->height -= stride_y;
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
break;
case MENU_ACTION_DOWN:
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
{
custom->y += stride_y;
if (custom->height >= (unsigned)stride_y)
custom->height -= stride_y;
}
else
custom->height += stride_y;
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
break;
case MENU_ACTION_LEFT:
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
{
2015-03-23 02:09:30 +00:00
custom->x -= stride_x;
2015-02-27 02:05:19 +00:00
custom->width += stride_x;
}
else if (custom->width >= (unsigned)stride_x)
custom->width -= stride_x;
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
break;
case MENU_ACTION_RIGHT:
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
{
custom->x += stride_x;
if (custom->width >= (unsigned)stride_x)
custom->width -= stride_x;
}
else
custom->width += stride_x;
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
break;
case MENU_ACTION_CANCEL:
menu_list_flush_stack(menu_list, NULL, 49);
2015-02-27 02:05:19 +00:00
if (hash == MENU_LABEL_CUSTOM_VIEWPORT_2)
2015-02-27 02:05:19 +00:00
{
info.list = menu_list->menu_stack;
info.type = MENU_SETTINGS_CUSTOM_VIEWPORT;
2015-06-13 14:22:05 +00:00
info.directory_ptr = nav->selection_ptr;
2015-05-31 20:40:26 +00:00
menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
2015-02-27 02:05:19 +00:00
}
break;
case MENU_ACTION_OK:
menu_list_flush_stack(menu_list, NULL, 49);
2015-02-27 02:05:19 +00:00
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT
2015-03-20 20:22:38 +00:00
&& !settings->video.scale_integer)
{
info.list = menu_list->menu_stack;
2015-06-21 06:41:36 +00:00
strlcpy(info.label,
menu_hash_to_str(MENU_LABEL_CUSTOM_VIEWPORT_2),
sizeof(info.label));
info.type = 0;
2015-06-13 14:22:05 +00:00
info.directory_ptr = nav->selection_ptr;
2015-05-31 20:40:26 +00:00
menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
}
2015-02-27 02:05:19 +00:00
break;
case MENU_ACTION_START:
2015-03-20 20:22:38 +00:00
if (!settings->video.scale_integer)
2015-02-27 02:05:19 +00:00
{
video_viewport_t vp;
2015-03-22 20:28:50 +00:00
video_driver_viewport_info(&vp);
2015-02-27 02:05:19 +00:00
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
{
2015-03-23 02:09:30 +00:00
custom->width += custom->x;
2015-02-27 02:05:19 +00:00
custom->height += custom->y;
2015-03-23 02:09:30 +00:00
custom->x = 0;
custom->y = 0;
2015-02-27 02:05:19 +00:00
}
else
{
2015-03-23 02:09:30 +00:00
custom->width = vp.full_width - custom->x;
custom->height = vp.full_height - custom->y;
2015-02-27 02:05:19 +00:00
}
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
}
break;
case MENU_ACTION_MESSAGE:
2015-06-15 00:37:32 +00:00
if (disp)
disp->msg_force = true;
2015-02-27 02:05:19 +00:00
break;
default:
break;
}
menu_list_get_last_stack(menu_list, NULL, &label, &type, NULL);
2015-02-27 02:05:19 +00:00
2015-03-20 20:22:38 +00:00
if (settings->video.scale_integer)
2015-02-27 02:05:19 +00:00
{
2015-03-23 02:09:30 +00:00
custom->x = 0;
custom->y = 0;
2015-02-27 02:05:19 +00:00
custom->width = ((custom->width + geom->base_width - 1) /
geom->base_width) * geom->base_width;
custom->height = ((custom->height + geom->base_height - 1) /
geom->base_height) * geom->base_height;
2015-03-23 02:09:30 +00:00
base_msg = "Set scale";
2015-05-18 20:26:00 +00:00
snprintf(s, len, "%s (%4ux%4u, %u x %u scale)",
2015-02-27 02:05:19 +00:00
base_msg,
custom->width, custom->height,
custom->width / geom->base_width,
custom->height / geom->base_height);
}
else
{
2015-06-19 02:46:11 +00:00
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
2015-06-21 06:41:36 +00:00
base_msg = menu_hash_to_str(MENU_LABEL_VALUE_CUSTOM_VIEWPORT_1);
2015-06-19 02:46:11 +00:00
else if (hash == MENU_LABEL_CUSTOM_VIEWPORT_2)
2015-06-21 06:41:36 +00:00
base_msg = menu_hash_to_str(MENU_LABEL_VALUE_CUSTOM_VIEWPORT_2);
2015-02-27 02:05:19 +00:00
2015-05-18 20:26:00 +00:00
snprintf(s, len, "%s (%d, %d : %4ux%4u)",
2015-02-27 02:05:19 +00:00
base_msg, custom->x, custom->y, custom->width, custom->height);
}
if (!custom->width)
custom->width = stride_x;
if (!custom->height)
custom->height = stride_y;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
(float)custom->width / custom->height;
event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
2015-02-27 02:05:19 +00:00
return 0;
}
2015-05-18 19:42:09 +00:00
enum action_iterate_type
{
ITERATE_TYPE_DEFAULT = 0,
ITERATE_TYPE_HELP,
ITERATE_TYPE_INFO,
ITERATE_TYPE_MESSAGE,
ITERATE_TYPE_VIEWPORT,
2015-06-26 16:35:35 +00:00
ITERATE_TYPE_BIND
2015-05-18 19:42:09 +00:00
};
static enum action_iterate_type action_iterate_type(uint32_t hash)
{
switch (hash)
{
case MENU_LABEL_HELP:
2015-07-17 18:33:09 +00:00
case MENU_LABEL_HELP_CONTROLS:
2015-07-18 09:29:37 +00:00
case MENU_LABEL_HELP_WHAT_IS_A_CORE:
2015-07-17 20:11:24 +00:00
case MENU_LABEL_HELP_LOADING_CONTENT:
2015-07-18 12:01:37 +00:00
case MENU_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD:
2015-07-18 12:57:20 +00:00
case MENU_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING:
case MENU_LABEL_HELP_SCANNING_CONTENT:
return ITERATE_TYPE_HELP;
case MENU_LABEL_INFO_SCREEN:
return ITERATE_TYPE_INFO;
case MENU_LABEL_MESSAGE:
return ITERATE_TYPE_MESSAGE;
case MENU_LABEL_CUSTOM_VIEWPORT_1:
case MENU_LABEL_CUSTOM_VIEWPORT_2:
return ITERATE_TYPE_VIEWPORT;
case MENU_LABEL_CUSTOM_BIND:
case MENU_LABEL_CUSTOM_BIND_ALL:
case MENU_LABEL_CUSTOM_BIND_DEFAULTS:
return ITERATE_TYPE_BIND;
}
2015-05-18 19:42:09 +00:00
return ITERATE_TYPE_DEFAULT;
}
2015-08-21 02:16:43 +00:00
/**
* menu_iterate:
* @input : input sample for this frame
* @old_input : input sample of the previous frame
* @trigger_input : difference' input sample - difference
* between 'input' and 'old_input'
*
* Runs RetroArch menu for one frame.
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int menu_iterate(bool render_this_frame, unsigned action)
2015-05-18 19:42:09 +00:00
{
2015-06-12 15:23:31 +00:00
menu_entry_t entry;
2015-05-18 19:42:09 +00:00
enum action_iterate_type iterate_type;
2015-06-25 15:36:31 +00:00
size_t selected;
2015-08-18 01:41:13 +00:00
const char *label = NULL;
2015-05-18 19:42:09 +00:00
int ret = 0;
2015-08-18 01:41:13 +00:00
uint32_t hash = 0;
2015-05-18 19:42:09 +00:00
menu_handle_t *menu = menu_driver_get_ptr();
2015-06-13 14:22:05 +00:00
menu_navigation_t *nav = menu_navigation_get_ptr();
2015-06-15 00:08:25 +00:00
menu_display_t *disp = menu_display_get_ptr();
2015-05-18 19:42:09 +00:00
menu_list_t *menu_list = menu_list_get_ptr();
2015-08-18 01:41:13 +00:00
if (render_this_frame)
menu_animation_update_time();
2015-08-18 01:41:13 +00:00
menu_list_get_last_stack(menu_list, NULL, &label, NULL, NULL);
2015-08-21 02:16:43 +00:00
2015-05-18 19:42:09 +00:00
if (!menu || !menu_list)
2015-05-18 01:37:07 +00:00
return 0;
2015-08-18 01:41:13 +00:00
2015-08-18 01:51:44 +00:00
menu->state.fb_is_dirty = false;
menu->state.do_messagebox = false;
menu->state.do_render = false;
menu->state.do_pop_stack = false;
menu->state.do_post_iterate = false;
menu->state.pop_selected = NULL;
menu->state.msg[0] = '\0';
2015-08-18 01:41:13 +00:00
hash = menu_hash_calculate(label);
2015-05-18 19:42:09 +00:00
iterate_type = action_iterate_type(hash);
2015-05-08 09:11:18 +00:00
if (action != MENU_ACTION_NOOP || menu_entries_needs_refresh() || menu_display_update_pending())
{
if (render_this_frame)
menu->state.fb_is_dirty = true;
}
2015-05-18 19:42:09 +00:00
switch (iterate_type)
{
case ITERATE_TYPE_HELP:
2015-08-18 01:51:44 +00:00
ret = action_iterate_help(menu->state.msg, sizeof(menu->state.msg), label);
if (render_this_frame)
menu->state.do_render = true;
2015-08-18 01:51:44 +00:00
menu->state.pop_selected = NULL;
menu->state.do_messagebox = true;
menu->state.do_pop_stack = true;
menu->state.do_post_iterate = true;
if (ret == 1)
action = MENU_ACTION_OK;
2015-05-18 19:42:09 +00:00
break;
case ITERATE_TYPE_BIND:
2015-08-18 01:51:44 +00:00
if (menu_input_bind_iterate(menu->state.msg, sizeof(menu->state.msg)))
menu_list_pop_stack(menu_list, &nav->selection_ptr);
else
2015-08-18 01:51:44 +00:00
menu->state.do_messagebox = true;
if (render_this_frame)
menu->state.do_render = true;
2015-05-18 19:42:09 +00:00
break;
case ITERATE_TYPE_VIEWPORT:
2015-08-18 01:51:44 +00:00
ret = action_iterate_menu_viewport(menu->state.msg, sizeof(menu->state.msg), label, action, hash);
if (render_this_frame)
menu->state.do_render = true;
2015-08-18 01:51:44 +00:00
menu->state.do_messagebox = true;
2015-05-18 19:42:09 +00:00
break;
case ITERATE_TYPE_INFO:
2015-08-18 01:51:44 +00:00
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;
2015-08-18 01:51:44 +00:00
menu->state.do_messagebox = true;
menu->state.do_pop_stack = true;
menu->state.do_post_iterate = true;
2015-05-18 19:42:09 +00:00
break;
case ITERATE_TYPE_MESSAGE:
2015-08-18 01:51:44 +00:00
strlcpy(menu->state.msg, disp->message_contents, sizeof(menu->state.msg));
menu->state.pop_selected = &nav->selection_ptr;
menu->state.do_messagebox = true;
menu->state.do_pop_stack = true;
2015-05-18 19:42:09 +00:00
break;
case ITERATE_TYPE_DEFAULT:
selected = menu_navigation_get_selection(nav);
2015-06-15 17:36:16 +00:00
/* FIXME: selected > selection_buf->list->size, i don't know why. */
2015-06-15 17:18:06 +00:00
selected = max(min(selected, menu_list_get_size(menu_list)-1), 0);
2015-05-18 19:42:09 +00:00
menu_entry_get(&entry, selected, NULL, false);
2015-05-20 00:50:27 +00:00
ret = menu_entry_action(&entry, selected, (enum menu_action)action);
2015-05-08 09:11:18 +00:00
2015-05-18 19:42:09 +00:00
if (ret)
2015-08-21 01:58:35 +00:00
goto end;
2015-02-27 02:05:19 +00:00
2015-08-18 01:51:44 +00:00
menu->state.do_post_iterate = true;
if (render_this_frame)
menu->state.do_render = true;
2015-02-27 02:05:19 +00:00
2015-05-18 19:42:09 +00:00
/* Have to defer it so we let settings refresh. */
2015-07-08 03:45:43 +00:00
if (menu->push_help_screen)
2015-05-18 19:42:09 +00:00
{
menu_displaylist_info_t info = {0};
2015-05-18 19:42:09 +00:00
info.list = menu_list->menu_stack;
2015-06-19 02:40:43 +00:00
strlcpy(info.label,
menu_hash_to_str(MENU_LABEL_HELP),
sizeof(info.label));
2015-05-18 01:25:45 +00:00
2015-05-18 19:42:09 +00:00
menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}
break;
2015-02-27 02:05:19 +00:00
}
2015-05-18 19:55:20 +00:00
if (menu->state.do_pop_stack && action == MENU_ACTION_OK)
menu_list_pop_stack(menu_list, menu->state.pop_selected);
if (menu->state.do_post_iterate)
menu_input_post_iterate(&ret, action);
2015-08-21 01:58:35 +00:00
end:
if (ret)
return -1;
return 0;
}
int menu_iterate_render(void)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return -1;
2015-08-18 01:51:44 +00:00
if (menu->state.fb_is_dirty != menu->state.do_messagebox)
menu->state.fb_is_dirty = true;
2015-05-18 21:56:23 +00:00
2015-08-18 01:51:44 +00:00
if (menu->state.fb_is_dirty)
2015-05-18 22:05:17 +00:00
menu_display_fb_set_dirty();
2015-05-18 21:56:23 +00:00
2015-08-18 01:51:44 +00:00
if (menu->state.do_messagebox && menu->state.msg[0] != '\0')
{
const ui_companion_driver_t *ui = ui_companion_get_ptr();
2015-08-21 04:28:54 +00:00
if (driver->render_messagebox)
2015-08-18 01:51:44 +00:00
driver->render_messagebox(menu->state.msg);
2015-08-21 04:28:54 +00:00
if (ui_companion_is_on_foreground())
{
if (ui->render_messagebox)
ui->render_messagebox(menu->state.msg);
}
}
2015-08-18 01:51:44 +00:00
if (menu->state.do_render)
{
if (driver->render)
driver->render();
}
2015-02-27 02:05:19 +00:00
if (menu_driver_alive() && !rarch_main_is_idle())
menu_display_fb();
menu_driver_set_texture();
return 0;
2015-02-27 02:05:19 +00:00
}