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
|
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 <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
2013-11-04 10:57:24 +00:00
|
|
|
#include <ctype.h>
|
2013-04-17 21:31:49 +00:00
|
|
|
#include "menu_common.h"
|
2014-02-28 22:14:42 +00:00
|
|
|
#include "menu_navigation.h"
|
2013-04-17 21:31:49 +00:00
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
#include "../../gfx/gfx_common.h"
|
2013-08-10 23:16:08 +00:00
|
|
|
#include "../../performance.h"
|
2013-09-29 15:58:46 +00:00
|
|
|
#include "../../driver.h"
|
2013-04-17 21:31:49 +00:00
|
|
|
#include "../../file.h"
|
2013-11-04 10:53:25 +00:00
|
|
|
#include "../../file_ext.h"
|
2013-09-29 15:58:46 +00:00
|
|
|
#include "../../input/input_common.h"
|
2013-04-17 21:31:49 +00:00
|
|
|
|
|
|
|
#include "../../compat/posix_string.h"
|
|
|
|
|
|
|
|
rgui_handle_t *rgui;
|
2013-09-19 15:41:56 +00:00
|
|
|
const menu_ctx_driver_t *menu_ctx;
|
2013-04-17 21:31:49 +00:00
|
|
|
|
2014-03-02 13:07:07 +00:00
|
|
|
static void menu_update_system_info(void *data, bool *load_no_rom)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
|
2014-03-05 21:39:00 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-03-02 13:07:07 +00:00
|
|
|
libretro_free_system_info(&rgui->info);
|
|
|
|
if (!path_is_directory(g_settings.libretro))
|
|
|
|
{
|
|
|
|
libretro_get_system_info(g_settings.libretro, &rgui->info, load_no_rom);
|
2014-03-05 21:39:00 +00:00
|
|
|
#endif
|
2014-03-02 13:07:07 +00:00
|
|
|
// Keep track of info for the currently selected core.
|
|
|
|
if (rgui->core_info)
|
|
|
|
{
|
|
|
|
if (core_info_list_get_info(rgui->core_info, &rgui->core_info_current, g_settings.libretro))
|
|
|
|
{
|
|
|
|
const core_info_t *info = &rgui->core_info_current;
|
|
|
|
|
|
|
|
RARCH_LOG("[Core Info]:\n");
|
|
|
|
if (info->display_name)
|
|
|
|
RARCH_LOG(" Display Name: %s\n", info->display_name);
|
|
|
|
if (info->supported_extensions)
|
|
|
|
RARCH_LOG(" Supported Extensions: %s\n", info->supported_extensions);
|
|
|
|
if (info->authors)
|
|
|
|
RARCH_LOG(" Authors: %s\n", info->authors);
|
|
|
|
if (info->permissions)
|
|
|
|
RARCH_LOG(" Permissions: %s\n", info->permissions);
|
|
|
|
}
|
|
|
|
}
|
2014-03-05 21:39:00 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-03-02 13:07:07 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-03-05 21:39:00 +00:00
|
|
|
}
|
2014-03-02 13:07:07 +00:00
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
//forward decl
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_iterate_func(void *data, void *video_data, unsigned action);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
2013-04-17 21:31:49 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2013-11-08 14:38:18 +00:00
|
|
|
void shader_manager_init(void *data)
|
2013-04-17 21:31:49 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-09-15 18:14:05 +00:00
|
|
|
memset(&rgui->shader, 0, sizeof(rgui->shader));
|
2013-04-17 21:31:49 +00:00
|
|
|
config_file_t *conf = NULL;
|
2013-09-15 18:34:36 +00:00
|
|
|
|
2014-01-03 14:31:10 +00:00
|
|
|
const char *config_path = NULL;
|
|
|
|
if (*g_extern.core_specific_config_path && g_settings.core_specific_config)
|
|
|
|
config_path = g_extern.core_specific_config_path;
|
|
|
|
else if (*g_extern.config_path)
|
|
|
|
config_path = g_extern.config_path;
|
|
|
|
|
2013-09-15 18:34:36 +00:00
|
|
|
// In a multi-config setting, we can't have conflicts on rgui.cgp/rgui.glslp.
|
2014-01-03 14:31:10 +00:00
|
|
|
if (config_path)
|
2013-09-15 18:34:36 +00:00
|
|
|
{
|
2014-01-03 14:31:10 +00:00
|
|
|
fill_pathname_base(rgui->default_glslp, config_path, sizeof(rgui->default_glslp));
|
2013-09-15 18:34:36 +00:00
|
|
|
path_remove_extension(rgui->default_glslp);
|
|
|
|
strlcat(rgui->default_glslp, ".glslp", sizeof(rgui->default_glslp));
|
2014-01-03 14:31:10 +00:00
|
|
|
fill_pathname_base(rgui->default_cgp, config_path, sizeof(rgui->default_cgp));
|
2013-09-15 18:34:36 +00:00
|
|
|
path_remove_extension(rgui->default_cgp);
|
|
|
|
strlcat(rgui->default_cgp, ".cgp", sizeof(rgui->default_cgp));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strlcpy(rgui->default_glslp, "rgui.glslp", sizeof(rgui->default_glslp));
|
|
|
|
strlcpy(rgui->default_cgp, "rgui.cgp", sizeof(rgui->default_cgp));
|
|
|
|
}
|
|
|
|
|
2013-04-17 21:31:49 +00:00
|
|
|
char cgp_path[PATH_MAX];
|
|
|
|
|
|
|
|
const char *ext = path_get_extension(g_settings.video.shader_path);
|
|
|
|
if (strcmp(ext, "glslp") == 0 || strcmp(ext, "cgp") == 0)
|
|
|
|
{
|
|
|
|
conf = config_file_new(g_settings.video.shader_path);
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
|
|
|
gfx_shader_resolve_relative(&rgui->shader, g_settings.video.shader_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(ext, "glsl") == 0 || strcmp(ext, "cg") == 0)
|
|
|
|
{
|
|
|
|
strlcpy(rgui->shader.pass[0].source.cg, g_settings.video.shader_path,
|
|
|
|
sizeof(rgui->shader.pass[0].source.cg));
|
|
|
|
rgui->shader.passes = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *shader_dir = *g_settings.video.shader_dir ?
|
|
|
|
g_settings.video.shader_dir : g_settings.system_directory;
|
|
|
|
|
|
|
|
fill_pathname_join(cgp_path, shader_dir, "rgui.glslp", sizeof(cgp_path));
|
|
|
|
conf = config_file_new(cgp_path);
|
|
|
|
|
|
|
|
if (!conf)
|
|
|
|
{
|
|
|
|
fill_pathname_join(cgp_path, shader_dir, "rgui.cgp", sizeof(cgp_path));
|
|
|
|
conf = config_file_new(cgp_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
|
|
|
gfx_shader_resolve_relative(&rgui->shader, cgp_path);
|
|
|
|
config_file_free(conf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-30 00:17:15 +00:00
|
|
|
void shader_manager_set_preset(struct gfx_shader *shader, enum rarch_shader_type type, const char *path)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Setting RGUI shader: %s.\n", path ? path : "N/A (stock)");
|
|
|
|
bool ret = video_set_shader_func(type, path);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
// Makes sure that we use RGUI CGP shader on driver reinit.
|
|
|
|
// Only do this when the cgp actually works to avoid potential errors.
|
|
|
|
strlcpy(g_settings.video.shader_path, path ? path : "",
|
|
|
|
sizeof(g_settings.video.shader_path));
|
|
|
|
g_settings.video.shader_enable = true;
|
|
|
|
|
|
|
|
if (path && shader)
|
|
|
|
{
|
|
|
|
// Load stored CGP into RGUI menu on success.
|
|
|
|
// Used when a preset is directly loaded.
|
|
|
|
// No point in updating when the CGP was created from RGUI itself.
|
|
|
|
config_file_t *conf = config_file_new(path);
|
|
|
|
if (conf)
|
|
|
|
{
|
|
|
|
gfx_shader_read_conf_cgp(conf, shader);
|
|
|
|
gfx_shader_resolve_relative(shader, path);
|
|
|
|
config_file_free(conf);
|
|
|
|
}
|
|
|
|
|
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_ERR("Setting RGUI CGP failed.\n");
|
|
|
|
g_settings.video.shader_enable = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-17 21:31:49 +00:00
|
|
|
void shader_manager_get_str(struct gfx_shader *shader,
|
|
|
|
char *type_str, size_t type_str_size, unsigned type)
|
|
|
|
{
|
|
|
|
if (type == RGUI_SETTINGS_SHADER_APPLY)
|
|
|
|
*type_str = '\0';
|
|
|
|
else if (type == RGUI_SETTINGS_SHADER_PASSES)
|
|
|
|
snprintf(type_str, type_str_size, "%u", shader->passes);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned pass = (type - RGUI_SETTINGS_SHADER_0) / 3;
|
|
|
|
switch ((type - RGUI_SETTINGS_SHADER_0) % 3)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (*shader->pass[pass].source.cg)
|
|
|
|
fill_pathname_base(type_str,
|
|
|
|
shader->pass[pass].source.cg, type_str_size);
|
|
|
|
else
|
|
|
|
strlcpy(type_str, "N/A", type_str_size);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
switch (shader->pass[pass].filter)
|
|
|
|
{
|
|
|
|
case RARCH_FILTER_LINEAR:
|
|
|
|
strlcpy(type_str, "Linear", type_str_size);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RARCH_FILTER_NEAREST:
|
|
|
|
strlcpy(type_str, "Nearest", type_str_size);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RARCH_FILTER_UNSPEC:
|
|
|
|
strlcpy(type_str, "Don't care", type_str_size);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
unsigned scale = shader->pass[pass].fbo.scale_x;
|
|
|
|
if (!scale)
|
|
|
|
strlcpy(type_str, "Don't care", type_str_size);
|
|
|
|
else
|
|
|
|
snprintf(type_str, type_str_size, "%ux", scale);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-17 16:22:03 +00:00
|
|
|
void menu_rom_history_push(const char *path,
|
|
|
|
const char *core_path,
|
|
|
|
const char *core_name)
|
|
|
|
{
|
|
|
|
if (rgui->history)
|
|
|
|
rom_history_push(rgui->history, path, core_path, core_name);
|
|
|
|
}
|
|
|
|
|
2013-05-17 16:33:16 +00:00
|
|
|
void menu_rom_history_push_current(void)
|
|
|
|
{
|
|
|
|
// g_extern.fullpath can be relative here.
|
|
|
|
// Ensure we're pushing absolute path.
|
|
|
|
|
|
|
|
char tmp[PATH_MAX];
|
2013-05-30 20:53:40 +00:00
|
|
|
|
|
|
|
// We loaded a zip, and fullpath points to the extracted file.
|
|
|
|
// Look at basename instead.
|
|
|
|
if (g_extern.rom_file_temporary)
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s.zip", g_extern.basename);
|
|
|
|
else
|
|
|
|
strlcpy(tmp, g_extern.fullpath, sizeof(tmp));
|
|
|
|
|
2013-05-17 16:33:16 +00:00
|
|
|
if (*tmp)
|
|
|
|
path_resolve_realpath(tmp, sizeof(tmp));
|
|
|
|
|
2013-11-03 04:49:46 +00:00
|
|
|
if (g_extern.system.no_game || *tmp)
|
|
|
|
menu_rom_history_push(*tmp ? tmp : NULL,
|
|
|
|
g_settings.libretro,
|
|
|
|
g_extern.system.info.library_name);
|
2013-05-17 16:33:16 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
void load_menu_game_prepare(void *video_data)
|
2013-04-28 14:38:13 +00:00
|
|
|
{
|
2013-05-02 12:42:58 +00:00
|
|
|
if (*g_extern.fullpath || rgui->load_no_rom)
|
2013-04-28 14:38:13 +00:00
|
|
|
{
|
2013-10-10 23:28:26 +00:00
|
|
|
if (*g_extern.fullpath)
|
2013-04-28 15:30:08 +00:00
|
|
|
{
|
|
|
|
char tmp[PATH_MAX];
|
|
|
|
char str[PATH_MAX];
|
2013-04-28 14:38:13 +00:00
|
|
|
|
2013-04-28 15:30:08 +00:00
|
|
|
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);
|
|
|
|
}
|
2013-04-28 14:38:13 +00:00
|
|
|
|
2013-11-03 14:17:45 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
if (g_extern.system.no_game || *g_extern.fullpath)
|
|
|
|
#endif
|
2013-11-03 09:46:10 +00:00
|
|
|
menu_rom_history_push(*g_extern.fullpath ? g_extern.fullpath : NULL,
|
|
|
|
g_settings.libretro,
|
|
|
|
rgui->info.library_name ? rgui->info.library_name : "");
|
2013-04-28 14:38:13 +00:00
|
|
|
}
|
|
|
|
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2013-04-29 20:01:41 +00:00
|
|
|
// redraw RGUI frame
|
|
|
|
rgui->old_input_state = rgui->trigger_state = 0;
|
|
|
|
rgui->do_held = false;
|
|
|
|
rgui->msg_force = true;
|
2013-09-19 12:49:07 +00:00
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_ctx)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_iterate_func(rgui, video_data, RGUI_ACTION_NOOP);
|
2013-04-29 20:01:41 +00:00
|
|
|
#endif
|
|
|
|
|
2013-04-28 14:38:13 +00:00
|
|
|
// Draw frame for loading message
|
|
|
|
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->set_texture_enable(video_data, rgui->frame_buf_show, MENU_TEXTURE_FULLSCREEN);
|
2013-04-28 14:38:13 +00:00
|
|
|
|
2013-04-28 14:58:58 +00:00
|
|
|
if (driver.video)
|
|
|
|
rarch_render_cached_frame();
|
2013-04-28 14:38:13 +00:00
|
|
|
|
|
|
|
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->set_texture_enable(video_data, false,
|
2013-04-28 14:38:13 +00:00
|
|
|
MENU_TEXTURE_FULLSCREEN);
|
|
|
|
}
|
|
|
|
|
2013-04-29 01:10:26 +00:00
|
|
|
void load_menu_game_history(unsigned game_index)
|
2013-04-29 01:05:46 +00:00
|
|
|
{
|
|
|
|
const char *path = NULL;
|
2013-08-25 09:07:06 +00:00
|
|
|
const char *core_path = NULL;
|
2013-04-29 01:05:46 +00:00
|
|
|
const char *core_name = NULL;
|
|
|
|
|
|
|
|
rom_history_get_index(rgui->history,
|
2013-08-25 09:07:06 +00:00
|
|
|
game_index, &path, &core_path, &core_name);
|
2013-04-29 01:05:46 +00:00
|
|
|
|
2014-01-03 20:32:42 +00:00
|
|
|
// SET_LIBRETRO_PATH is unsafe here.
|
|
|
|
// Risks booting different and wrong core if core doesn't exist anymore.
|
|
|
|
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
|
2013-05-02 12:42:58 +00:00
|
|
|
|
|
|
|
if (path)
|
|
|
|
rgui->load_no_rom = false;
|
|
|
|
else
|
|
|
|
rgui->load_no_rom = true;
|
2013-04-29 01:05:46 +00:00
|
|
|
|
2013-08-25 09:07:06 +00:00
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path);
|
2013-08-24 23:37:15 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_DYNAMIC)
|
2014-03-02 13:07:07 +00:00
|
|
|
menu_update_system_info(rgui, NULL);
|
2013-04-29 01:05:46 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-09-15 13:36:45 +00:00
|
|
|
static void menu_init_history(void)
|
|
|
|
{
|
|
|
|
if (rgui->history)
|
|
|
|
{
|
|
|
|
rom_history_free(rgui->history);
|
|
|
|
rgui->history = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*g_extern.config_path)
|
|
|
|
{
|
|
|
|
char history_path[PATH_MAX];
|
|
|
|
if (*g_settings.game_history_path)
|
|
|
|
strlcpy(history_path, g_settings.game_history_path, sizeof(history_path));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fill_pathname_resolve_relative(history_path, g_extern.config_path,
|
|
|
|
".retroarch-game-history.txt", sizeof(history_path));
|
|
|
|
}
|
|
|
|
|
|
|
|
RARCH_LOG("[RGUI]: Opening history: %s.\n", history_path);
|
|
|
|
rgui->history = rom_history_init(history_path, g_settings.game_history_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void menu_update_libretro_info(void)
|
|
|
|
{
|
2013-09-27 16:00:54 +00:00
|
|
|
*rgui->libretro_dir = '\0';
|
2013-10-06 15:09:36 +00:00
|
|
|
|
2013-09-15 13:36:45 +00:00
|
|
|
if (path_is_directory(g_settings.libretro))
|
|
|
|
strlcpy(rgui->libretro_dir, g_settings.libretro, sizeof(rgui->libretro_dir));
|
|
|
|
else if (*g_settings.libretro)
|
|
|
|
fill_pathname_basedir(rgui->libretro_dir, g_settings.libretro, sizeof(rgui->libretro_dir));
|
2013-10-05 15:07:56 +00:00
|
|
|
|
2013-10-31 01:53:01 +00:00
|
|
|
#ifndef HAVE_DYNAMIC
|
|
|
|
retro_get_system_info(&rgui->info);
|
|
|
|
#endif
|
|
|
|
|
2014-03-02 13:07:07 +00:00
|
|
|
memset(&rgui->core_info_current, 0, sizeof(rgui->core_info_current));
|
2013-10-05 15:07:56 +00:00
|
|
|
core_info_list_free(rgui->core_info);
|
|
|
|
rgui->core_info = NULL;
|
|
|
|
if (*rgui->libretro_dir)
|
|
|
|
rgui->core_info = core_info_list_new(rgui->libretro_dir);
|
2014-03-02 13:07:07 +00:00
|
|
|
|
|
|
|
menu_update_system_info(rgui, NULL);
|
2013-09-15 13:36:45 +00:00
|
|
|
}
|
|
|
|
|
2014-01-23 19:00:25 +00:00
|
|
|
void load_menu_game_prepare_dummy(void)
|
|
|
|
{
|
|
|
|
// Starts dummy core.
|
|
|
|
*g_extern.fullpath = '\0';
|
|
|
|
rgui->load_no_rom = false;
|
|
|
|
|
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
|
|
|
|
g_extern.system.shutdown = false;
|
|
|
|
}
|
|
|
|
|
2013-04-28 14:38:13 +00:00
|
|
|
bool load_menu_game(void)
|
|
|
|
{
|
|
|
|
if (g_extern.main_is_init)
|
|
|
|
rarch_main_deinit();
|
|
|
|
|
|
|
|
struct rarch_main_wrap args = {0};
|
|
|
|
|
|
|
|
args.verbose = g_extern.verbose;
|
|
|
|
args.config_path = *g_extern.config_path ? g_extern.config_path : NULL;
|
|
|
|
args.sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
|
|
|
|
args.state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL;
|
2013-04-28 14:58:58 +00:00
|
|
|
args.rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
|
2013-09-15 13:36:45 +00:00
|
|
|
args.libretro_path = *g_settings.libretro ? g_settings.libretro : NULL;
|
2013-05-02 12:42:58 +00:00
|
|
|
args.no_rom = rgui->load_no_rom;
|
2013-05-04 12:55:29 +00:00
|
|
|
rgui->load_no_rom = false;
|
2013-04-28 14:38:13 +00:00
|
|
|
|
|
|
|
if (rarch_main_init_wrap(&args) == 0)
|
|
|
|
{
|
|
|
|
RARCH_LOG("rarch_main_init_wrap() succeeded.\n");
|
2013-09-15 18:14:05 +00:00
|
|
|
// Update menu state which depends on config.
|
2013-09-15 13:36:45 +00:00
|
|
|
menu_update_libretro_info();
|
|
|
|
menu_init_history();
|
2013-09-27 16:54:47 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2013-09-15 18:14:05 +00:00
|
|
|
shader_manager_init(rgui);
|
2013-09-27 16:54:47 +00:00
|
|
|
#endif
|
2013-04-28 14:38:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-01 01:45:02 +00:00
|
|
|
char name[PATH_MAX];
|
|
|
|
char msg[PATH_MAX];
|
|
|
|
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);
|
|
|
|
rgui->msg_force = true;
|
2013-04-28 14:38:13 +00:00
|
|
|
RARCH_ERR("rarch_main_init_wrap() failed.\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
void menu_init(void *video_data)
|
2013-04-18 12:57:28 +00:00
|
|
|
{
|
2014-03-07 05:28:28 +00:00
|
|
|
if (!menu_ctx_init_first(&menu_ctx, ((void**)&rgui), video_data))
|
2013-04-18 13:13:53 +00:00
|
|
|
{
|
|
|
|
RARCH_ERR("Could not initialize menu.\n");
|
|
|
|
rarch_fail(1, "menu_init()");
|
|
|
|
}
|
2013-04-18 16:33:03 +00:00
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
rgui->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
|
|
rgui->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
|
|
file_list_push(rgui->menu_stack, "", RGUI_SETTINGS, 0);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 12:18:07 +00:00
|
|
|
rgui->push_start_screen = g_settings.rgui_show_start_screen;
|
|
|
|
g_settings.rgui_show_start_screen = false;
|
|
|
|
menu_populate_entries(rgui, RGUI_SETTINGS);
|
|
|
|
|
2013-04-19 15:53:01 +00:00
|
|
|
rgui->trigger_state = 0;
|
|
|
|
rgui->old_input_state = 0;
|
|
|
|
rgui->do_held = false;
|
|
|
|
rgui->frame_buf_show = true;
|
2013-05-04 14:13:58 +00:00
|
|
|
rgui->current_pad = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2013-09-15 13:36:45 +00:00
|
|
|
menu_update_libretro_info();
|
2013-04-22 20:14:25 +00:00
|
|
|
|
2013-04-18 16:33:03 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
shader_manager_init(rgui);
|
|
|
|
#endif
|
2013-04-28 01:48:35 +00:00
|
|
|
|
2013-09-15 13:36:45 +00:00
|
|
|
menu_init_history();
|
2013-07-06 18:39:19 +00:00
|
|
|
rgui->last_time = rarch_get_time_usec();
|
2013-04-18 12:57:28 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
void menu_free(void *video_data)
|
2013-04-18 12:57:28 +00:00
|
|
|
{
|
2013-09-19 12:49:07 +00:00
|
|
|
if (menu_ctx && menu_ctx->free)
|
|
|
|
menu_ctx->free(rgui);
|
2013-04-18 15:29:04 +00:00
|
|
|
|
2014-03-06 01:14:38 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2013-11-04 12:18:07 +00:00
|
|
|
libretro_free_system_info(&rgui->info);
|
2014-03-06 01:14:38 +00:00
|
|
|
#endif
|
2013-11-04 12:18:07 +00:00
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_free(rgui->menu_stack);
|
|
|
|
file_list_free(rgui->selection_buf);
|
2013-11-04 12:18:07 +00:00
|
|
|
|
2013-04-28 01:48:35 +00:00
|
|
|
rom_history_free(rgui->history);
|
2013-10-05 15:07:56 +00:00
|
|
|
core_info_list_free(rgui->core_info);
|
2013-04-28 01:48:35 +00:00
|
|
|
|
2013-04-18 15:29:04 +00:00
|
|
|
free(rgui);
|
2013-04-18 12:57:28 +00:00
|
|
|
}
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2013-05-05 19:42:14 +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);
|
|
|
|
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
|
|
|
{
|
|
|
|
// Wrap long strings in options with some kind of ticker line.
|
|
|
|
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);
|
|
|
|
|
|
|
|
// Ticker period: [Wait at left (2 ticks), Progress to right (type_len - w), Wait at right (2 ticks), Progress to left].
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-11-08 03:36:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2014-02-01 21:30:03 +00:00
|
|
|
uint64_t menu_input(void)
|
2013-05-27 09:11:23 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
2013-05-27 09:11:23 +00:00
|
|
|
uint64_t input_state = 0;
|
|
|
|
|
2013-12-26 19:11:15 +00:00
|
|
|
#ifdef RARCH_CONSOLE
|
2013-12-12 19:50:13 +00:00
|
|
|
static const struct retro_keybind *binds[] = { g_settings.input.menu_binds };
|
2013-12-12 21:10:11 +00:00
|
|
|
#else
|
|
|
|
static const struct retro_keybind *binds[] = { g_settings.input.binds[0] };
|
|
|
|
#endif
|
2013-05-27 09:11:23 +00:00
|
|
|
|
2014-01-08 16:31:14 +00:00
|
|
|
input_push_analog_dpad((struct retro_keybind*)binds[0], g_settings.input.analog_dpad_mode[0]);
|
2014-01-08 16:47:07 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
input_push_analog_dpad(g_settings.input.autoconf_binds[i], g_settings.input.analog_dpad_mode[i]);
|
2014-01-08 16:31:14 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < RETRO_DEVICE_ID_JOYPAD_R2; i++)
|
2013-05-27 09:11:23 +00:00
|
|
|
{
|
|
|
|
input_state |= input_input_state_func(binds,
|
2013-09-27 12:31:16 +00:00
|
|
|
0, RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
2013-05-27 09:11:23 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2013-09-27 12:31:16 +00:00
|
|
|
input_state |= (driver.overlay_state.buttons & (UINT64_C(1) << i)) ? (1ULL << i) : 0;
|
2013-05-27 09:11:23 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-09-27 12:31:16 +00:00
|
|
|
input_state |= input_key_pressed_func(RARCH_MENU_TOGGLE) ? (1ULL << RARCH_MENU_TOGGLE) : 0;
|
2013-05-27 09:11:23 +00:00
|
|
|
|
2014-01-08 16:31:14 +00:00
|
|
|
input_pop_analog_dpad((struct retro_keybind*)binds[0]);
|
2014-01-08 16:47:07 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
input_pop_analog_dpad(g_settings.input.autoconf_binds[i]);
|
2014-01-08 16:31:14 +00:00
|
|
|
|
2013-05-27 09:11:23 +00:00
|
|
|
rgui->trigger_state = input_state & ~rgui->old_input_state;
|
|
|
|
|
|
|
|
rgui->do_held = (input_state & (
|
2013-09-27 12:31:16 +00:00
|
|
|
(1ULL << RETRO_DEVICE_ID_JOYPAD_UP)
|
|
|
|
| (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN)
|
|
|
|
| (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT)
|
|
|
|
| (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
|
|
|
|
| (1ULL << RETRO_DEVICE_ID_JOYPAD_L)
|
|
|
|
| (1ULL << RETRO_DEVICE_ID_JOYPAD_R)
|
|
|
|
)) && !(input_state & (1ULL << RARCH_MENU_TOGGLE));
|
2013-05-27 09:11:23 +00:00
|
|
|
|
|
|
|
return input_state;
|
|
|
|
}
|
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
// This only makes sense for PC so far.
|
|
|
|
// Consoles use set_keybind callbacks instead.
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_custom_bind_iterate(void *data, void *video_data, unsigned action)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-11-04 15:23:37 +00:00
|
|
|
(void)action; // Have to ignore action here. Only bind that should work here is Quit RetroArch or something like that.
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render(rgui, video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
char msg[256];
|
|
|
|
snprintf(msg, sizeof(msg), "[%s]\npress joypad\n(RETURN to skip)", input_config_bind_map[rgui->binds.begin - RGUI_SETTINGS_BIND_BEGIN].desc);
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render_messagebox)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render_messagebox(rgui, video_data, msg);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
struct rgui_bind_state binds = rgui->binds;
|
|
|
|
menu_poll_bind_state(&binds);
|
|
|
|
|
|
|
|
if ((binds.skip && !rgui->binds.skip) || menu_poll_find_trigger(&rgui->binds, &binds))
|
|
|
|
{
|
|
|
|
binds.begin++;
|
|
|
|
if (binds.begin <= binds.last)
|
|
|
|
binds.target++;
|
|
|
|
else
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
// Avoid new binds triggering things right away.
|
|
|
|
rgui->trigger_state = 0;
|
|
|
|
rgui->old_input_state = -1ULL;
|
|
|
|
}
|
|
|
|
rgui->binds = binds;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_start_screen_iterate(void *data, void *video_data, unsigned action)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
char msg[1024];
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render(rgui, video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
char desc[6][64];
|
|
|
|
static const unsigned binds[] = {
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
|
|
|
RARCH_MENU_TOGGLE,
|
|
|
|
RARCH_QUIT_KEY,
|
|
|
|
};
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(binds); i++)
|
|
|
|
{
|
|
|
|
if (driver.input && driver.input->set_keybinds)
|
|
|
|
{
|
|
|
|
struct platform_bind key_label;
|
|
|
|
strlcpy(key_label.desc, "Unknown", sizeof(key_label.desc));
|
|
|
|
key_label.joykey = g_settings.input.binds[0][binds[i]].joykey;
|
|
|
|
driver.input->set_keybinds(&key_label, 0, 0, 0, 1ULL << KEYBINDS_ACTION_GET_BIND_LABEL);
|
|
|
|
strlcpy(desc[i], key_label.desc, sizeof(desc[i]));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const struct retro_keybind *bind = &g_settings.input.binds[0][binds[i]];
|
|
|
|
input_get_bind_string(desc[i], bind, sizeof(desc[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
"-- Welcome to RetroArch / RGUI --\n"
|
|
|
|
" \n" // strtok_r doesn't split empty strings.
|
|
|
|
|
|
|
|
"Basic RGUI controls:\n"
|
|
|
|
" Scroll (Up): %-20s\n"
|
|
|
|
" Scroll (Down): %-20s\n"
|
|
|
|
" Accept/OK: %-20s\n"
|
|
|
|
" Back: %-20s\n"
|
|
|
|
"Enter/Exit RGUI: %-20s\n"
|
|
|
|
" Exit RetroArch: %-20s\n"
|
|
|
|
" \n"
|
|
|
|
|
2013-11-26 20:41:27 +00:00
|
|
|
"To run content:\n"
|
2013-11-04 15:23:37 +00:00
|
|
|
"Load a libretro core (Core).\n"
|
2013-11-26 20:41:27 +00:00
|
|
|
"Load a content file (Load Content). \n"
|
2013-11-04 15:23:37 +00:00
|
|
|
" \n"
|
|
|
|
|
|
|
|
"See Path Options to set directories\n"
|
|
|
|
"for faster access to files.\n"
|
|
|
|
" \n"
|
|
|
|
|
|
|
|
"Press Accept/OK to continue.",
|
|
|
|
desc[0], desc[1], desc[2], desc[3], desc[4], desc[5]);
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render_messagebox)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render_messagebox(rgui, video_data, msg);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (action == RGUI_ACTION_OK)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_viewport_iterate(void *data, void *video_data, unsigned action)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-11-04 15:23:37 +00:00
|
|
|
rarch_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp;
|
|
|
|
|
|
|
|
unsigned menu_type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
struct retro_game_geometry *geom = &g_extern.system.av_info.geometry;
|
|
|
|
int stride_x = g_settings.video.scale_integer ?
|
|
|
|
geom->base_width : 1;
|
|
|
|
int stride_y = g_settings.video.scale_integer ?
|
|
|
|
geom->base_height : 1;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case RGUI_ACTION_UP:
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->y -= stride_y;
|
|
|
|
custom->height += stride_y;
|
|
|
|
}
|
|
|
|
else if (custom->height >= (unsigned)stride_y)
|
|
|
|
custom->height -= stride_y;
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_DOWN:
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->y += stride_y;
|
|
|
|
if (custom->height >= (unsigned)stride_y)
|
|
|
|
custom->height -= stride_y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
custom->height += stride_y;
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_LEFT:
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->x -= stride_x;
|
|
|
|
custom->width += stride_x;
|
|
|
|
}
|
|
|
|
else if (custom->width >= (unsigned)stride_x)
|
|
|
|
custom->width -= stride_x;
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_RIGHT:
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->x += stride_x;
|
|
|
|
if (custom->width >= (unsigned)stride_x)
|
|
|
|
custom->width -= stride_x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
custom->width += stride_x;
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_CANCEL:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, "",
|
2013-11-04 15:23:37 +00:00
|
|
|
RGUI_SETTINGS_CUSTOM_VIEWPORT,
|
|
|
|
rgui->selection_ptr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_OK:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT
|
|
|
|
&& !g_settings.video.scale_integer)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, "",
|
2013-11-04 15:23:37 +00:00
|
|
|
RGUI_SETTINGS_CUSTOM_VIEWPORT_2,
|
|
|
|
rgui->selection_ptr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_START:
|
|
|
|
if (!g_settings.video.scale_integer)
|
|
|
|
{
|
|
|
|
rarch_viewport_t vp;
|
2014-02-23 04:02:48 +00:00
|
|
|
|
|
|
|
if (driver.video && driver.video->viewport_info)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video->viewport_info(video_data, &vp);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->width += custom->x;
|
|
|
|
custom->height += custom->y;
|
|
|
|
custom->x = 0;
|
|
|
|
custom->y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
custom->width = vp.full_width - custom->x;
|
|
|
|
custom->height = vp.full_height - custom->y;
|
|
|
|
}
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_MESSAGE:
|
|
|
|
rgui->msg_force = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render(rgui, video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
const char *base_msg = NULL;
|
|
|
|
char msg[64];
|
|
|
|
|
|
|
|
if (g_settings.video.scale_integer)
|
|
|
|
{
|
|
|
|
custom->x = 0;
|
|
|
|
custom->y = 0;
|
|
|
|
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;
|
|
|
|
|
|
|
|
base_msg = "Set scale";
|
|
|
|
snprintf(msg, sizeof(msg), "%s (%4ux%4u, %u x %u scale)",
|
|
|
|
base_msg,
|
|
|
|
custom->width, custom->height,
|
|
|
|
custom->width / geom->base_width,
|
|
|
|
custom->height / geom->base_height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
base_msg = "Set Upper-Left Corner";
|
|
|
|
else if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
|
|
|
|
base_msg = "Set Bottom-Right Corner";
|
|
|
|
|
|
|
|
snprintf(msg, sizeof(msg), "%s (%d, %d : %4ux%4u)",
|
|
|
|
base_msg, custom->x, custom->y, custom->width, custom->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render_messagebox)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render_messagebox(rgui, video_data, msg);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->apply_state_changes)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->apply_state_changes(video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_settings_iterate(void *data, void *video_data, unsigned action)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->frame_buf_pitch = rgui->width * 2;
|
|
|
|
unsigned type = 0;
|
|
|
|
const char *label = NULL;
|
|
|
|
if (action != RGUI_ACTION_REFRESH)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_at_offset(rgui->selection_buf, rgui->selection_ptr, &label, &type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (type == RGUI_SETTINGS_CORE)
|
|
|
|
{
|
|
|
|
#if defined(HAVE_DYNAMIC)
|
|
|
|
label = rgui->libretro_dir;
|
|
|
|
#elif defined(HAVE_LIBRETRO_MANAGEMENT)
|
|
|
|
label = default_paths.core_dir;
|
|
|
|
#else
|
|
|
|
label = ""; // Shouldn't happen ...
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (type == RGUI_SETTINGS_CONFIG)
|
|
|
|
label = g_settings.rgui_config_directory;
|
|
|
|
else if (type == RGUI_SETTINGS_DISK_APPEND)
|
2014-01-12 20:23:38 +00:00
|
|
|
label = g_settings.rgui_content_directory;
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
const char *dir = NULL;
|
|
|
|
unsigned menu_type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (rgui->need_refresh)
|
|
|
|
action = RGUI_ACTION_NOOP;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case RGUI_ACTION_UP:
|
|
|
|
if (rgui->selection_ptr > 0)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_decrement_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
else
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_buf->size - 1);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_DOWN:
|
|
|
|
if (rgui->selection_ptr + 1 < rgui->selection_buf->size)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_increment_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
else
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_CANCEL:
|
|
|
|
if (rgui->menu_stack->size > 1)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_LEFT:
|
|
|
|
case RGUI_ACTION_RIGHT:
|
|
|
|
case RGUI_ACTION_OK:
|
|
|
|
case RGUI_ACTION_START:
|
|
|
|
if ((type == RGUI_SETTINGS_OPEN_FILEBROWSER || type == RGUI_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE)
|
|
|
|
&& action == RGUI_ACTION_OK)
|
|
|
|
{
|
|
|
|
rgui->defer_core = type == RGUI_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE;
|
2014-01-12 20:23:38 +00:00
|
|
|
file_list_push(rgui->menu_stack, g_settings.rgui_content_directory, RGUI_FILE_DIRECTORY, rgui->selection_ptr);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
else if ((type == RGUI_SETTINGS_OPEN_HISTORY || menu_type_is(type) == RGUI_FILE_DIRECTORY) && action == RGUI_ACTION_OK)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, "", type, rgui->selection_ptr);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
else if ((menu_type_is(type) == RGUI_SETTINGS || type == RGUI_SETTINGS_CORE || type == RGUI_SETTINGS_CONFIG || type == RGUI_SETTINGS_DISK_APPEND) && action == RGUI_ACTION_OK)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, label, type, rgui->selection_ptr);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
else if (type == RGUI_SETTINGS_CUSTOM_VIEWPORT && action == RGUI_ACTION_OK)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, "", type, rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
// Start with something sane.
|
|
|
|
rarch_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp;
|
2014-02-23 04:02:48 +00:00
|
|
|
|
|
|
|
if (driver.video && driver.video->viewport_info)
|
|
|
|
driver.video->viewport_info(driver.video_data, custom);
|
2013-11-04 15:23:37 +00:00
|
|
|
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
|
|
|
(float)custom->width / custom->height;
|
|
|
|
|
|
|
|
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_CUSTOM;
|
2014-01-08 18:42:17 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->set_aspect_ratio)
|
2013-11-04 15:23:37 +00:00
|
|
|
driver.video_poke->set_aspect_ratio(driver.video_data,
|
|
|
|
g_settings.video.aspect_ratio_idx);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-07 05:28:28 +00:00
|
|
|
int ret = menu_settings_toggle_setting(rgui, video_data, type, action, menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_REFRESH:
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_MESSAGE:
|
|
|
|
rgui->msg_force = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (rgui->need_refresh && !(menu_type == RGUI_FILE_DIRECTORY ||
|
|
|
|
menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS||
|
|
|
|
menu_type_is(menu_type) == RGUI_FILE_DIRECTORY ||
|
|
|
|
menu_type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
|
|
|
menu_type == RGUI_SETTINGS_CORE ||
|
|
|
|
menu_type == RGUI_SETTINGS_CONFIG ||
|
|
|
|
menu_type == RGUI_SETTINGS_DISK_APPEND ||
|
|
|
|
menu_type == RGUI_SETTINGS_OPEN_HISTORY))
|
|
|
|
{
|
|
|
|
rgui->need_refresh = false;
|
|
|
|
if (
|
|
|
|
menu_type == RGUI_SETTINGS_INPUT_OPTIONS
|
|
|
|
|| menu_type == RGUI_SETTINGS_PATH_OPTIONS
|
2014-02-25 15:40:12 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS
|
2014-03-02 03:46:26 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS
|
2013-11-04 15:23:37 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_OPTIONS
|
|
|
|
|| menu_type == RGUI_SETTINGS_DRIVERS
|
2014-03-03 09:11:07 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_CORE_INFO
|
2013-11-04 15:23:37 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_CORE_OPTIONS
|
|
|
|
|| menu_type == RGUI_SETTINGS_AUDIO_OPTIONS
|
|
|
|
|| menu_type == RGUI_SETTINGS_DISK_OPTIONS
|
2014-02-25 17:09:29 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_GENERAL_OPTIONS
|
2013-11-04 15:23:37 +00:00
|
|
|
|| menu_type == RGUI_SETTINGS_VIDEO_OPTIONS
|
|
|
|
|| menu_type == RGUI_SETTINGS_SHADER_OPTIONS
|
|
|
|
)
|
|
|
|
menu_populate_entries(rgui, menu_type);
|
|
|
|
else
|
|
|
|
menu_populate_entries(rgui, RGUI_SETTINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->render)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render(rgui, video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
// Have to defer it so we let settings refresh.
|
|
|
|
if (rgui->push_start_screen)
|
|
|
|
{
|
|
|
|
rgui->push_start_screen = false;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, "", RGUI_START_SCREEN, 0);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-08 14:38:18 +00:00
|
|
|
static void menu_flush_stack_type(void *data, unsigned final_type)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-11-04 15:23:37 +00:00
|
|
|
unsigned type;
|
|
|
|
type = 0;
|
|
|
|
rgui->need_refresh = true;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &type);
|
2013-11-04 15:23:37 +00:00
|
|
|
while (type != final_type)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &type);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-24 21:02:57 +00:00
|
|
|
void load_menu_game_new_core(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-03-02 13:07:07 +00:00
|
|
|
menu_update_system_info(rgui, &rgui->load_no_rom);
|
2013-11-24 21:02:57 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
|
|
|
#else
|
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)g_settings.libretro);
|
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)g_extern.fullpath);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
static int menu_iterate_func(void *data, void *video_data, unsigned action)
|
2013-11-04 15:23:37 +00:00
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
|
|
|
|
const char *dir = 0;
|
|
|
|
unsigned menu_type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->set_texture)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->set_texture(rgui, video_data, false);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
2013-11-15 22:19:44 +00:00
|
|
|
#ifdef HAVE_OSK
|
|
|
|
// process pending osk init callback
|
2013-11-16 14:56:52 +00:00
|
|
|
if (g_extern.osk.cb_init)
|
2013-11-15 22:19:44 +00:00
|
|
|
{
|
2013-11-16 14:54:50 +00:00
|
|
|
if (g_extern.osk.cb_init(driver.osk_data))
|
|
|
|
g_extern.osk.cb_init = NULL;
|
2013-11-15 22:19:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// process pending osk callback
|
2013-11-16 14:56:52 +00:00
|
|
|
if (g_extern.osk.cb_callback)
|
2013-11-15 22:19:44 +00:00
|
|
|
{
|
2013-11-16 14:54:50 +00:00
|
|
|
if (g_extern.osk.cb_callback(driver.osk_data))
|
|
|
|
g_extern.osk.cb_callback = NULL;
|
2013-11-15 22:19:44 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_type == RGUI_START_SCREEN)
|
2014-03-07 05:28:28 +00:00
|
|
|
return menu_start_screen_iterate(rgui, video_data, action);
|
2013-11-04 15:23:37 +00:00
|
|
|
else if (menu_type_is(menu_type) == RGUI_SETTINGS)
|
2014-03-07 05:28:28 +00:00
|
|
|
return menu_settings_iterate(rgui, video_data, action);
|
2013-11-04 15:23:37 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT || menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
|
2014-03-07 05:28:28 +00:00
|
|
|
return menu_viewport_iterate(rgui, video_data, action);
|
2013-11-04 15:23:37 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CUSTOM_BIND)
|
2014-03-07 05:28:28 +00:00
|
|
|
return menu_custom_bind_iterate(rgui, video_data, action);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (rgui->need_refresh && action != RGUI_ACTION_MESSAGE)
|
|
|
|
action = RGUI_ACTION_NOOP;
|
|
|
|
|
|
|
|
unsigned scroll_speed = (max(rgui->scroll_accel, 2) - 2) / 4 + 1;
|
|
|
|
unsigned fast_scroll_speed = 4 + 4 * scroll_speed;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case RGUI_ACTION_UP:
|
|
|
|
if (rgui->selection_ptr >= scroll_speed)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_ptr - scroll_speed);
|
2013-11-04 15:23:37 +00:00
|
|
|
else
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_buf->size - 1);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_DOWN:
|
|
|
|
if (rgui->selection_ptr + scroll_speed < rgui->selection_buf->size)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_ptr + scroll_speed);
|
2013-11-04 15:23:37 +00:00
|
|
|
else
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_LEFT:
|
|
|
|
if (rgui->selection_ptr > fast_scroll_speed)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_ptr - fast_scroll_speed);
|
2013-11-04 15:23:37 +00:00
|
|
|
else
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_RIGHT:
|
|
|
|
if (rgui->selection_ptr + fast_scroll_speed < rgui->selection_buf->size)
|
|
|
|
rgui->selection_ptr += fast_scroll_speed;
|
|
|
|
else
|
|
|
|
rgui->selection_ptr = rgui->selection_buf->size - 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_SCROLL_UP:
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_descend_alphabet(rgui, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
case RGUI_ACTION_SCROLL_DOWN:
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_ascend_alphabet(rgui, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_CANCEL:
|
|
|
|
if (rgui->menu_stack->size > 1)
|
|
|
|
{
|
|
|
|
rgui->need_refresh = true;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_OK:
|
|
|
|
{
|
|
|
|
if (rgui->selection_buf->size == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
const char *path = 0;
|
|
|
|
unsigned type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_at_offset(rgui->selection_buf, rgui->selection_ptr, &path, &type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (
|
|
|
|
menu_type_is(type) == RGUI_SETTINGS_SHADER_OPTIONS ||
|
|
|
|
menu_type_is(type) == RGUI_FILE_DIRECTORY ||
|
|
|
|
type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
|
|
|
type == RGUI_SETTINGS_CORE ||
|
|
|
|
type == RGUI_SETTINGS_CONFIG ||
|
|
|
|
type == RGUI_SETTINGS_DISK_APPEND ||
|
|
|
|
type == RGUI_FILE_DIRECTORY)
|
|
|
|
{
|
|
|
|
char cat_path[PATH_MAX];
|
|
|
|
fill_pathname_join(cat_path, dir, path, sizeof(cat_path));
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, cat_path, type, rgui->selection_ptr);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
if (menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS)
|
|
|
|
{
|
|
|
|
if (menu_type == RGUI_SETTINGS_SHADER_PRESET)
|
|
|
|
{
|
|
|
|
char shader_path[PATH_MAX];
|
|
|
|
fill_pathname_join(shader_path, dir, path, sizeof(shader_path));
|
|
|
|
shader_manager_set_preset(&rgui->shader, gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
|
|
|
|
shader_path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned pass = (menu_type - RGUI_SETTINGS_SHADER_0) / 3;
|
|
|
|
fill_pathname_join(rgui->shader.pass[pass].source.cg,
|
|
|
|
dir, path, sizeof(rgui->shader.pass[pass].source.cg));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pop stack until we hit shader manager again.
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_SHADER_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (menu_type == RGUI_SETTINGS_DEFERRED_CORE)
|
|
|
|
{
|
|
|
|
// FIXME: Add for consoles.
|
|
|
|
strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
|
|
|
|
strlcpy(g_extern.fullpath, rgui->deferred_path, sizeof(g_extern.fullpath));
|
2013-11-24 21:02:57 +00:00
|
|
|
load_menu_game_new_core();
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->msg_force = true;
|
|
|
|
ret = -1;
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_SETTINGS_CORE)
|
|
|
|
{
|
|
|
|
#if defined(HAVE_DYNAMIC)
|
|
|
|
fill_pathname_join(g_settings.libretro, dir, path, sizeof(g_settings.libretro));
|
2014-03-02 13:07:07 +00:00
|
|
|
menu_update_system_info(rgui, &rgui->load_no_rom);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
// No ROM needed for this core, load game immediately.
|
|
|
|
if (rgui->load_no_rom)
|
|
|
|
{
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
2013-11-04 15:23:37 +00:00
|
|
|
*g_extern.fullpath = '\0';
|
|
|
|
rgui->msg_force = true;
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Core selection on non-console just updates directory listing.
|
|
|
|
// Will take affect on new ROM load.
|
2013-11-05 11:31:14 +00:00
|
|
|
#elif defined(RARCH_CONSOLE)
|
2013-11-04 15:23:37 +00:00
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)path);
|
|
|
|
|
2013-11-05 09:51:23 +00:00
|
|
|
#if defined(GEKKO) && defined(HW_RVL)
|
2013-11-04 15:23:37 +00:00
|
|
|
fill_pathname_join(g_extern.fullpath, default_paths.core_dir,
|
|
|
|
SALAMANDER_FILE, sizeof(g_extern.fullpath));
|
2013-11-05 09:51:23 +00:00
|
|
|
#else
|
|
|
|
fill_pathname_join(g_settings.libretro, dir, path, sizeof(g_settings.libretro));
|
|
|
|
#endif
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
|
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN);
|
2013-11-04 15:23:37 +00:00
|
|
|
ret = -1;
|
|
|
|
#endif
|
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_SETTINGS_CONFIG)
|
|
|
|
{
|
|
|
|
char config[PATH_MAX];
|
|
|
|
fill_pathname_join(config, dir, path, sizeof(config));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->msg_force = true;
|
|
|
|
if (menu_replace_config(config))
|
|
|
|
{
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
else if (menu_type == RGUI_SETTINGS_OVERLAY_PRESET)
|
|
|
|
{
|
|
|
|
fill_pathname_join(g_settings.input.overlay, dir, path, sizeof(g_settings.input.overlay));
|
|
|
|
|
|
|
|
if (driver.overlay)
|
|
|
|
input_overlay_free(driver.overlay);
|
|
|
|
driver.overlay = input_overlay_new(g_settings.input.overlay);
|
|
|
|
if (!driver.overlay)
|
|
|
|
RARCH_ERR("Failed to load overlay.\n");
|
|
|
|
|
2014-02-25 15:40:12 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if (menu_type == RGUI_SETTINGS_DISK_APPEND)
|
|
|
|
{
|
|
|
|
char image[PATH_MAX];
|
|
|
|
fill_pathname_join(image, dir, path, sizeof(image));
|
|
|
|
rarch_disk_control_append_image(image);
|
|
|
|
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= 1ULL << MODE_GAME;
|
2013-11-04 15:23:37 +00:00
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY)
|
|
|
|
{
|
|
|
|
load_menu_game_history(rgui->selection_ptr);
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_BROWSER_DIR_PATH)
|
|
|
|
{
|
2013-12-26 01:03:11 +00:00
|
|
|
strlcpy(g_settings.rgui_content_directory, dir, sizeof(g_settings.rgui_content_directory));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#ifdef HAVE_SCREENSHOTS
|
|
|
|
else if (menu_type == RGUI_SCREENSHOT_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_settings.screenshot_directory, dir, sizeof(g_settings.screenshot_directory));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if (menu_type == RGUI_SAVEFILE_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_extern.savefile_dir, dir, sizeof(g_extern.savefile_dir));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
else if (menu_type == RGUI_OVERLAY_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_extern.overlay_dir, dir, sizeof(g_extern.overlay_dir));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_extern.savestate_dir, dir, sizeof(g_extern.savestate_dir));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_LIBRETRO_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(rgui->libretro_dir, dir, sizeof(rgui->libretro_dir));
|
|
|
|
menu_init_core_info(rgui);
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
2014-03-05 23:17:02 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2013-11-04 15:23:37 +00:00
|
|
|
else if (menu_type == RGUI_CONFIG_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_settings.rgui_config_directory, dir, sizeof(g_settings.rgui_config_directory));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if (menu_type == RGUI_LIBRETRO_INFO_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_settings.libretro_info_path, dir, sizeof(g_settings.libretro_info_path));
|
|
|
|
menu_init_core_info(rgui);
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_settings.video.shader_dir, dir, sizeof(g_settings.video.shader_dir));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else if (menu_type == RGUI_SYSTEM_DIR_PATH)
|
|
|
|
{
|
|
|
|
strlcpy(g_settings.system_directory, dir, sizeof(g_settings.system_directory));
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
2013-11-04 15:23:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rgui->defer_core)
|
|
|
|
{
|
|
|
|
fill_pathname_join(rgui->deferred_path, dir, path, sizeof(rgui->deferred_path));
|
|
|
|
|
|
|
|
const core_info_t *info = NULL;
|
|
|
|
size_t supported = 0;
|
|
|
|
if (rgui->core_info)
|
|
|
|
core_info_list_get_supported_cores(rgui->core_info, rgui->deferred_path, &info, &supported);
|
|
|
|
|
|
|
|
if (supported == 1) // Can make a decision right now.
|
|
|
|
{
|
|
|
|
strlcpy(g_extern.fullpath, rgui->deferred_path, sizeof(g_extern.fullpath));
|
|
|
|
strlcpy(g_settings.libretro, info->path, sizeof(g_settings.libretro));
|
|
|
|
|
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-03-02 13:07:07 +00:00
|
|
|
menu_update_system_info(rgui, &rgui->load_no_rom);
|
2013-11-07 23:28:49 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
2013-11-04 15:23:37 +00:00
|
|
|
#else
|
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)g_settings.libretro);
|
|
|
|
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)g_extern.fullpath);
|
|
|
|
#endif
|
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->msg_force = true;
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
else // Present a selection.
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->menu_stack, rgui->libretro_dir, RGUI_SETTINGS_DEFERRED_CORE, rgui->selection_ptr);
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fill_pathname_join(g_extern.fullpath, dir, path, sizeof(g_extern.fullpath));
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_flush_stack_type(rgui, RGUI_SETTINGS);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->msg_force = true;
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case RGUI_ACTION_REFRESH:
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-11-04 15:23:37 +00:00
|
|
|
rgui->need_refresh = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RGUI_ACTION_MESSAGE:
|
|
|
|
rgui->msg_force = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-15 04:18:36 +00:00
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
// refresh values in case the stack changed
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
if (rgui->need_refresh && (menu_type == RGUI_FILE_DIRECTORY ||
|
|
|
|
menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS ||
|
|
|
|
menu_type_is(menu_type) == RGUI_FILE_DIRECTORY ||
|
|
|
|
menu_type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
|
|
|
menu_type == RGUI_SETTINGS_DEFERRED_CORE ||
|
|
|
|
menu_type == RGUI_SETTINGS_CORE ||
|
|
|
|
menu_type == RGUI_SETTINGS_CONFIG ||
|
|
|
|
menu_type == RGUI_SETTINGS_OPEN_HISTORY ||
|
|
|
|
menu_type == RGUI_SETTINGS_DISK_APPEND))
|
|
|
|
{
|
|
|
|
rgui->need_refresh = false;
|
|
|
|
menu_parse_and_resolve(rgui, menu_type);
|
|
|
|
}
|
|
|
|
|
2013-11-19 05:35:11 +00:00
|
|
|
if (menu_ctx && menu_ctx->iterate)
|
|
|
|
menu_ctx->iterate(rgui, action);
|
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_ctx && menu_ctx->render)
|
2014-03-07 05:28:28 +00:00
|
|
|
menu_ctx->render(rgui, video_data);
|
2013-11-04 15:23:37 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-03-07 05:28:28 +00:00
|
|
|
bool menu_iterate(void *video_data)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
2013-12-17 18:10:21 +00:00
|
|
|
retro_time_t time, delta, target_msec, sleep_msec;
|
2013-11-04 15:23:37 +00:00
|
|
|
unsigned action;
|
2013-04-19 15:53:01 +00:00
|
|
|
static bool initial_held = true;
|
|
|
|
static bool first_held = false;
|
|
|
|
uint64_t input_state = 0;
|
2014-02-28 00:44:03 +00:00
|
|
|
int32_t input_entry_ret, ret;
|
|
|
|
|
|
|
|
input_entry_ret = 0;
|
|
|
|
ret = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2013-11-07 20:44:44 +00:00
|
|
|
if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
2013-05-05 13:20:45 +00:00
|
|
|
rgui->need_refresh = true;
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT);
|
2013-09-27 12:31:16 +00:00
|
|
|
rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
2013-12-09 15:18:58 +00:00
|
|
|
rarch_check_block_hotkey();
|
2013-04-19 15:53:01 +00:00
|
|
|
rarch_input_poll();
|
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
rarch_check_overlay();
|
|
|
|
#endif
|
2014-02-08 15:27:09 +00:00
|
|
|
rarch_check_fullscreen();
|
2013-04-19 15:53:01 +00:00
|
|
|
|
|
|
|
if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())
|
|
|
|
{
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
2013-04-19 15:53:01 +00:00
|
|
|
goto deinit;
|
|
|
|
}
|
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
input_state = menu_input();
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2013-04-20 22:01:49 +00:00
|
|
|
if (rgui->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;
|
2013-04-26 21:52:29 +00:00
|
|
|
rgui->delay_timer = initial_held ? 12 : 6;
|
|
|
|
rgui->delay_count = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
2013-04-26 21:52:29 +00:00
|
|
|
if (rgui->delay_count >= rgui->delay_timer)
|
2013-04-19 15:53:01 +00:00
|
|
|
{
|
|
|
|
first_held = false;
|
2013-04-26 21:52:29 +00:00
|
|
|
rgui->trigger_state = input_state;
|
2013-10-03 18:44:33 +00:00
|
|
|
rgui->scroll_accel = min(rgui->scroll_accel + 1, 64);
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
initial_held = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first_held = false;
|
|
|
|
initial_held = true;
|
2013-10-03 18:44:33 +00:00
|
|
|
rgui->scroll_accel = 0;
|
2013-04-19 15:53:01 +00:00
|
|
|
}
|
|
|
|
|
2013-04-26 21:52:29 +00:00
|
|
|
rgui->delay_count++;
|
2013-04-19 15:53:01 +00:00
|
|
|
rgui->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)
|
|
|
|
rgui->trigger_state = 0;
|
|
|
|
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_NOOP;
|
|
|
|
|
|
|
|
// don't run anything first frame, only capture held inputs for old_input_state
|
2013-09-27 12:31:16 +00:00
|
|
|
if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_UP;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_DOWN;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_LEFT;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_RIGHT;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_SCROLL_UP;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_SCROLL_DOWN;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_CANCEL;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
|
2013-09-26 20:34:06 +00:00
|
|
|
action = RGUI_ACTION_OK;
|
2013-09-27 12:31:16 +00:00
|
|
|
else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
|
2013-09-27 15:00:00 +00:00
|
|
|
action = RGUI_ACTION_START;
|
2013-09-26 20:34:06 +00:00
|
|
|
|
2013-11-04 15:23:37 +00:00
|
|
|
if (menu_ctx)
|
2014-03-07 05:28:28 +00:00
|
|
|
input_entry_ret = menu_iterate_func(rgui, video_data, action);
|
2013-04-19 15:53:01 +00:00
|
|
|
|
|
|
|
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->set_texture_enable(video_data, rgui->frame_buf_show, MENU_TEXTURE_FULLSCREEN);
|
2013-04-19 15:53:01 +00:00
|
|
|
|
|
|
|
rarch_render_cached_frame();
|
|
|
|
|
2013-07-06 18:39:19 +00:00
|
|
|
// Throttle in case VSync is broken (avoid 1000+ FPS RGUI).
|
2013-07-15 12:19:29 +00:00
|
|
|
time = rarch_get_time_usec();
|
|
|
|
delta = (time - rgui->last_time) / 1000;
|
2013-07-31 18:19:53 +00:00
|
|
|
target_msec = 750 / g_settings.video.refresh_rate; // Try to sleep less, so we can hopefully rely on FPS logger.
|
2013-07-15 12:19:29 +00:00
|
|
|
sleep_msec = target_msec - delta;
|
2013-07-06 18:39:19 +00:00
|
|
|
if (sleep_msec > 0)
|
2013-09-27 16:43:08 +00:00
|
|
|
rarch_sleep((unsigned int)sleep_msec);
|
2013-07-06 18:39:19 +00:00
|
|
|
rgui->last_time = rarch_get_time_usec();
|
|
|
|
|
2013-04-19 15:53:01 +00:00
|
|
|
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
2014-03-07 05:28:28 +00:00
|
|
|
driver.video_poke->set_texture_enable(video_data, false,
|
2013-04-20 08:56:04 +00:00
|
|
|
MENU_TEXTURE_FULLSCREEN);
|
2013-04-19 15:53:01 +00:00
|
|
|
|
2014-02-28 00:44:03 +00:00
|
|
|
if (menu_ctx && menu_ctx->input_postprocess)
|
|
|
|
ret = menu_ctx->input_postprocess(rgui, rgui->old_input_state);
|
2013-11-04 15:37:51 +00:00
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
unsigned type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &type);
|
2013-11-04 15:37:51 +00:00
|
|
|
while (type != RGUI_SETTINGS)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
|
|
|
|
file_list_get_last(rgui->menu_stack, NULL, &type);
|
2013-11-04 15:37:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret || input_entry_ret)
|
2013-04-19 15:53:01 +00:00
|
|
|
goto deinit;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
deinit:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2013-09-15 13:36:45 +00:00
|
|
|
|
|
|
|
// Quite intrusive and error prone.
|
|
|
|
// Likely to have lots of small bugs.
|
|
|
|
// Cleanly exit the main loop to ensure that all the tiny details get set properly.
|
|
|
|
// This should mitigate most of the smaller bugs.
|
|
|
|
bool menu_replace_config(const char *path)
|
|
|
|
{
|
|
|
|
if (strcmp(path, g_extern.config_path) == 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (g_extern.config_save_on_exit && *g_extern.config_path)
|
|
|
|
config_save_file(g_extern.config_path);
|
|
|
|
|
|
|
|
strlcpy(g_extern.config_path, path, sizeof(g_extern.config_path));
|
|
|
|
g_extern.block_config_read = false;
|
|
|
|
|
|
|
|
// Load dummy core.
|
|
|
|
*g_extern.fullpath = '\0';
|
|
|
|
*g_settings.libretro = '\0'; // Load core in new config.
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
2013-09-15 13:36:45 +00:00
|
|
|
rgui->load_no_rom = false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-09-22 10:48:33 +00:00
|
|
|
// Save a new config to a file. Filename is based on heuristics to avoid typing.
|
|
|
|
bool menu_save_new_config(void)
|
|
|
|
{
|
|
|
|
char config_dir[PATH_MAX];
|
|
|
|
*config_dir = '\0';
|
|
|
|
|
|
|
|
if (*g_settings.rgui_config_directory)
|
|
|
|
strlcpy(config_dir, g_settings.rgui_config_directory, sizeof(config_dir));
|
|
|
|
else if (*g_extern.config_path) // Fallback
|
|
|
|
fill_pathname_basedir(config_dir, g_extern.config_path, sizeof(config_dir));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *msg = "Config directory not set. Cannot save new config.";
|
|
|
|
msg_queue_clear(g_extern.msg_queue);
|
|
|
|
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
|
|
|
RARCH_ERR("%s\n", msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool found_path = false;
|
|
|
|
char config_name[PATH_MAX];
|
|
|
|
char config_path[PATH_MAX];
|
|
|
|
if (*g_settings.libretro && !path_is_directory(g_settings.libretro) && path_file_exists(g_settings.libretro)) // Infer file name based on libretro core.
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
2013-09-22 10:48:33 +00:00
|
|
|
// In case of collision, find an alternative name.
|
2013-10-22 13:08:17 +00:00
|
|
|
for (i = 0; i < 16; i++)
|
2013-09-22 10:48:33 +00:00
|
|
|
{
|
|
|
|
fill_pathname_base(config_name, g_settings.libretro, sizeof(config_name));
|
|
|
|
path_remove_extension(config_name);
|
|
|
|
fill_pathname_join(config_path, config_dir, config_name, sizeof(config_path));
|
|
|
|
|
|
|
|
char tmp[64];
|
|
|
|
*tmp = '\0';
|
|
|
|
if (i)
|
|
|
|
snprintf(tmp, sizeof(tmp), "-%u.cfg", i);
|
|
|
|
else
|
|
|
|
strlcpy(tmp, ".cfg", sizeof(tmp));
|
|
|
|
|
|
|
|
strlcat(config_path, tmp, sizeof(config_path));
|
|
|
|
|
|
|
|
if (!path_file_exists(config_path))
|
|
|
|
{
|
|
|
|
found_path = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to system time ...
|
|
|
|
if (!found_path)
|
|
|
|
{
|
|
|
|
RARCH_WARN("Cannot infer new config path. Use current time.\n");
|
|
|
|
fill_dated_filename(config_name, "cfg", sizeof(config_name));
|
|
|
|
fill_pathname_join(config_path, config_dir, config_name, sizeof(config_path));
|
|
|
|
}
|
|
|
|
|
|
|
|
char msg[512];
|
|
|
|
bool ret;
|
|
|
|
if (config_save_file(config_path))
|
|
|
|
{
|
|
|
|
strlcpy(g_extern.config_path, config_path, sizeof(g_extern.config_path));
|
|
|
|
snprintf(msg, sizeof(msg), "Saved new config to \"%s\".", config_path);
|
|
|
|
RARCH_LOG("%s\n", msg);
|
|
|
|
ret = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(msg, sizeof(msg), "Failed saving config to \"%s\".", config_path);
|
|
|
|
RARCH_ERR("%s\n", msg);
|
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
msg_queue_clear(g_extern.msg_queue);
|
|
|
|
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-09-29 15:58:46 +00:00
|
|
|
void menu_poll_bind_state(struct rgui_bind_state *state)
|
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
unsigned i, b, a, h;
|
2013-09-29 15:58:46 +00:00
|
|
|
memset(state->state, 0, sizeof(state->state));
|
|
|
|
state->skip = input_input_state_func(NULL, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
|
|
|
|
|
|
|
const rarch_joypad_driver_t *joypad = NULL;
|
|
|
|
if (driver.input && driver.input_data && driver.input->get_joypad_driver)
|
|
|
|
joypad = driver.input->get_joypad_driver(driver.input_data);
|
|
|
|
|
|
|
|
if (!joypad)
|
|
|
|
{
|
|
|
|
RARCH_ERR("Cannot poll raw joypad state.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
input_joypad_poll(joypad);
|
2013-11-04 10:32:43 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
for (b = 0; b < RGUI_MAX_BUTTONS; b++)
|
2013-11-04 10:32:43 +00:00
|
|
|
state->state[i].buttons[b] = input_joypad_button_raw(joypad, i, b);
|
2013-10-22 13:08:17 +00:00
|
|
|
for (a = 0; a < RGUI_MAX_AXES; a++)
|
2013-11-04 10:32:43 +00:00
|
|
|
state->state[i].axes[a] = input_joypad_axis_raw(joypad, i, a);
|
2013-10-22 13:08:17 +00:00
|
|
|
for (h = 0; h < RGUI_MAX_HATS; h++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_UP_MASK, h) ? HAT_UP_MASK : 0;
|
|
|
|
state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_DOWN_MASK, h) ? HAT_DOWN_MASK : 0;
|
|
|
|
state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_LEFT_MASK, h) ? HAT_LEFT_MASK : 0;
|
|
|
|
state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_RIGHT_MASK, h) ? HAT_RIGHT_MASK : 0;
|
2013-09-29 15:58:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-29 17:09:33 +00:00
|
|
|
void menu_poll_bind_get_rested_axes(struct rgui_bind_state *state)
|
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
unsigned i, a;
|
2013-09-29 17:09:33 +00:00
|
|
|
const rarch_joypad_driver_t *joypad = NULL;
|
|
|
|
if (driver.input && driver.input_data && driver.input->get_joypad_driver)
|
|
|
|
joypad = driver.input->get_joypad_driver(driver.input_data);
|
|
|
|
|
|
|
|
if (!joypad)
|
|
|
|
{
|
|
|
|
RARCH_ERR("Cannot poll raw joypad state.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-04 10:32:43 +00:00
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-10-22 13:08:17 +00:00
|
|
|
for (a = 0; a < RGUI_MAX_AXES; a++)
|
2013-11-04 10:32:43 +00:00
|
|
|
state->axis_state[i].rested_axes[a] = input_joypad_axis_raw(joypad, i, a);
|
2013-09-29 17:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool menu_poll_find_trigger_pad(struct rgui_bind_state *state, struct rgui_bind_state *new_state, unsigned p)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned a, b, h;
|
2013-09-29 15:58:46 +00:00
|
|
|
const struct rgui_bind_state_port *n = &new_state->state[p];
|
|
|
|
const struct rgui_bind_state_port *o = &state->state[p];
|
2013-09-29 17:09:33 +00:00
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (b = 0; b < RGUI_MAX_BUTTONS; b++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
|
|
|
if (n->buttons[b] && !o->buttons[b])
|
|
|
|
{
|
|
|
|
state->target->joykey = b;
|
|
|
|
state->target->joyaxis = AXIS_NONE;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-29 17:09:33 +00:00
|
|
|
// Axes are a bit tricky ...
|
2013-10-22 13:08:17 +00:00
|
|
|
for (a = 0; a < RGUI_MAX_AXES; a++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-09-29 17:09:33 +00:00
|
|
|
int locked_distance = abs(n->axes[a] - new_state->axis_state[p].locked_axes[a]);
|
|
|
|
int rested_distance = abs(n->axes[a] - new_state->axis_state[p].rested_axes[a]);
|
|
|
|
|
|
|
|
if (abs(n->axes[a]) >= 20000 &&
|
|
|
|
locked_distance >= 20000 &&
|
|
|
|
rested_distance >= 20000) // Take care of case where axis rests on +/- 0x7fff (e.g. 360 controller on Linux)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
|
|
|
state->target->joyaxis = n->axes[a] > 0 ? AXIS_POS(a) : AXIS_NEG(a);
|
|
|
|
state->target->joykey = NO_BTN;
|
2013-09-29 17:09:33 +00:00
|
|
|
|
|
|
|
// Lock the current axis.
|
|
|
|
new_state->axis_state[p].locked_axes[a] = n->axes[a] > 0 ? 0x7fff : -0x7fff;
|
2013-09-29 15:58:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
2013-09-29 17:09:33 +00:00
|
|
|
|
|
|
|
if (locked_distance >= 20000) // Unlock the axis.
|
|
|
|
new_state->axis_state[p].locked_axes[a] = 0;
|
2013-09-29 15:58:46 +00:00
|
|
|
}
|
|
|
|
|
2013-10-22 13:08:17 +00:00
|
|
|
for (h = 0; h < RGUI_MAX_HATS; h++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
|
|
|
uint16_t trigged = n->hats[h] & (~o->hats[h]);
|
|
|
|
uint16_t sane_trigger = 0;
|
|
|
|
if (trigged & HAT_UP_MASK)
|
|
|
|
sane_trigger = HAT_UP_MASK;
|
|
|
|
else if (trigged & HAT_DOWN_MASK)
|
|
|
|
sane_trigger = HAT_DOWN_MASK;
|
|
|
|
else if (trigged & HAT_LEFT_MASK)
|
|
|
|
sane_trigger = HAT_LEFT_MASK;
|
|
|
|
else if (trigged & HAT_RIGHT_MASK)
|
|
|
|
sane_trigger = HAT_RIGHT_MASK;
|
|
|
|
|
|
|
|
if (sane_trigger)
|
|
|
|
{
|
|
|
|
state->target->joykey = HAT_MAP(h, sane_trigger);
|
|
|
|
state->target->joyaxis = AXIS_NONE;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-29 17:09:33 +00:00
|
|
|
bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_state *new_state)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
if (menu_poll_find_trigger_pad(state, new_state, i))
|
2013-09-29 15:58:46 +00:00
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
g_settings.input.joypad_map[state->player] = i; // Update the joypad mapping automatically. More friendly that way.
|
2013-09-29 15:58:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-09-22 10:48:33 +00:00
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
static inline int menu_list_get_first_char(file_list_t *buf, unsigned offset)
|
2013-11-04 10:57:24 +00:00
|
|
|
{
|
|
|
|
const char *path = NULL;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_alt_at_offset(buf, offset, &path);
|
2013-11-04 10:57:24 +00:00
|
|
|
int ret = tolower(*path);
|
|
|
|
|
|
|
|
// "Normalize" non-alphabetical entries so they are lumped together for purposes of jumping.
|
|
|
|
if (ret < 'a')
|
|
|
|
ret = 'a' - 1;
|
|
|
|
else if (ret > 'z')
|
|
|
|
ret = 'z' + 1;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
static inline bool menu_list_elem_is_dir(file_list_t *buf, unsigned offset)
|
2013-11-04 10:57:24 +00:00
|
|
|
{
|
|
|
|
const char *path = NULL;
|
|
|
|
unsigned type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_at_offset(buf, offset, &path, &type);
|
2013-11-04 10:57:24 +00:00
|
|
|
return type != RGUI_FILE_PLAIN;
|
|
|
|
}
|
|
|
|
|
2013-11-08 14:38:18 +00:00
|
|
|
static void menu_build_scroll_indices(void *data, file_list_t *buf)
|
2013-11-04 10:57:24 +00:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
int current;
|
|
|
|
bool current_is_dir;
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-11-04 10:57:24 +00:00
|
|
|
|
|
|
|
rgui->scroll_indices_size = 0;
|
|
|
|
if (!buf->size)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rgui->scroll_indices[rgui->scroll_indices_size++] = 0;
|
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
current = menu_list_get_first_char(buf, 0);
|
|
|
|
current_is_dir = menu_list_elem_is_dir(buf, 0);
|
2013-11-04 10:57:24 +00:00
|
|
|
|
|
|
|
for (i = 1; i < buf->size; i++)
|
|
|
|
{
|
|
|
|
int first;
|
|
|
|
bool is_dir;
|
|
|
|
|
2013-11-08 02:37:06 +00:00
|
|
|
first = menu_list_get_first_char(buf, i);
|
|
|
|
is_dir = menu_list_elem_is_dir(buf, i);
|
2013-11-04 10:57:24 +00:00
|
|
|
|
|
|
|
if ((current_is_dir && !is_dir) || (first > current))
|
|
|
|
rgui->scroll_indices[rgui->scroll_indices_size++] = i;
|
|
|
|
|
|
|
|
current = first;
|
|
|
|
current_is_dir = is_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
rgui->scroll_indices[rgui->scroll_indices_size++] = buf->size - 1;
|
|
|
|
}
|
|
|
|
|
2013-11-04 11:32:43 +00:00
|
|
|
void menu_populate_entries(void *data, unsigned menu_type)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
unsigned i, last;
|
2014-03-03 05:22:28 +00:00
|
|
|
char tmp[256];
|
2013-11-04 11:32:43 +00:00
|
|
|
switch (menu_type)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
case RGUI_SETTINGS_SHADER_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Apply Shader Changes",
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_APPLY, 0);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Default Filter", RGUI_SETTINGS_SHADER_FILTER, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Load Shader Preset",
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_PRESET, 0);
|
2014-03-02 05:44:32 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Save As Shader Preset",
|
2013-11-18 01:57:31 +00:00
|
|
|
RGUI_SETTINGS_SHADER_PRESET_SAVE, 0);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Shader Passes",
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_PASSES, 0);
|
|
|
|
|
|
|
|
for (i = 0; i < rgui->shader.passes; i++)
|
|
|
|
{
|
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Shader #%u", i);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, buf,
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_0 + 3 * i, 0);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Shader #%u Filter", i);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, buf,
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_0_FILTER + 3 * i, 0);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Shader #%u Scale", i);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, buf,
|
2013-11-04 11:32:43 +00:00
|
|
|
RGUI_SETTINGS_SHADER_0_SCALE + 3 * i, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
2014-02-25 17:09:29 +00:00
|
|
|
case RGUI_SETTINGS_GENERAL_OPTIONS:
|
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Configuration Save On Exit", RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Configuration Per-Core", RGUI_SETTINGS_PER_CORE_CONFIG, 0);
|
|
|
|
#ifdef HAVE_SCREENSHOTS
|
|
|
|
file_list_push(rgui->selection_buf, "GPU Screenshots", RGUI_SETTINGS_GPU_SCREENSHOT, 0);
|
|
|
|
#endif
|
|
|
|
file_list_push(rgui->selection_buf, "Show Framerate", RGUI_SETTINGS_DEBUG_TEXT, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Rewind", RGUI_SETTINGS_REWIND_ENABLE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Rewind Granularity", RGUI_SETTINGS_REWIND_GRANULARITY, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "SRAM Block Overwrite", RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE, 0);
|
|
|
|
#if defined(HAVE_THREADS)
|
|
|
|
file_list_push(rgui->selection_buf, "SRAM Autosave", RGUI_SETTINGS_SRAM_AUTOSAVE, 0);
|
|
|
|
#endif
|
2014-02-25 18:06:02 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Window Compositing", RGUI_SETTINGS_WINDOW_COMPOSITING_ENABLE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Window Unfocus Pause", RGUI_SETTINGS_PAUSE_IF_WINDOW_FOCUS_LOST, 0);
|
2014-02-25 17:09:29 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Savestate Autosave On Exit", RGUI_SETTINGS_SAVESTATE_AUTO_SAVE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Savestate Autoload", RGUI_SETTINGS_SAVESTATE_AUTO_LOAD, 0);
|
|
|
|
break;
|
2013-11-04 11:32:43 +00:00
|
|
|
case RGUI_SETTINGS_VIDEO_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2013-11-08 02:37:06 +00:00
|
|
|
#if defined(GEKKO) || defined(__CELLOS_LV2__)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Screen Resolution", RGUI_SETTINGS_VIDEO_RESOLUTION, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 02:37:06 +00:00
|
|
|
#if defined(__CELLOS_LV2__)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "PAL60 Mode", RGUI_SETTINGS_VIDEO_PAL60, 0);
|
2013-11-08 02:37:06 +00:00
|
|
|
#endif
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifndef HAVE_SHADER_MANAGER
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Default Filter", RGUI_SETTINGS_VIDEO_FILTER, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HW_RVL
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "VI Trap filtering", RGUI_SETTINGS_VIDEO_SOFT_FILTER, 0);
|
2014-03-06 04:45:11 +00:00
|
|
|
#endif
|
|
|
|
#if defined(HW_RVL) || defined(_XBOX360)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Gamma", RGUI_SETTINGS_VIDEO_GAMMA, 0);
|
2013-11-18 01:57:31 +00:00
|
|
|
#endif
|
|
|
|
#ifdef _XBOX1
|
2013-11-18 17:03:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Soft filtering", RGUI_SETTINGS_SOFT_DISPLAY_FILTER, 0);
|
2013-11-18 01:57:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Flicker filtering", RGUI_SETTINGS_FLICKER_FILTER, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Integer Scale", RGUI_SETTINGS_VIDEO_INTEGER_SCALE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Aspect Ratio", RGUI_SETTINGS_VIDEO_ASPECT_RATIO, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Custom Ratio", RGUI_SETTINGS_CUSTOM_VIEWPORT, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Toggle Fullscreen", RGUI_SETTINGS_TOGGLE_FULLSCREEN, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Rotation", RGUI_SETTINGS_VIDEO_ROTATION, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "VSync", RGUI_SETTINGS_VIDEO_VSYNC, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Hard GPU Sync", RGUI_SETTINGS_VIDEO_HARD_SYNC, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Hard GPU Sync Frames", RGUI_SETTINGS_VIDEO_HARD_SYNC_FRAMES, 0);
|
2014-03-05 17:40:01 +00:00
|
|
|
#if !defined(RARCH_MOBILE)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Black Frame Insertion", RGUI_SETTINGS_VIDEO_BLACK_FRAME_INSERTION, 0);
|
2014-03-05 17:40:01 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "VSync Swap Interval", RGUI_SETTINGS_VIDEO_SWAP_INTERVAL, 0);
|
2013-12-14 01:33:09 +00:00
|
|
|
#if defined(HAVE_THREADS) && !defined(GEKKO)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Threaded Driver", RGUI_SETTINGS_VIDEO_THREADED, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
|
|
|
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Windowed Scale (X)", RGUI_SETTINGS_VIDEO_WINDOW_SCALE_X, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Windowed Scale (Y)", RGUI_SETTINGS_VIDEO_WINDOW_SCALE_Y, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Crop Overscan (reload)", RGUI_SETTINGS_VIDEO_CROP_OVERSCAN, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Estimated Monitor FPS", RGUI_SETTINGS_VIDEO_REFRESH_RATE_AUTO, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
2014-03-03 09:11:07 +00:00
|
|
|
case RGUI_SETTINGS_CORE_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
if (g_extern.system.core_options)
|
|
|
|
{
|
|
|
|
size_t i, opts;
|
|
|
|
|
|
|
|
opts = core_option_size(g_extern.system.core_options);
|
|
|
|
for (i = 0; i < opts; i++)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf,
|
2013-11-04 11:32:43 +00:00
|
|
|
core_option_get_desc(g_extern.system.core_options, i), RGUI_SETTINGS_CORE_OPTION_START + i, 0);
|
|
|
|
}
|
|
|
|
else
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "No options available.", RGUI_SETTINGS_CORE_OPTION_NONE, 0);
|
2014-03-03 05:22:28 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_CORE_INFO:
|
2014-03-03 09:11:07 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
if (rgui->core_info_current.data)
|
|
|
|
{
|
2014-03-03 12:58:14 +00:00
|
|
|
snprintf(tmp, sizeof(tmp), "Core name: %s",
|
|
|
|
rgui->core_info_current.display_name ? rgui->core_info_current.display_name : "");
|
2014-03-03 09:11:07 +00:00
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
2014-03-03 12:58:14 +00:00
|
|
|
|
2014-03-04 09:17:00 +00:00
|
|
|
if (rgui->core_info_current.authors_list)
|
|
|
|
{
|
|
|
|
strlcpy(tmp, "Authors: ", sizeof(tmp));
|
|
|
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.authors_list, ", ");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
}
|
2014-03-03 12:58:14 +00:00
|
|
|
|
2014-03-04 09:17:00 +00:00
|
|
|
if (rgui->core_info_current.permissions_list)
|
|
|
|
{
|
|
|
|
strlcpy(tmp, "Permissions: ", sizeof(tmp));
|
|
|
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.permissions_list, ", ");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
}
|
2014-03-03 12:58:14 +00:00
|
|
|
|
2014-03-04 09:17:00 +00:00
|
|
|
if (rgui->core_info_current.supported_extensions_list)
|
|
|
|
{
|
|
|
|
strlcpy(tmp, "Supported extensions: ", sizeof(tmp));
|
|
|
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.supported_extensions_list, ", ");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
}
|
2014-03-03 09:11:07 +00:00
|
|
|
|
|
|
|
if (rgui->core_info_current.firmware_count > 0)
|
|
|
|
{
|
2014-03-03 12:58:14 +00:00
|
|
|
core_info_list_update_missing_firmware(rgui->core_info, rgui->core_info_current.path,
|
|
|
|
g_settings.system_directory);
|
2014-03-03 09:11:07 +00:00
|
|
|
|
2014-03-03 23:47:50 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Firmware: ", RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
2014-03-03 09:11:07 +00:00
|
|
|
for (i = 0; i < rgui->core_info_current.firmware_count; i++)
|
|
|
|
{
|
|
|
|
if (rgui->core_info_current.firmware[i].desc)
|
2014-03-03 23:23:56 +00:00
|
|
|
{
|
2014-03-04 08:34:34 +00:00
|
|
|
snprintf(tmp, sizeof(tmp), " name: %s",
|
|
|
|
rgui->core_info_current.firmware[i].desc ? rgui->core_info_current.firmware[i].desc : "");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), " status: %s, %s",
|
|
|
|
rgui->core_info_current.firmware[i].missing ? "missing" : "present",
|
|
|
|
rgui->core_info_current.firmware[i].optional ? "optional" : "required");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
2014-03-03 09:11:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rgui->core_info_current.notes)
|
|
|
|
{
|
|
|
|
snprintf(tmp, sizeof(tmp), "Core notes: ");
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
|
|
|
|
for (i = 0; i < rgui->core_info_current.note_list->size; i++)
|
|
|
|
{
|
|
|
|
snprintf(tmp, sizeof(tmp), " %s", rgui->core_info_current.note_list->elems[i].data);
|
|
|
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
file_list_push(rgui->selection_buf, "No information available.", RGUI_SETTINGS_CORE_OPTION_NONE, 0);
|
2014-03-03 05:22:28 +00:00
|
|
|
break;
|
2013-11-04 11:32:43 +00:00
|
|
|
case RGUI_SETTINGS_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2014-02-25 17:09:29 +00:00
|
|
|
file_list_push(rgui->selection_buf, "General Options", RGUI_SETTINGS_GENERAL_OPTIONS, 0);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Video Options", RGUI_SETTINGS_VIDEO_OPTIONS, 0);
|
2014-02-25 15:04:36 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
file_list_push(rgui->selection_buf, "Shader Options", RGUI_SETTINGS_SHADER_OPTIONS, 0);
|
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Audio Options", RGUI_SETTINGS_AUDIO_OPTIONS, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Input Options", RGUI_SETTINGS_INPUT_OPTIONS, 0);
|
2014-02-25 15:40:12 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
file_list_push(rgui->selection_buf, "Overlay Options", RGUI_SETTINGS_OVERLAY_OPTIONS, 0);
|
2014-03-02 03:46:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETPLAY
|
2014-03-02 04:46:33 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Netplay Options", RGUI_SETTINGS_NETPLAY_OPTIONS, 0);
|
2014-02-25 15:40:12 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Path Options", RGUI_SETTINGS_PATH_OPTIONS, 0);
|
2013-11-06 23:27:30 +00:00
|
|
|
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
|
|
|
{
|
|
|
|
if (g_extern.system.disk_control.get_num_images)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Disk Options", RGUI_SETTINGS_DISK_OPTIONS, 0);
|
2013-11-06 23:27:30 +00:00
|
|
|
}
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_DISK_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Disk Index", RGUI_SETTINGS_DISK_INDEX, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Disk Image Append", RGUI_SETTINGS_DISK_APPEND, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
2014-02-25 15:40:12 +00:00
|
|
|
case RGUI_SETTINGS_OVERLAY_OPTIONS:
|
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Overlay Preset", RGUI_SETTINGS_OVERLAY_PRESET, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Overlay Opacity", RGUI_SETTINGS_OVERLAY_OPACITY, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Overlay Scale", RGUI_SETTINGS_OVERLAY_SCALE, 0);
|
|
|
|
break;
|
2014-03-02 03:46:26 +00:00
|
|
|
#ifdef HAVE_NETPLAY
|
|
|
|
case RGUI_SETTINGS_NETPLAY_OPTIONS:
|
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Netplay Enable", RGUI_SETTINGS_NETPLAY_ENABLE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Netplay Mode", RGUI_SETTINGS_NETPLAY_MODE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Spectator Mode Enable", RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Host IP Address", RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "TCP/UDP Port", RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Delay Frames", RGUI_SETTINGS_NETPLAY_DELAY_FRAMES, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Nickname", RGUI_SETTINGS_NETPLAY_NICKNAME, 0);
|
|
|
|
break;
|
|
|
|
#endif
|
2013-11-04 11:32:43 +00:00
|
|
|
case RGUI_SETTINGS_PATH_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2013-12-25 01:31:35 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Content Directory", RGUI_BROWSER_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifdef HAVE_DYNAMIC
|
2013-12-16 20:05:57 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Config Directory", RGUI_CONFIG_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2014-03-05 23:17:02 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Core Directory", RGUI_LIBRETRO_DIR_PATH, 0);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Core Info Directory", RGUI_LIBRETRO_INFO_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Shader Directory", RGUI_SHADER_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Savestate Directory", RGUI_SAVESTATE_DIR_PATH, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Savefile Directory", RGUI_SAVEFILE_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Overlay Directory", RGUI_OVERLAY_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "System Directory", RGUI_SYSTEM_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifdef HAVE_SCREENSHOTS
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Screenshot Directory", RGUI_SCREENSHOT_DIR_PATH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_INPUT_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Player", RGUI_SETTINGS_BIND_PLAYER, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Device", RGUI_SETTINGS_BIND_DEVICE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Device Type", RGUI_SETTINGS_BIND_DEVICE_TYPE, 0);
|
2014-01-08 16:31:14 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Analog D-pad Mode", RGUI_SETTINGS_BIND_ANALOG_MODE, 0);
|
2013-12-12 21:10:11 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Autodetect enable", RGUI_SETTINGS_DEVICE_AUTODETECT_ENABLE, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Configure All (RetroPad)", RGUI_SETTINGS_CUSTOM_BIND_ALL, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Default All (RetroPad)", RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL, 0);
|
2014-03-02 05:07:18 +00:00
|
|
|
#ifdef HAVE_OSK
|
|
|
|
file_list_push(rgui->selection_buf, "Onscreen Keyboard Enable", RGUI_SETTINGS_ONSCREEN_KEYBOARD_ENABLE, 0);
|
|
|
|
#endif
|
2014-02-27 07:10:09 +00:00
|
|
|
last = (driver.input && driver.input->set_keybinds && !driver.input->get_joypad_driver) ? RGUI_SETTINGS_BIND_R3 : RGUI_SETTINGS_BIND_MENU_TOGGLE;
|
2013-11-04 11:32:43 +00:00
|
|
|
for (i = RGUI_SETTINGS_BIND_BEGIN; i <= last; i++)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, input_config_bind_map[i - RGUI_SETTINGS_BIND_BEGIN].desc, i, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_AUDIO_OPTIONS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
|
|
|
file_list_push(rgui->selection_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Rate Control Delta", RGUI_SETTINGS_AUDIO_CONTROL_RATE_DELTA, 0);
|
2013-11-18 18:50:47 +00:00
|
|
|
#ifdef __CELLOS_LV2__
|
|
|
|
file_list_push(rgui->selection_buf, "System BGM Control", RGUI_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE, 0);
|
|
|
|
#endif
|
2013-11-15 21:53:58 +00:00
|
|
|
#ifdef _XBOX1
|
2014-03-05 02:40:55 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Volume Effect", RGUI_SETTINGS_AUDIO_DSP_EFFECT, 0);
|
2013-11-15 21:53:58 +00:00
|
|
|
#endif
|
2014-03-05 02:40:55 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Volume Level", RGUI_SETTINGS_AUDIO_VOLUME, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_DRIVERS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2014-02-25 08:39:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Video Driver", RGUI_SETTINGS_DRIVER_VIDEO, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Audio Driver", RGUI_SETTINGS_DRIVER_AUDIO, 0);
|
2014-03-02 11:25:38 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Audio Device", RGUI_SETTINGS_DRIVER_AUDIO_DEVICE, 0);
|
2014-02-25 08:39:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Audio Resampler", RGUI_SETTINGS_DRIVER_AUDIO_RESAMPLER, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Input Driver", RGUI_SETTINGS_DRIVER_INPUT, 0);
|
2013-11-11 14:39:46 +00:00
|
|
|
#ifdef HAVE_CAMERA
|
2014-02-25 08:39:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Camera Driver", RGUI_SETTINGS_DRIVER_CAMERA, 0);
|
2013-12-19 00:51:51 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LOCATION
|
2014-02-25 08:39:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Location Driver", RGUI_SETTINGS_DRIVER_LOCATION, 0);
|
2014-01-27 00:32:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MENU
|
2014-02-25 08:39:48 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Menu Driver", RGUI_SETTINGS_DRIVER_MENU, 0);
|
2013-11-11 14:39:46 +00:00
|
|
|
#endif
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS:
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Core", RGUI_SETTINGS_CORE, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
|
|
|
if (rgui->history)
|
2013-11-26 20:41:27 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Load Content (History)", RGUI_SETTINGS_OPEN_HISTORY, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
if (rgui->core_info && core_info_list_num_info_files(rgui->core_info))
|
2013-11-26 20:41:27 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Load Content (Detect Core)", RGUI_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
if (rgui->info.library_name || g_extern.system.info.library_name)
|
|
|
|
{
|
|
|
|
char load_game_core_msg[64];
|
2013-11-26 20:41:27 +00:00
|
|
|
snprintf(load_game_core_msg, sizeof(load_game_core_msg), "Load Content (%s)",
|
2013-11-04 11:32:43 +00:00
|
|
|
rgui->info.library_name ? rgui->info.library_name : g_extern.system.info.library_name);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, load_game_core_msg, RGUI_SETTINGS_OPEN_FILEBROWSER, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
}
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Core Options", RGUI_SETTINGS_CORE_OPTIONS, 0);
|
2014-03-03 05:48:09 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Core Information", RGUI_SETTINGS_CORE_INFO, 0);
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Settings", RGUI_SETTINGS_OPTIONS, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Drivers", RGUI_SETTINGS_DRIVERS, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Save State", RGUI_SETTINGS_SAVESTATE_SAVE, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Load State", RGUI_SETTINGS_SAVESTATE_LOAD, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#ifdef HAVE_SCREENSHOTS
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Take Screenshot", RGUI_SETTINGS_SCREENSHOT, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-26 20:41:27 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Resume Content", RGUI_SETTINGS_RESUME_GAME, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Restart Content", RGUI_SETTINGS_RESTART_GAME, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#ifndef HAVE_DYNAMIC
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "Restart RetroArch", RGUI_SETTINGS_RESTART_EMULATOR, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "RetroArch Config", RGUI_SETTINGS_CONFIG, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Save New Config", RGUI_SETTINGS_SAVE_CONFIG, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Help", RGUI_START_SCREEN, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "Quit RetroArch", RGUI_SETTINGS_QUIT_RARCH, 0);
|
2013-11-04 11:32:43 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-11-19 05:09:14 +00:00
|
|
|
|
|
|
|
if (menu_ctx && menu_ctx->populate_entries)
|
|
|
|
menu_ctx->populate_entries(rgui, menu_type);
|
2013-11-04 11:32:43 +00:00
|
|
|
}
|
|
|
|
|
2013-11-04 10:53:25 +00:00
|
|
|
void menu_parse_and_resolve(void *data, unsigned menu_type)
|
2013-10-06 10:31:04 +00:00
|
|
|
{
|
|
|
|
const core_info_t *info = NULL;
|
2013-11-04 10:32:43 +00:00
|
|
|
const char *dir;
|
|
|
|
size_t i, list_size;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_t *list;
|
2013-11-04 10:32:43 +00:00
|
|
|
rgui_handle_t *rgui;
|
|
|
|
|
|
|
|
rgui = (rgui_handle_t*)data;
|
2013-11-04 10:53:25 +00:00
|
|
|
dir = NULL;
|
2013-10-22 13:08:17 +00:00
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_clear(rgui->selection_buf);
|
2013-11-04 10:53:25 +00:00
|
|
|
|
|
|
|
// parsing switch
|
|
|
|
switch (menu_type)
|
|
|
|
{
|
|
|
|
case RGUI_SETTINGS_OPEN_HISTORY:
|
|
|
|
/* History parse */
|
|
|
|
list_size = rom_history_size(rgui->history);
|
|
|
|
|
|
|
|
for (i = 0; i < list_size; i++)
|
|
|
|
{
|
|
|
|
const char *path, *core_path, *core_name;
|
|
|
|
char fill_buf[PATH_MAX];
|
|
|
|
|
|
|
|
path = NULL;
|
|
|
|
core_path = NULL;
|
|
|
|
core_name = NULL;
|
|
|
|
|
|
|
|
rom_history_get_index(rgui->history, i,
|
|
|
|
&path, &core_path, &core_name);
|
|
|
|
|
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
char path_short[PATH_MAX];
|
|
|
|
fill_pathname(path_short, path_basename(path), "", sizeof(path_short));
|
|
|
|
|
|
|
|
snprintf(fill_buf, sizeof(fill_buf), "%s (%s)",
|
|
|
|
path_short, core_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
|
|
|
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, fill_buf, RGUI_FILE_PLAIN, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_DEFERRED_CORE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
/* Directory parse */
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 10:53:25 +00:00
|
|
|
|
|
|
|
if (!*dir)
|
|
|
|
{
|
|
|
|
#if defined(GEKKO)
|
|
|
|
#ifdef HW_RVL
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "sd:/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "usb:/", menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
#endif
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "carda:/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "cardb:/", menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
#elif defined(_XBOX1)
|
2013-11-11 02:39:30 +00:00
|
|
|
file_list_push(rgui->selection_buf, "C:", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "D:", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "E:", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "F:", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "G:", menu_type, 0);
|
2013-12-29 03:08:42 +00:00
|
|
|
#elif defined(_XBOX360)
|
|
|
|
file_list_push(rgui->selection_buf, "game:", menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
#elif defined(_WIN32)
|
|
|
|
unsigned drives = GetLogicalDrives();
|
|
|
|
char drive[] = " :\\";
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
{
|
|
|
|
drive[0] = 'A' + i;
|
|
|
|
if (drives & (1 << i))
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, drive, menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
}
|
|
|
|
#elif defined(__CELLOS_LV2__)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "/app_home/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_hdd0/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_hdd1/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/host_root/", menu_type, 0);
|
2014-01-05 04:00:08 +00:00
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb000/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb001/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb002/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb003/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb004/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb005/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "/dev_usb006/", menu_type, 0);
|
2014-02-16 16:27:23 +00:00
|
|
|
#elif defined(PSP)
|
|
|
|
file_list_push(rgui->selection_buf, "ms0:/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "ef0:/", menu_type, 0);
|
|
|
|
file_list_push(rgui->selection_buf, "host0:/", menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
#else
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "/", menu_type, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#if defined(GEKKO) && defined(HW_RVL)
|
|
|
|
LWP_MutexLock(gx_device_mutex);
|
|
|
|
int dev = gx_get_device_from_path(dir);
|
|
|
|
|
|
|
|
if (dev != -1 && !gx_devices[dev].mounted && gx_devices[dev].interface->isInserted())
|
|
|
|
fatMountSimple(gx_devices[dev].name, gx_devices[dev].interface);
|
|
|
|
|
|
|
|
LWP_MutexUnlock(gx_device_mutex);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const char *exts;
|
|
|
|
char ext_buf[1024];
|
|
|
|
if (menu_type == RGUI_SETTINGS_CORE)
|
|
|
|
exts = EXT_EXECUTABLES;
|
|
|
|
else if (menu_type == RGUI_SETTINGS_CONFIG)
|
|
|
|
exts = "cfg";
|
|
|
|
else if (menu_type == RGUI_SETTINGS_SHADER_PRESET)
|
|
|
|
exts = "cgp|glslp";
|
|
|
|
else if (menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS)
|
|
|
|
exts = "cg|glsl";
|
|
|
|
else if (menu_type == RGUI_SETTINGS_OVERLAY_PRESET)
|
|
|
|
exts = "cfg";
|
|
|
|
else if (menu_type_is(menu_type) == RGUI_FILE_DIRECTORY)
|
|
|
|
exts = ""; // we ignore files anyway
|
|
|
|
else if (rgui->defer_core)
|
|
|
|
exts = rgui->core_info ? core_info_list_get_all_extensions(rgui->core_info) : "";
|
|
|
|
else if (rgui->info.valid_extensions)
|
|
|
|
{
|
|
|
|
exts = ext_buf;
|
|
|
|
if (*rgui->info.valid_extensions)
|
|
|
|
snprintf(ext_buf, sizeof(ext_buf), "%s|zip", rgui->info.valid_extensions);
|
|
|
|
else
|
|
|
|
*ext_buf = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
exts = g_extern.system.valid_extensions;
|
|
|
|
|
|
|
|
struct string_list *list = dir_list_new(dir, exts, true);
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dir_list_sort(list, true);
|
|
|
|
|
|
|
|
if (menu_type_is(menu_type) == RGUI_FILE_DIRECTORY)
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, "<Use this directory>", RGUI_FILE_USE_DIRECTORY, 0);
|
2013-11-04 10:53:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < list->size; i++)
|
|
|
|
{
|
|
|
|
bool is_dir = list->elems[i].attr.b;
|
|
|
|
|
|
|
|
if ((menu_type_is(menu_type) == RGUI_FILE_DIRECTORY) && !is_dir)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Need to preserve slash first time.
|
|
|
|
const char *path = list->elems[i].data;
|
|
|
|
if (*dir)
|
|
|
|
path = path_basename(path);
|
|
|
|
|
2013-12-25 03:28:24 +00:00
|
|
|
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
|
|
|
if (menu_type == RGUI_SETTINGS_CORE && (is_dir || strcasecmp(path, SALAMANDER_FILE) == 0))
|
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
|
2013-11-04 10:53:25 +00:00
|
|
|
// Push menu_type further down in the chain.
|
|
|
|
// Needed for shader manager currently.
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, path,
|
2013-11-04 10:53:25 +00:00
|
|
|
is_dir ? menu_type : RGUI_FILE_PLAIN, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
string_list_free(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// resolving switch
|
2013-11-04 10:32:43 +00:00
|
|
|
switch (menu_type)
|
2013-10-06 10:31:04 +00:00
|
|
|
{
|
2013-11-04 10:32:43 +00:00
|
|
|
case RGUI_SETTINGS_CORE:
|
|
|
|
dir = NULL;
|
2013-11-08 03:48:31 +00:00
|
|
|
list = (file_list_t*)rgui->selection_buf;
|
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
2013-11-04 10:32:43 +00:00
|
|
|
list_size = list->size;
|
|
|
|
for (i = 0; i < list_size; i++)
|
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
unsigned type = 0;
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_get_at_offset(list, i, &path, &type);
|
2013-11-04 10:32:43 +00:00
|
|
|
if (type != RGUI_FILE_PLAIN)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
char core_path[PATH_MAX];
|
|
|
|
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
|
|
|
|
|
|
|
char display_name[256];
|
|
|
|
if (rgui->core_info &&
|
|
|
|
core_info_list_get_display_name(rgui->core_info,
|
|
|
|
core_path, display_name, sizeof(display_name)))
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_set_alt_at_offset(list, i, display_name);
|
2013-11-04 10:32:43 +00:00
|
|
|
}
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_sort_on_alt(rgui->selection_buf);
|
2013-11-04 10:32:43 +00:00
|
|
|
break;
|
|
|
|
case RGUI_SETTINGS_DEFERRED_CORE:
|
|
|
|
core_info_list_get_supported_cores(rgui->core_info, rgui->deferred_path, &info, &list_size);
|
|
|
|
for (i = 0; i < list_size; i++)
|
|
|
|
{
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_push(rgui->selection_buf, info[i].path, RGUI_FILE_PLAIN, 0);
|
|
|
|
file_list_set_alt_at_offset(rgui->selection_buf, i, info[i].display_name);
|
2013-11-04 10:32:43 +00:00
|
|
|
}
|
2013-11-08 03:48:31 +00:00
|
|
|
file_list_sort_on_alt(rgui->selection_buf);
|
2013-11-04 10:32:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
(void)0;
|
2013-10-06 10:31:04 +00:00
|
|
|
}
|
2013-11-04 10:57:24 +00:00
|
|
|
|
|
|
|
rgui->scroll_indices_size = 0;
|
|
|
|
if (menu_type != RGUI_SETTINGS_OPEN_HISTORY)
|
2013-11-08 02:37:06 +00:00
|
|
|
menu_build_scroll_indices(rgui, rgui->selection_buf);
|
2013-11-04 10:57:24 +00:00
|
|
|
|
|
|
|
// Before a refresh, we could have deleted a file on disk, causing
|
|
|
|
// selection_ptr to suddendly be out of range. Ensure it doesn't overflow.
|
|
|
|
if (rgui->selection_ptr >= rgui->selection_buf->size && rgui->selection_buf->size)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_set_navigation(rgui, rgui->selection_buf->size - 1);
|
2013-11-04 10:57:24 +00:00
|
|
|
else if (!rgui->selection_buf->size)
|
2014-02-28 22:14:42 +00:00
|
|
|
menu_clear_navigation(rgui);
|
2013-10-06 13:10:00 +00:00
|
|
|
}
|
2013-10-11 07:17:32 +00:00
|
|
|
|
2013-11-08 14:38:18 +00:00
|
|
|
void menu_init_core_info(void *data)
|
2013-10-11 07:17:32 +00:00
|
|
|
{
|
2013-11-08 14:38:18 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
2013-10-11 07:17:32 +00:00
|
|
|
core_info_list_free(rgui->core_info);
|
|
|
|
rgui->core_info = NULL;
|
|
|
|
if (*rgui->libretro_dir)
|
|
|
|
rgui->core_info = core_info_list_new(rgui->libretro_dir);
|
|
|
|
}
|