2015-10-03 01:15:47 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-10-03 01:15:47 +00:00
|
|
|
* Copyright (C) 2012-2015 - Michael Lelli
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <compat/strl.h>
|
2015-12-26 06:37:44 +00:00
|
|
|
#include <string/stdstring.h>
|
2016-05-10 18:31:27 +00:00
|
|
|
#include <features/features_cpu.h>
|
2015-10-03 01:15:47 +00:00
|
|
|
|
|
|
|
#include "menu_generic.h"
|
|
|
|
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "../menu_driver.h"
|
2015-10-03 02:21:38 +00:00
|
|
|
#include "../menu_display.h"
|
2015-10-03 01:15:47 +00:00
|
|
|
#include "../menu_displaylist.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "../menu_navigation.h"
|
2015-10-17 17:38:33 +00:00
|
|
|
#include "../menu_entries.h"
|
2015-10-03 01:15:47 +00:00
|
|
|
|
2015-10-03 02:21:38 +00:00
|
|
|
#include "../../configuration.h"
|
2016-05-10 06:53:14 +00:00
|
|
|
#include "../../performance_counters.h"
|
2015-10-03 02:21:38 +00:00
|
|
|
#include "../../input/input_autodetect.h"
|
2015-11-28 01:22:46 +00:00
|
|
|
#include "../../input/input_config.h"
|
2015-11-08 18:42:23 +00:00
|
|
|
#include "../../cheevos.h"
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2015-11-23 11:03:38 +00:00
|
|
|
#include "../../verbosity.h"
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2015-12-10 18:38:46 +00:00
|
|
|
static int action_iterate_help(menu_handle_t *menu,
|
|
|
|
char *s, size_t len, const char *label)
|
2015-10-03 02:21:38 +00:00
|
|
|
{
|
2016-02-13 05:30:39 +00:00
|
|
|
#ifdef HAVE_CHEEVOS
|
|
|
|
cheevos_ctx_desc_t desc_info;
|
|
|
|
#endif
|
2015-12-11 18:13:40 +00:00
|
|
|
bool do_exit = false;
|
2015-10-03 02:21:38 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
switch (menu->help_screen_type)
|
|
|
|
{
|
|
|
|
case MENU_HELP_WELCOME:
|
|
|
|
{
|
|
|
|
static int64_t timeout_end;
|
|
|
|
int64_t timeout;
|
|
|
|
static bool timer_begin = false;
|
|
|
|
static bool timer_end = false;
|
2016-05-10 07:17:04 +00:00
|
|
|
int64_t current = cpu_features_get_time_usec();
|
2015-10-03 02:21:38 +00:00
|
|
|
|
|
|
|
if (!timer_begin)
|
|
|
|
{
|
2016-05-10 07:17:04 +00:00
|
|
|
timeout_end = cpu_features_get_time_usec() +
|
2015-10-03 02:21:38 +00:00
|
|
|
3 /* seconds */ * 1000000;
|
|
|
|
timer_begin = true;
|
|
|
|
timer_end = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
timeout = (timeout_end - current) / 1000000;
|
|
|
|
|
2016-07-24 09:43:40 +00:00
|
|
|
menu_hash_get_help_enum(
|
|
|
|
MENU_ENUM_LABEL_WELCOME_TO_RETROARCH,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
|
|
|
|
if (!timer_end && timeout <= 0)
|
|
|
|
{
|
|
|
|
timer_end = true;
|
|
|
|
timer_begin = false;
|
|
|
|
timeout_end = 0;
|
2015-12-11 18:13:40 +00:00
|
|
|
do_exit = true;
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_HELP_CONTROLS:
|
|
|
|
{
|
|
|
|
unsigned i;
|
2016-06-03 03:32:18 +00:00
|
|
|
char s2[PATH_MAX_LENGTH] = {0};
|
2015-10-03 02:21:38 +00:00
|
|
|
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,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_START,
|
|
|
|
RARCH_MENU_TOGGLE,
|
|
|
|
RARCH_QUIT_KEY,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_X,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_Y,
|
|
|
|
};
|
|
|
|
char desc[ARRAY_SIZE(binds)][64] = {{0}};
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(binds); i++)
|
|
|
|
{
|
2016-02-04 20:42:42 +00:00
|
|
|
const struct retro_keybind *keybind =
|
|
|
|
(const struct retro_keybind*)
|
2015-10-03 02:21:38 +00:00
|
|
|
&settings->input.binds[0][binds[i]];
|
2016-02-04 20:42:42 +00:00
|
|
|
const struct retro_keybind *auto_bind =
|
|
|
|
(const struct retro_keybind*)
|
2015-10-03 02:21:38 +00:00
|
|
|
input_get_auto_bind(0, binds[i]);
|
|
|
|
|
2016-02-04 20:42:42 +00:00
|
|
|
input_config_get_bind_string(desc[i],
|
|
|
|
keybind, auto_bind, sizeof(desc[i]));
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
|
2016-07-24 10:14:06 +00:00
|
|
|
menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG,
|
2015-10-03 02:21:38 +00:00
|
|
|
s2, sizeof(s2));
|
|
|
|
|
|
|
|
snprintf(s, len,
|
|
|
|
"%s"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n"
|
|
|
|
"[%s]: "
|
|
|
|
"%-20s\n",
|
2016-02-10 19:24:09 +00:00
|
|
|
|
2015-10-03 02:21:38 +00:00
|
|
|
s2,
|
2016-02-10 19:24:09 +00:00
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[0],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[1],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[2],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[3],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[4],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[5],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[6],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[7],
|
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(
|
2016-06-15 21:34:47 +00:00
|
|
|
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD),
|
2016-02-10 19:24:09 +00:00
|
|
|
desc[8]
|
|
|
|
|
2015-10-03 02:21:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
2015-11-08 18:42:23 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CHEEVOS
|
2015-11-08 17:52:04 +00:00
|
|
|
case MENU_HELP_CHEEVOS_DESCRIPTION:
|
2016-02-13 05:30:39 +00:00
|
|
|
desc_info.idx = menu->help_screen_id;
|
|
|
|
desc_info.s = s;
|
|
|
|
desc_info.len = len;
|
2016-05-07 22:15:04 +00:00
|
|
|
cheevos_get_description(&desc_info);
|
2015-11-08 17:52:04 +00:00
|
|
|
break;
|
2015-11-08 18:42:23 +00:00
|
|
|
#endif
|
|
|
|
|
2015-10-03 02:21:38 +00:00
|
|
|
case MENU_HELP_WHAT_IS_A_CORE:
|
2016-07-24 10:36:02 +00:00
|
|
|
menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
break;
|
|
|
|
case MENU_HELP_LOADING_CONTENT:
|
2016-07-24 10:47:58 +00:00
|
|
|
menu_hash_get_help_enum(MENU_ENUM_LABEL_LOAD_CONTENT_LIST,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
break;
|
|
|
|
case MENU_HELP_CHANGE_VIRTUAL_GAMEPAD:
|
2016-07-24 10:36:02 +00:00
|
|
|
menu_hash_get_help_enum(
|
|
|
|
MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
break;
|
|
|
|
case MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING:
|
2016-07-24 10:36:02 +00:00
|
|
|
menu_hash_get_help_enum(
|
|
|
|
MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
break;
|
|
|
|
case MENU_HELP_SCANNING_CONTENT:
|
2016-07-24 10:36:02 +00:00
|
|
|
menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
|
|
|
break;
|
|
|
|
case MENU_HELP_EXTRACT:
|
2016-07-24 10:36:02 +00:00
|
|
|
menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT,
|
2015-10-03 02:21:38 +00:00
|
|
|
s, len);
|
2015-12-11 18:13:40 +00:00
|
|
|
|
|
|
|
if (settings->bundle_finished)
|
|
|
|
{
|
|
|
|
settings->bundle_finished = false;
|
|
|
|
do_exit = true;
|
|
|
|
}
|
2015-10-03 02:21:38 +00:00
|
|
|
break;
|
|
|
|
case MENU_HELP_NONE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-11 18:13:40 +00:00
|
|
|
if (do_exit)
|
|
|
|
{
|
|
|
|
menu->help_screen_type = MENU_HELP_NONE;
|
|
|
|
return 1;
|
|
|
|
}
|
2015-10-03 02:21:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum action_iterate_type action_iterate_type(uint32_t hash)
|
|
|
|
{
|
|
|
|
switch (hash)
|
|
|
|
{
|
|
|
|
case MENU_LABEL_HELP:
|
|
|
|
case MENU_LABEL_HELP_CONTROLS:
|
|
|
|
case MENU_LABEL_HELP_WHAT_IS_A_CORE:
|
|
|
|
case MENU_LABEL_HELP_LOADING_CONTENT:
|
|
|
|
case MENU_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD:
|
2015-11-08 17:52:04 +00:00
|
|
|
case MENU_LABEL_CHEEVOS_DESCRIPTION:
|
2015-10-03 02:21:38 +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_CUSTOM_BIND:
|
|
|
|
case MENU_LABEL_CUSTOM_BIND_ALL:
|
|
|
|
case MENU_LABEL_CUSTOM_BIND_DEFAULTS:
|
|
|
|
return ITERATE_TYPE_BIND;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ITERATE_TYPE_DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
**/
|
2015-12-10 18:38:46 +00:00
|
|
|
int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
2015-10-03 02:21:38 +00:00
|
|
|
{
|
|
|
|
size_t selection;
|
|
|
|
menu_entry_t entry;
|
|
|
|
enum action_iterate_type iterate_type;
|
2016-07-26 13:12:20 +00:00
|
|
|
unsigned file_type = 0;
|
2016-06-17 14:08:47 +00:00
|
|
|
const char *label = NULL;
|
|
|
|
int ret = 0;
|
|
|
|
uint32_t hash = 0;
|
2016-06-19 22:31:13 +00:00
|
|
|
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
|
2016-06-17 14:08:47 +00:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
|
2016-07-26 13:12:20 +00:00
|
|
|
menu_entries_get_last_stack(NULL, &label, &file_type, &enum_idx, NULL);
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2015-10-17 17:21:18 +00:00
|
|
|
if (!menu)
|
2015-10-03 02:21:38 +00:00
|
|
|
return 0;
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
menu->menu_state.msg[0] = '\0';
|
2016-06-19 22:37:38 +00:00
|
|
|
hash = msg_hash_calculate(label);
|
2015-10-03 02:21:38 +00:00
|
|
|
iterate_type = action_iterate_type(hash);
|
|
|
|
|
2015-12-11 20:41:59 +00:00
|
|
|
if ( action != MENU_ACTION_NOOP
|
|
|
|
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|
2016-05-08 10:33:28 +00:00
|
|
|
|| menu_display_get_update_pending())
|
2015-10-03 02:21:38 +00:00
|
|
|
{
|
2015-10-11 10:58:21 +00:00
|
|
|
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (iterate_type)
|
|
|
|
{
|
|
|
|
case ITERATE_TYPE_HELP:
|
2016-02-04 20:42:42 +00:00
|
|
|
ret = action_iterate_help(menu,
|
|
|
|
menu->menu_state.msg, sizeof(menu->menu_state.msg), label);
|
2015-10-03 02:21:38 +00:00
|
|
|
BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);
|
|
|
|
if (ret == 1 || action == MENU_ACTION_OK)
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_POP_STACK);
|
|
|
|
break;
|
|
|
|
case ITERATE_TYPE_BIND:
|
|
|
|
{
|
2016-02-25 16:55:45 +00:00
|
|
|
menu_input_ctx_bind_t bind;
|
|
|
|
|
|
|
|
bind.s = menu->menu_state.msg;
|
|
|
|
bind.len = sizeof(menu->menu_state.msg);
|
|
|
|
|
|
|
|
if (menu_input_ctl(MENU_INPUT_CTL_BIND_ITERATE, &bind))
|
|
|
|
{
|
2016-04-25 17:09:30 +00:00
|
|
|
menu_entries_pop_stack(&selection, 0, 0);
|
2016-02-25 16:55:45 +00:00
|
|
|
menu_navigation_ctl(
|
|
|
|
MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ITERATE_TYPE_INFO:
|
|
|
|
{
|
2016-07-27 14:37:28 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
|
|
|
menu_file_list_cbs_t *cbs =
|
2016-02-04 20:42:42 +00:00
|
|
|
menu_entries_get_actiondata_at_offset(selection_buf, selection);
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2016-07-24 10:36:02 +00:00
|
|
|
if (cbs->enum_idx != MSG_UNKNOWN)
|
|
|
|
{
|
|
|
|
ret = menu_hash_get_help_enum(cbs->enum_idx,
|
|
|
|
menu->menu_state.msg, sizeof(menu->menu_state.msg));
|
|
|
|
#if 0
|
|
|
|
RARCH_LOG("enum: %s\n", msg_hash_to_str(cbs->enum_idx));
|
|
|
|
#endif
|
|
|
|
}
|
2016-07-26 13:12:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned type = 0;
|
|
|
|
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
|
|
|
|
menu_entries_get_at_offset(selection_buf, selection,
|
|
|
|
NULL, NULL, &type, NULL, NULL);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
RARCH_LOG("file_type: %d\n", type);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
2016-07-27 14:37:28 +00:00
|
|
|
case FILE_TYPE_FONT:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_FONT;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_RDB:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_RDB;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_OVERLAY:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_CHEAT:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_CHEAT;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_SHADER_PRESET:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_SHADER:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_SHADER;
|
|
|
|
break;
|
2016-07-27 14:49:13 +00:00
|
|
|
case FILE_TYPE_REMAP:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_REMAP;
|
|
|
|
break;
|
2016-07-27 18:47:54 +00:00
|
|
|
case FILE_TYPE_RECORD_CONFIG:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_RECORD_CONFIG;
|
|
|
|
break;
|
|
|
|
case FILE_TYPE_CURSOR:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_CURSOR;
|
|
|
|
break;
|
2016-07-27 19:01:39 +00:00
|
|
|
case FILE_TYPE_CONFIG:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_CONFIG;
|
|
|
|
break;
|
2016-07-27 19:28:33 +00:00
|
|
|
case FILE_TYPE_CARCHIVE:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_COMPRESSED_ARCHIVE;
|
|
|
|
break;
|
2016-07-26 13:12:20 +00:00
|
|
|
case FILE_TYPE_VIDEOFILTER: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_AUDIOFILTER: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_SLANG: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_GLSL: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_HLSL: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_CG: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_PRESET_GLSLP: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_PRESET_HLSLP: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_PRESET_CGP: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_SHADER_PRESET_SLANGP: /* TODO/FIXME */
|
|
|
|
case FILE_TYPE_PLAIN:
|
|
|
|
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enum_idx != MSG_UNKNOWN)
|
|
|
|
ret = menu_hash_get_help_enum(enum_idx,
|
|
|
|
menu->menu_state.msg, sizeof(menu->menu_state.msg));
|
|
|
|
|
|
|
|
}
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);
|
|
|
|
if (action == MENU_ACTION_OK)
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_POP_STACK);
|
|
|
|
break;
|
|
|
|
case ITERATE_TYPE_DEFAULT:
|
2016-02-21 08:54:53 +00:00
|
|
|
/* FIXME: Crappy hack, needed for mouse controls
|
|
|
|
* to not be completely broken in case we press back.
|
2015-10-03 02:21:38 +00:00
|
|
|
*
|
2016-02-21 08:54:53 +00:00
|
|
|
* We need to fix this entire mess, mouse controls
|
|
|
|
* should not rely on a hack like this in order to work. */
|
2016-03-01 23:07:31 +00:00
|
|
|
selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0);
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2015-10-27 09:10:33 +00:00
|
|
|
menu_entry_get(&entry, 0, selection, NULL, false);
|
2015-10-03 02:21:38 +00:00
|
|
|
ret = menu_entry_action(&entry, selection, (enum menu_action)action);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);
|
|
|
|
|
|
|
|
/* Have to defer it so we let settings refresh. */
|
|
|
|
if (menu->push_help_screen)
|
|
|
|
{
|
|
|
|
menu_displaylist_info_t info = {0};
|
|
|
|
|
2015-10-17 16:02:41 +00:00
|
|
|
info.list = menu_stack;
|
2015-10-03 02:21:38 +00:00
|
|
|
strlcpy(info.label,
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_HELP),
|
2015-10-03 02:21:38 +00:00
|
|
|
sizeof(info.label));
|
2016-06-17 21:47:23 +00:00
|
|
|
info.enum_idx = MENU_ENUM_LABEL_HELP;
|
2015-10-03 02:21:38 +00:00
|
|
|
|
2016-02-24 21:56:41 +00:00
|
|
|
menu_displaylist_ctl(DISPLAYLIST_HELP, &info);
|
2015-10-03 02:21:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-10-11 10:58:21 +00:00
|
|
|
BIT64_SET(menu->state, MENU_STATE_BLIT);
|
2015-10-03 02:21:38 +00:00
|
|
|
|
|
|
|
if (BIT64_GET(menu->state, MENU_STATE_POP_STACK))
|
|
|
|
{
|
|
|
|
size_t new_selection_ptr = selection;
|
2016-04-25 17:09:30 +00:00
|
|
|
menu_entries_pop_stack(&new_selection_ptr, 0, 0);
|
2015-10-03 02:21:38 +00:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BIT64_GET(menu->state, MENU_STATE_POST_ITERATE))
|
|
|
|
menu_input_post_iterate(&ret, action);
|
|
|
|
|
|
|
|
end:
|
|
|
|
if (ret)
|
|
|
|
return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-03 01:15:47 +00:00
|
|
|
bool generic_menu_init_list(void *data)
|
|
|
|
{
|
|
|
|
menu_displaylist_info_t info = {0};
|
2015-10-27 09:33:19 +00:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-10-03 01:15:47 +00:00
|
|
|
|
2016-02-04 20:42:42 +00:00
|
|
|
strlcpy(info.label,
|
2016-06-19 22:31:13 +00:00
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label));
|
2016-06-17 21:47:23 +00:00
|
|
|
info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU;
|
2015-10-03 01:15:47 +00:00
|
|
|
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(menu_stack, info.path,
|
2016-06-16 11:13:43 +00:00
|
|
|
info.label,
|
|
|
|
MENU_ENUM_LABEL_MAIN_MENU,
|
|
|
|
info.type, info.flags, 0);
|
2015-10-22 01:02:03 +00:00
|
|
|
|
|
|
|
info.list = selection_buf;
|
|
|
|
|
2016-02-24 22:05:54 +00:00
|
|
|
if (menu_displaylist_ctl(DISPLAYLIST_MAIN_MENU, &info))
|
2016-02-24 22:19:53 +00:00
|
|
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
2015-10-03 01:15:47 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|