2013-04-17 21:31:49 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2014-04-13 10:12:12 +00:00
|
|
|
*
|
2013-04-17 21:31:49 +00:00
|
|
|
* 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 "menu_common.h"
|
2014-09-02 01:48:10 +00:00
|
|
|
#include "menu_input_line_cb.h"
|
2014-08-31 16:36:26 +00:00
|
|
|
#include "menu_entries.h"
|
2014-09-24 05:56:47 +00:00
|
|
|
#include "menu_shader.h"
|
2014-07-27 16:17:13 +00:00
|
|
|
#include "../frontend.h"
|
2013-04-17 21:31:49 +00:00
|
|
|
|
2014-09-03 14:32:02 +00:00
|
|
|
static void draw_frame(bool enable)
|
|
|
|
{
|
|
|
|
if (driver.video_data && driver.video_poke &&
|
|
|
|
driver.video_poke->set_texture_enable)
|
|
|
|
driver.video_poke->set_texture_enable(driver.video_data,
|
|
|
|
enable, MENU_TEXTURE_FULLSCREEN);
|
|
|
|
|
2014-09-29 12:41:24 +00:00
|
|
|
if (!enable || !driver.video)
|
2014-09-03 14:32:02 +00:00
|
|
|
return;
|
|
|
|
|
2014-09-29 12:41:24 +00:00
|
|
|
if (!g_settings.menu.pause_libretro)
|
2014-09-29 12:38:37 +00:00
|
|
|
{
|
2014-09-29 12:41:24 +00:00
|
|
|
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
2014-09-29 12:38:37 +00:00
|
|
|
{
|
2014-09-29 12:41:24 +00:00
|
|
|
bool block_libretro_input = driver.block_libretro_input;
|
|
|
|
driver.block_libretro_input = true;
|
|
|
|
pretro_run();
|
|
|
|
driver.block_libretro_input = block_libretro_input;
|
2014-09-29 12:38:37 +00:00
|
|
|
|
2014-09-29 12:41:24 +00:00
|
|
|
return;
|
2014-09-29 12:38:37 +00:00
|
|
|
}
|
|
|
|
}
|
2014-09-29 12:41:24 +00:00
|
|
|
|
|
|
|
rarch_render_cached_frame();
|
2014-09-03 14:32:02 +00:00
|
|
|
}
|
|
|
|
|
2014-09-02 14:03:17 +00:00
|
|
|
/* Update menu state which depends on config. */
|
|
|
|
|
2014-09-09 03:40:53 +00:00
|
|
|
static void update_libretro_info(struct retro_system_info *info)
|
2013-09-15 13:36:45 +00:00
|
|
|
{
|
2013-10-31 01:53:01 +00:00
|
|
|
#ifndef HAVE_DYNAMIC
|
2014-09-09 03:40:53 +00:00
|
|
|
retro_get_system_info(info);
|
2013-10-31 01:53:01 +00:00
|
|
|
#endif
|
|
|
|
|
2014-09-03 12:57:29 +00:00
|
|
|
core_info_list_free(g_extern.core_info);
|
|
|
|
g_extern.core_info = NULL;
|
2014-05-09 16:51:20 +00:00
|
|
|
if (*g_settings.libretro_directory)
|
2014-09-03 12:57:29 +00:00
|
|
|
g_extern.core_info = core_info_list_new(g_settings.libretro_directory);
|
2014-03-02 13:07:07 +00:00
|
|
|
|
2014-09-09 03:40:53 +00:00
|
|
|
rarch_update_system_info(info, NULL);
|
2013-09-15 13:36:45 +00:00
|
|
|
}
|
|
|
|
|
2014-09-01 00:11:51 +00:00
|
|
|
static void menu_environment_get(int *argc, char *argv[],
|
|
|
|
void *args, void *params_data)
|
2014-07-27 18:24:06 +00:00
|
|
|
{
|
|
|
|
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
|
|
|
|
|
2014-07-28 17:55:28 +00:00
|
|
|
wrap_args->no_content = driver.menu->load_no_content;
|
2014-09-26 04:09:36 +00:00
|
|
|
if (!g_extern.has_set_verbosity)
|
|
|
|
wrap_args->verbose = g_extern.verbosity;
|
2014-07-27 18:24:06 +00:00
|
|
|
wrap_args->config_path = *g_extern.config_path ? g_extern.config_path : NULL;
|
2014-09-26 04:09:36 +00:00
|
|
|
if (!g_extern.has_set_save_path)
|
|
|
|
wrap_args->sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
|
|
|
|
if (!g_extern.has_set_state_path)
|
|
|
|
wrap_args->state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL;
|
2014-07-28 17:55:28 +00:00
|
|
|
wrap_args->content_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
|
2014-07-27 18:24:06 +00:00
|
|
|
wrap_args->libretro_path = *g_settings.libretro ? g_settings.libretro : NULL;
|
|
|
|
wrap_args->touched = true;
|
|
|
|
}
|
|
|
|
|
2014-07-27 23:55:59 +00:00
|
|
|
bool load_menu_content(void)
|
2013-04-28 14:38:13 +00:00
|
|
|
{
|
2014-09-11 23:11:14 +00:00
|
|
|
if (*g_extern.fullpath || (driver.menu && driver.menu->load_no_content))
|
2014-09-06 19:52:24 +00:00
|
|
|
{
|
2014-09-11 23:11:14 +00:00
|
|
|
if (*g_extern.fullpath)
|
2014-09-06 19:52:24 +00:00
|
|
|
{
|
2014-09-11 23:11:14 +00:00
|
|
|
char tmp[PATH_MAX];
|
|
|
|
char str[PATH_MAX];
|
|
|
|
|
|
|
|
fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp));
|
|
|
|
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
|
|
|
|
msg_queue_push(g_extern.msg_queue, str, 1, 1);
|
2014-09-06 19:52:24 +00:00
|
|
|
}
|
2014-09-11 23:11:14 +00:00
|
|
|
|
|
|
|
content_playlist_push(g_extern.history,
|
|
|
|
g_extern.fullpath,
|
|
|
|
g_settings.libretro,
|
|
|
|
g_extern.menu.info.library_name);
|
2014-09-06 19:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* redraw menu frame */
|
2014-09-11 23:11:14 +00:00
|
|
|
if (driver.menu)
|
|
|
|
{
|
|
|
|
driver.menu->old_input_state = driver.menu->trigger_state = 0;
|
|
|
|
driver.menu->do_held = false;
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
}
|
2014-09-06 19:52:24 +00:00
|
|
|
|
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend &&
|
|
|
|
driver.menu_ctx->backend->iterate)
|
|
|
|
driver.menu_ctx->backend->iterate(MENU_ACTION_NOOP);
|
|
|
|
|
|
|
|
draw_frame(true);
|
|
|
|
draw_frame(false);
|
2014-07-27 23:00:16 +00:00
|
|
|
|
2014-08-02 22:00:41 +00:00
|
|
|
if (!(main_load_content(0, NULL, NULL, menu_environment_get,
|
2014-07-27 22:18:05 +00:00
|
|
|
driver.frontend_ctx->process_args)))
|
2013-04-28 14:38:13 +00:00
|
|
|
{
|
2014-05-09 03:47:32 +00:00
|
|
|
char name[PATH_MAX], msg[PATH_MAX];
|
|
|
|
|
2013-05-01 01:45:02 +00:00
|
|
|
fill_pathname_base(name, g_extern.fullpath, sizeof(name));
|
|
|
|
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
|
|
|
|
msg_queue_push(g_extern.msg_queue, msg, 1, 90);
|
2014-07-27 06:17:38 +00:00
|
|
|
|
|
|
|
if (driver.menu)
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
|
2013-04-28 14:38:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-07-27 06:17:38 +00:00
|
|
|
if (driver.menu)
|
2014-09-09 03:40:53 +00:00
|
|
|
update_libretro_info(&g_extern.menu.info);
|
2014-07-24 22:12:41 +00:00
|
|
|
|
2014-08-02 15:42:01 +00:00
|
|
|
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
|
|
|
rarch_main_command(RARCH_CMD_HISTORY_INIT);
|
2014-05-30 15:49:04 +00:00
|
|
|
|
2014-09-24 05:56:47 +00:00
|
|
|
menu_shader_manager_init(driver.menu);
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-08-16 16:46:43 +00:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
2014-09-03 14:55:56 +00:00
|
|
|
rarch_main_command(RARCH_CMD_RESUME);
|
2014-08-02 16:41:43 +00:00
|
|
|
|
2014-05-09 03:47:32 +00:00
|
|
|
return true;
|
2013-04-28 14:38:13 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 15:49:04 +00:00
|
|
|
void *menu_init(const void *data)
|
2013-04-18 12:57:28 +00:00
|
|
|
{
|
2014-06-10 00:06:10 +00:00
|
|
|
menu_handle_t *menu;
|
2014-05-30 15:49:04 +00:00
|
|
|
menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data;
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-05-30 15:49:04 +00:00
|
|
|
if (!menu_ctx)
|
2014-05-09 03:47:32 +00:00
|
|
|
return NULL;
|
|
|
|
|
2014-07-25 21:33:49 +00:00
|
|
|
if (!(menu = (menu_handle_t*)menu_ctx->init()))
|
2014-05-27 17:21:44 +00:00
|
|
|
return NULL;
|
2013-04-18 16:33:03 +00:00
|
|
|
|
2014-08-20 14:26:34 +00:00
|
|
|
strlcpy(g_settings.menu.driver, menu_ctx->ident,
|
|
|
|
sizeof(g_settings.menu.driver));
|
2014-05-26 21:18:49 +00:00
|
|
|
|
2014-06-10 00:06:10 +00:00
|
|
|
menu->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
|
|
menu->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
2014-09-03 12:57:29 +00:00
|
|
|
g_extern.core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
2014-05-31 19:08:32 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-06-10 00:06:10 +00:00
|
|
|
menu->shader = (struct gfx_shader*)calloc(1, sizeof(struct gfx_shader));
|
2014-05-31 19:08:32 +00:00
|
|
|
#endif
|
2014-08-31 17:29:42 +00:00
|
|
|
file_list_push(menu->menu_stack, "", "mainmenu", MENU_SETTINGS, 0);
|
2014-06-10 00:06:10 +00:00
|
|
|
menu_clear_navigation(menu);
|
|
|
|
menu->push_start_screen = g_settings.menu_show_start_screen;
|
|
|
|
g_settings.menu_show_start_screen = false;
|
2014-04-14 00:32:54 +00:00
|
|
|
|
2014-09-02 13:15:05 +00:00
|
|
|
menu_entries_push_list(menu, menu->selection_buf,
|
|
|
|
"", "mainmenu", 0);
|
2013-11-04 12:18:07 +00:00
|
|
|
|
2014-06-10 00:06:10 +00:00
|
|
|
menu->trigger_state = 0;
|
|
|
|
menu->old_input_state = 0;
|
|
|
|
menu->do_held = false;
|
|
|
|
menu->current_pad = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2014-09-09 03:40:53 +00:00
|
|
|
update_libretro_info(&g_extern.menu.info);
|
2013-04-22 20:14:25 +00:00
|
|
|
|
2014-09-24 05:56:47 +00:00
|
|
|
menu_shader_manager_init(menu);
|
2013-04-28 01:48:35 +00:00
|
|
|
|
2014-08-02 15:42:01 +00:00
|
|
|
rarch_main_command(RARCH_CMD_HISTORY_INIT);
|
2014-06-10 00:06:10 +00:00
|
|
|
menu->last_time = rarch_get_time_usec();
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-06-10 00:06:10 +00:00
|
|
|
return menu;
|
2013-04-18 12:57:28 +00:00
|
|
|
}
|
|
|
|
|
2014-05-09 03:47:32 +00:00
|
|
|
void menu_free(void *data)
|
2013-04-18 12:57:28 +00:00
|
|
|
{
|
2014-06-10 00:06:10 +00:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-06-10 00:06:10 +00:00
|
|
|
if (!menu)
|
2014-05-09 03:47:32 +00:00
|
|
|
return;
|
2014-05-31 19:08:32 +00:00
|
|
|
|
2014-07-27 23:50:13 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
if (menu->shader)
|
|
|
|
free(menu->shader);
|
|
|
|
menu->shader = NULL;
|
|
|
|
#endif
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-04-01 02:03:55 +00:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->free)
|
2014-06-10 00:06:10 +00:00
|
|
|
driver.menu_ctx->free(menu);
|
2013-04-18 15:29:04 +00:00
|
|
|
|
2014-03-06 01:14:38 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-09-07 05:12:10 +00:00
|
|
|
libretro_free_system_info(&g_extern.menu.info);
|
2014-03-06 01:14:38 +00:00
|
|
|
#endif
|
2013-11-04 12:18:07 +00:00
|
|
|
|
2014-06-10 00:06:10 +00:00
|
|
|
file_list_free(menu->menu_stack);
|
|
|
|
file_list_free(menu->selection_buf);
|
2013-11-04 12:18:07 +00:00
|
|
|
|
2014-08-02 15:42:01 +00:00
|
|
|
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
|
|
|
|
2014-09-03 12:57:29 +00:00
|
|
|
if (g_extern.core_info)
|
|
|
|
core_info_list_free(g_extern.core_info);
|
2013-04-28 01:48:35 +00:00
|
|
|
|
2014-09-03 12:57:29 +00:00
|
|
|
if (g_extern.core_info_current)
|
|
|
|
free(g_extern.core_info_current);
|
2014-05-31 18:37:37 +00:00
|
|
|
|
2014-05-30 18:53:10 +00:00
|
|
|
free(data);
|
2013-04-18 12:57:28 +00:00
|
|
|
}
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2014-08-20 14:26:34 +00:00
|
|
|
void menu_ticker_line(char *buf, size_t len, unsigned index,
|
|
|
|
const char *str, bool selected)
|
2013-05-05 09:26:02 +00:00
|
|
|
{
|
|
|
|
size_t str_len = strlen(str);
|
2014-08-02 14:22:56 +00:00
|
|
|
|
2013-05-05 09:26:02 +00:00
|
|
|
if (str_len <= len)
|
|
|
|
{
|
|
|
|
strlcpy(buf, str, len + 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-05 19:42:14 +00:00
|
|
|
if (!selected)
|
2013-05-05 20:19:27 +00:00
|
|
|
{
|
|
|
|
strlcpy(buf, str, len + 1 - 3);
|
|
|
|
strlcat(buf, "...", len + 1);
|
|
|
|
}
|
2013-05-05 09:26:02 +00:00
|
|
|
else
|
2013-05-05 19:42:14 +00:00
|
|
|
{
|
2014-08-20 14:26:34 +00:00
|
|
|
/* Wrap long strings in options with some kind of ticker line. */
|
2013-05-05 19:42:14 +00:00
|
|
|
unsigned ticker_period = 2 * (str_len - len) + 4;
|
|
|
|
unsigned phase = index % ticker_period;
|
|
|
|
|
|
|
|
unsigned phase_left_stop = 2;
|
|
|
|
unsigned phase_left_moving = phase_left_stop + (str_len - len);
|
|
|
|
unsigned phase_right_stop = phase_left_moving + 2;
|
|
|
|
|
|
|
|
unsigned left_offset = phase - phase_left_stop;
|
|
|
|
unsigned right_offset = (str_len - len) - (phase - phase_right_stop);
|
|
|
|
|
2014-08-20 14:26:34 +00:00
|
|
|
/* Ticker period:
|
|
|
|
* [Wait at left (2 ticks),
|
|
|
|
* Progress to right(type_len - w),
|
|
|
|
* Wait at right (2 ticks),
|
|
|
|
* Progress to left].
|
|
|
|
*/
|
2013-05-05 19:42:14 +00:00
|
|
|
if (phase < phase_left_stop)
|
|
|
|
strlcpy(buf, str, len + 1);
|
|
|
|
else if (phase < phase_left_moving)
|
|
|
|
strlcpy(buf, str + left_offset, len + 1);
|
|
|
|
else if (phase < phase_right_stop)
|
|
|
|
strlcpy(buf, str + str_len - len, len + 1);
|
|
|
|
else
|
|
|
|
strlcpy(buf, str + right_offset, len + 1);
|
|
|
|
}
|
2013-05-05 09:26:02 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 14:42:16 +00:00
|
|
|
static unsigned input_frame(uint64_t trigger_state)
|
|
|
|
{
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
|
|
|
|
return MENU_ACTION_UP;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
|
|
|
return MENU_ACTION_DOWN;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
|
|
|
return MENU_ACTION_LEFT;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
|
|
|
return MENU_ACTION_RIGHT;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
|
|
|
|
return MENU_ACTION_SCROLL_UP;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
|
|
|
|
return MENU_ACTION_SCROLL_DOWN;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
|
|
|
|
return MENU_ACTION_CANCEL;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
|
|
|
|
return MENU_ACTION_OK;
|
2014-09-19 18:28:30 +00:00
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
|
|
|
|
return MENU_ACTION_Y;
|
2014-09-03 14:42:16 +00:00
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
|
|
|
|
return MENU_ACTION_START;
|
|
|
|
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
|
|
|
|
return MENU_ACTION_SELECT;
|
2014-09-14 16:07:00 +00:00
|
|
|
if (trigger_state & (1ULL << RARCH_MENU_TOGGLE))
|
|
|
|
return MENU_ACTION_TOGGLE;
|
2014-09-03 14:42:16 +00:00
|
|
|
return MENU_ACTION_NOOP;
|
|
|
|
}
|
2014-09-03 14:32:02 +00:00
|
|
|
|
2014-09-21 07:18:26 +00:00
|
|
|
bool menu_iterate(retro_input_t input,
|
|
|
|
retro_input_t old_input, retro_input_t trigger_input)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
2014-08-02 14:18:38 +00:00
|
|
|
unsigned action = MENU_ACTION_NOOP;
|
2013-04-19 15:53:01 +00:00
|
|
|
static bool initial_held = true;
|
|
|
|
static bool first_held = false;
|
2014-08-02 14:18:38 +00:00
|
|
|
uint64_t input_state = 0;
|
|
|
|
int32_t ret = 0;
|
2014-05-09 03:47:32 +00:00
|
|
|
|
2014-05-31 19:45:16 +00:00
|
|
|
if (!driver.menu)
|
2014-05-09 03:47:32 +00:00
|
|
|
return false;
|
2013-04-19 15:53:01 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_OVERLAY
|
2014-09-17 18:15:56 +00:00
|
|
|
if (BIND_PRESSED(trigger_input, RARCH_OVERLAY_NEXT))
|
|
|
|
input_overlay_next(driver.overlay);
|
2013-04-19 15:53:01 +00:00
|
|
|
#endif
|
2014-09-17 18:15:56 +00:00
|
|
|
check_fullscreen_func(trigger_input);
|
2014-09-17 05:38:49 +00:00
|
|
|
|
2014-09-24 07:52:01 +00:00
|
|
|
driver.retro_ctx.poll_cb();
|
|
|
|
|
2014-05-30 17:33:10 +00:00
|
|
|
input_state = menu_input();
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2014-05-31 19:45:16 +00:00
|
|
|
if (driver.menu->do_held)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
2013-04-20 22:01:49 +00:00
|
|
|
if (!first_held)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
|
|
|
first_held = true;
|
2014-05-31 19:45:16 +00:00
|
|
|
driver.menu->delay_timer = initial_held ? 12 : 6;
|
|
|
|
driver.menu->delay_count = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
2014-05-31 19:45:16 +00:00
|
|
|
if (driver.menu->delay_count >= driver.menu->delay_timer)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
|
|
|
first_held = false;
|
2014-05-31 19:45:16 +00:00
|
|
|
driver.menu->trigger_state = input_state;
|
|
|
|
driver.menu->scroll_accel = min(driver.menu->scroll_accel + 1, 64);
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
initial_held = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first_held = false;
|
|
|
|
initial_held = true;
|
2014-05-31 19:45:16 +00:00
|
|
|
driver.menu->scroll_accel = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
2014-05-31 19:45:16 +00:00
|
|
|
driver.menu->delay_count++;
|
|
|
|
driver.menu->old_input_state = input_state;
|
2013-09-19 12:49:07 +00:00
|
|
|
|
2013-12-09 15:18:58 +00:00
|
|
|
if (driver.block_input)
|
2014-05-31 19:45:16 +00:00
|
|
|
driver.menu->trigger_state = 0;
|
2013-12-09 15:18:58 +00:00
|
|
|
|
2014-08-20 14:26:34 +00:00
|
|
|
/* don't run anything first frame, only capture held inputs
|
|
|
|
* for old_input_state.
|
|
|
|
*/
|
2014-09-03 14:42:16 +00:00
|
|
|
action = input_frame(driver.menu->trigger_state);
|
2013-09-26 20:34:06 +00:00
|
|
|
|
2014-08-20 14:26:34 +00:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend
|
|
|
|
&& driver.menu_ctx->backend->iterate)
|
2014-09-14 19:56:29 +00:00
|
|
|
ret = driver.menu_ctx->backend->iterate(action);
|
2014-03-09 15:47:36 +00:00
|
|
|
|
2014-09-03 14:32:02 +00:00
|
|
|
draw_frame(true);
|
|
|
|
draw_frame(false);
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2014-04-01 02:03:55 +00:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->input_postprocess)
|
2014-09-14 19:56:29 +00:00
|
|
|
driver.menu_ctx->input_postprocess(driver.menu->old_input_state);
|
2013-11-04 15:37:51 +00:00
|
|
|
|
2014-09-15 05:23:50 +00:00
|
|
|
#if 0
|
|
|
|
/* Go back to Main Menu when exiting */
|
2013-11-04 15:37:51 +00:00
|
|
|
if (ret < 0)
|
2014-09-04 17:15:24 +00:00
|
|
|
menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
|
2014-09-15 05:23:50 +00:00
|
|
|
#endif
|
2013-11-04 15:37:51 +00:00
|
|
|
|
2014-09-14 16:07:00 +00:00
|
|
|
if (ret)
|
2014-03-17 10:34:25 +00:00
|
|
|
return false;
|
2013-04-19 15:53:01 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-09-15 13:36:45 +00:00
|
|
|
|
2014-09-03 20:04:46 +00:00
|
|
|
unsigned menu_common_type_is(const char *label, unsigned type)
|
2014-08-31 22:27:09 +00:00
|
|
|
{
|
2014-09-04 21:54:38 +00:00
|
|
|
if (
|
2014-09-04 22:41:03 +00:00
|
|
|
!strcmp(label, "video_shader_pass") ||
|
|
|
|
!strcmp(label, "video_shader_filter_pass") ||
|
|
|
|
!strcmp(label, "video_shader_scale_pass") ||
|
2014-09-04 21:54:38 +00:00
|
|
|
!strcmp(label, "video_shader_default_filter") ||
|
2014-09-04 22:29:33 +00:00
|
|
|
!strcmp(label, "video_shader_num_passes") ||
|
2014-09-04 21:54:38 +00:00
|
|
|
!strcmp(label, "video_shader_preset")
|
|
|
|
)
|
|
|
|
return MENU_SETTINGS_SHADER_OPTIONS;
|
|
|
|
|
2014-08-31 22:27:09 +00:00
|
|
|
if (
|
|
|
|
type == MENU_SETTINGS ||
|
2014-09-04 16:58:53 +00:00
|
|
|
!strcmp(label, "General Options") ||
|
2014-09-04 16:15:58 +00:00
|
|
|
!strcmp(label, "core_options") ||
|
2014-09-03 21:47:24 +00:00
|
|
|
!strcmp(label, "core_information") ||
|
2014-09-04 17:02:42 +00:00
|
|
|
!strcmp(label, "Video Options") ||
|
2014-09-04 17:05:03 +00:00
|
|
|
!strcmp(label, "Font Options") ||
|
2014-09-04 17:34:28 +00:00
|
|
|
!strcmp(label, "Shader Options") ||
|
2014-09-04 21:54:38 +00:00
|
|
|
!strcmp(label, "video_shader_parameters") ||
|
|
|
|
!strcmp(label, "video_shader_preset_parameters") ||
|
2014-09-04 16:37:31 +00:00
|
|
|
!strcmp(label, "Audio Options") ||
|
2014-09-04 19:11:53 +00:00
|
|
|
!strcmp(label, "disk_options") ||
|
2014-09-04 17:24:27 +00:00
|
|
|
!strcmp(label, "Path Options") ||
|
2014-09-29 12:19:40 +00:00
|
|
|
!strcmp(label, "Menu Options") ||
|
2014-09-04 16:09:25 +00:00
|
|
|
!strcmp(label, "Privacy Options") ||
|
2014-09-04 16:12:14 +00:00
|
|
|
!strcmp(label, "Overlay Options") ||
|
2014-09-03 23:00:11 +00:00
|
|
|
!strcmp(label, "User Options") ||
|
|
|
|
!strcmp(label, "Netplay Options") ||
|
2014-09-04 17:20:14 +00:00
|
|
|
!strcmp(label, "settings") ||
|
2014-09-04 16:50:03 +00:00
|
|
|
!strcmp(label, "Driver Options") ||
|
2014-09-03 20:04:46 +00:00
|
|
|
!strcmp(label, "performance_counters") ||
|
2014-09-04 03:27:47 +00:00
|
|
|
!strcmp(label, "frontend_counters") ||
|
|
|
|
!strcmp(label, "core_counters") ||
|
2014-09-04 16:46:29 +00:00
|
|
|
!strcmp(label, "Input Options")
|
2014-08-31 22:27:09 +00:00
|
|
|
)
|
|
|
|
return MENU_SETTINGS;
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
2014-09-04 01:31:44 +00:00
|
|
|
!strcmp(label, "rgui_browser_directory") ||
|
|
|
|
!strcmp(label, "content_directory") ||
|
|
|
|
!strcmp(label, "assets_directory") ||
|
|
|
|
!strcmp(label, "video_shader_dir") ||
|
|
|
|
!strcmp(label, "video_filter_dir") ||
|
|
|
|
!strcmp(label, "audio_filter_dir") ||
|
|
|
|
!strcmp(label, "savestate_directory") ||
|
|
|
|
!strcmp(label, "libretro_dir_path") ||
|
|
|
|
!strcmp(label, "libretro_info_path") ||
|
|
|
|
!strcmp(label, "rgui_config_directory") ||
|
|
|
|
!strcmp(label, "savefile_directory") ||
|
|
|
|
!strcmp(label, "overlay_directory") ||
|
|
|
|
!strcmp(label, "screenshot_directory") ||
|
|
|
|
!strcmp(label, "joypad_autoconfig_dir") ||
|
2014-09-15 02:12:27 +00:00
|
|
|
!strcmp(label, "playlist_directory") ||
|
2014-09-04 01:31:44 +00:00
|
|
|
!strcmp(label, "extraction_directory") ||
|
|
|
|
!strcmp(label, "system_directory"))
|
2014-08-31 22:27:09 +00:00
|
|
|
return MENU_FILE_DIRECTORY;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2014-09-24 04:46:18 +00:00
|
|
|
|
|
|
|
int menu_common_core_setting_toggle(unsigned setting, unsigned action)
|
|
|
|
{
|
|
|
|
unsigned index = setting - MENU_SETTINGS_CORE_OPTION_START;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
core_option_prev(g_extern.system.core_options, index);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
core_option_next(g_extern.system.core_options, index);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
core_option_set_default(g_extern.system.core_options, index);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_common_setting_set_perf(unsigned setting, unsigned action,
|
|
|
|
struct retro_perf_counter **counters, unsigned offset)
|
|
|
|
{
|
|
|
|
if (counters[offset] && action == MENU_ACTION_START)
|
|
|
|
{
|
|
|
|
counters[offset]->total = 0;
|
|
|
|
counters[offset]->call_cnt = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|