This commit is contained in:
twinaphex 2020-06-05 22:31:30 +02:00
parent 7501b010f4
commit 6de048371f
2 changed files with 37 additions and 36 deletions

View File

@ -252,8 +252,6 @@ float menu_entry_num_min(uint32_t i);
float menu_entry_num_max(uint32_t i); float menu_entry_num_max(uint32_t i);
bool menu_entry_is_currently_selected(unsigned id);
void menu_entry_get(menu_entry_t *entry, size_t stack_idx, void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation); size_t i, void *userdata, bool use_representation);

View File

@ -3718,13 +3718,6 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
} }
} }
bool menu_entry_is_currently_selected(unsigned id)
{
struct rarch_state *p_rarch = &rarch_st;
struct menu_state *menu_st = &p_rarch->menu_driver_state;
return id == menu_st->selection_ptr;
}
/* Performs whatever actions are associated with menu entry 'i'. /* Performs whatever actions are associated with menu entry 'i'.
* *
* This is the most important function because it does all the work * This is the most important function because it does all the work
@ -19263,14 +19256,14 @@ static int16_t input_joypad_axis(const input_device_driver_t *drv,
* Prevents phantom input when using an overlay to * Prevents phantom input when using an overlay to
* toggle menu ON if overlays are disabled in-menu */ * toggle menu ON if overlays are disabled in-menu */
static void menu_input_driver_toggle(bool on) static void menu_input_driver_toggle(
struct rarch_state *p_rarch,
bool on)
{ {
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
struct rarch_state *p_rarch = &rarch_st;
settings_t *settings = p_rarch->configuration_settings;
if (on) if (on)
{ {
settings_t *settings = p_rarch->configuration_settings;
bool overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu; bool overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu;
bool input_overlay_enable = settings->bools.input_overlay_enable; bool input_overlay_enable = settings->bools.input_overlay_enable;
/* If an overlay was displayed before the toggle /* If an overlay was displayed before the toggle
@ -31360,14 +31353,16 @@ static void menu_input_key_event(bool down, unsigned keycode,
* If the menu is already running, it will be turned off. * If the menu is already running, it will be turned off.
* If the menu is off, then the menu will be started. * If the menu is off, then the menu will be started.
*/ */
static void menu_driver_toggle(bool on) static void menu_driver_toggle(
struct rarch_state *p_rarch,
menu_handle_t *menu,
bool on)
{ {
/* TODO/FIXME - retroarch_main_quit calls menu_driver_toggle - /* TODO/FIXME - retroarch_main_quit calls menu_driver_toggle -
* we might have to redesign this to avoid EXXC_BAD_ACCESS errors * we might have to redesign this to avoid EXXC_BAD_ACCESS errors
* on OSX - for now we work around this by checking if the settings * on OSX - for now we work around this by checking if the settings
* struct is NULL * struct is NULL
*/ */
struct rarch_state *p_rarch = &rarch_st;
retro_keyboard_event_t *key_event = &p_rarch->runloop_key_event; retro_keyboard_event_t *key_event = &p_rarch->runloop_key_event;
retro_keyboard_event_t *frontend_key_event = &p_rarch->runloop_frontend_key_event; retro_keyboard_event_t *frontend_key_event = &p_rarch->runloop_frontend_key_event;
settings_t *settings = p_rarch->configuration_settings; settings_t *settings = p_rarch->configuration_settings;
@ -31380,10 +31375,6 @@ static void menu_driver_toggle(bool on)
#endif #endif
#endif #endif
bool runloop_shutdown_initiated = p_rarch->runloop_shutdown_initiated; bool runloop_shutdown_initiated = p_rarch->runloop_shutdown_initiated;
menu_handle_t *menu = p_rarch->menu_driver_data;
if (!menu)
return;
if (menu->driver_ctx && menu->driver_ctx->toggle) if (menu->driver_ctx && menu->driver_ctx->toggle)
menu->driver_ctx->toggle(menu->userdata, on); menu->driver_ctx->toggle(menu->userdata, on);
@ -31393,7 +31384,7 @@ static void menu_driver_toggle(bool on)
/* Apply any required menu pointer input inhibits /* Apply any required menu pointer input inhibits
* (i.e. prevent phantom input when using an overlay * (i.e. prevent phantom input when using an overlay
* to toggle the menu on) */ * to toggle the menu on) */
menu_input_driver_toggle(on); menu_input_driver_toggle(p_rarch, on);
if (p_rarch->menu_driver_alive) if (p_rarch->menu_driver_alive)
{ {
@ -31477,7 +31468,9 @@ void retroarch_menu_running(void)
#endif #endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_driver_toggle(true); menu_handle_t *menu = p_rarch->menu_driver_data;
if (menu)
menu_driver_toggle(p_rarch, menu, true);
/* Prevent stray input (for a single frame) */ /* Prevent stray input (for a single frame) */
p_rarch->input_driver_flushing_input = 1; p_rarch->input_driver_flushing_input = 1;
@ -31501,7 +31494,9 @@ void retroarch_menu_running_finished(bool quit)
settings_t *settings = p_rarch->configuration_settings; settings_t *settings = p_rarch->configuration_settings;
#endif #endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_driver_toggle(false); menu_handle_t *menu = p_rarch->menu_driver_data;
if (menu)
menu_driver_toggle(p_rarch, menu, false);
/* Prevent stray input /* Prevent stray input
* (for a single frame) */ * (for a single frame) */
@ -31665,12 +31660,10 @@ static void rarch_init_core_options_path(
strlcpy(global_options_path, strlcpy(global_options_path,
options_path, sizeof(global_options_path)); options_path, sizeof(global_options_path));
else if (!path_is_empty(RARCH_PATH_CONFIG)) else if (!path_is_empty(RARCH_PATH_CONFIG))
{
fill_pathname_resolve_relative( fill_pathname_resolve_relative(
global_options_path, path_get(RARCH_PATH_CONFIG), global_options_path, path_get(RARCH_PATH_CONFIG),
"retroarch-core-options.cfg", sizeof(global_options_path)); "retroarch-core-options.cfg", sizeof(global_options_path));
} }
}
/* Allocate correct path/src_path strings */ /* Allocate correct path/src_path strings */
if (per_core_options) if (per_core_options)
@ -32098,13 +32091,11 @@ static bool retroarch_load_shader_preset_internal(
/* Concatenate strings into full paths */ /* Concatenate strings into full paths */
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
{
fill_pathname_join_special_ext(shader_path, fill_pathname_join_special_ext(shader_path,
shader_directory, core_name, shader_directory, core_name,
special_name, special_name,
video_shader_get_preset_extension(types[i]), video_shader_get_preset_extension(types[i]),
PATH_MAX_LENGTH); PATH_MAX_LENGTH);
}
else else
{ {
if (string_is_empty(special_name)) if (string_is_empty(special_name))
@ -32159,7 +32150,8 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
settings_t *settings = p_rarch->configuration_settings; settings_t *settings = p_rarch->configuration_settings;
const char *video_shader_directory = settings->paths.directory_video_shader; const char *video_shader_directory = settings->paths.directory_video_shader;
const char *menu_config_directory = settings->paths.directory_menu_config; const char *menu_config_directory = settings->paths.directory_menu_config;
const char *core_name = p_rarch->runloop_system.info.library_name; const char *core_name =
p_rarch->runloop_system.info.library_name;
const char *rarch_path_basename = path_get(RARCH_PATH_BASENAME); const char *rarch_path_basename = path_get(RARCH_PATH_BASENAME);
const char *game_name = path_basename(rarch_path_basename); const char *game_name = path_basename(rarch_path_basename);
@ -32209,7 +32201,9 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
if (string_is_empty(dirs[i])) if (string_is_empty(dirs[i]))
continue; continue;
#ifdef DEBUG
RARCH_LOG("[Shaders]: preset directory: %s\n", dirs[i]); RARCH_LOG("[Shaders]: preset directory: %s\n", dirs[i]);
#endif
ret = retroarch_load_shader_preset_internal(p_rarch, ret = retroarch_load_shader_preset_internal(p_rarch,
dirs[i], core_name, dirs[i], core_name,
@ -32217,7 +32211,9 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
if (ret) if (ret)
{ {
#ifdef DEBUG
RARCH_LOG("[Shaders]: game-specific shader preset found.\n"); RARCH_LOG("[Shaders]: game-specific shader preset found.\n");
#endif
break; break;
} }
@ -32227,7 +32223,9 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
if (ret) if (ret)
{ {
#ifdef DEBUG
RARCH_LOG("[Shaders]: folder-specific shader preset found.\n"); RARCH_LOG("[Shaders]: folder-specific shader preset found.\n");
#endif
break; break;
} }
@ -32237,7 +32235,9 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
if (ret) if (ret)
{ {
#ifdef DEBUG
RARCH_LOG("[Shaders]: core-specific shader preset found.\n"); RARCH_LOG("[Shaders]: core-specific shader preset found.\n");
#endif
break; break;
} }
@ -32247,7 +32247,9 @@ static bool retroarch_load_shader_preset(struct rarch_state *p_rarch)
if (ret) if (ret)
{ {
#ifdef DEBUG
RARCH_LOG("[Shaders]: global shader preset found.\n"); RARCH_LOG("[Shaders]: global shader preset found.\n");
#endif
break; break;
} }
} }
@ -32256,12 +32258,13 @@ end:
free(content_dir_name); free(content_dir_name);
free(config_file_directory); free(config_file_directory);
free(old_presets_directory); free(old_presets_directory);
return ret; return ret;
} }
#endif #endif
/* get the name of the current shader preset */ /* get the name of the current shader preset */
const char* retroarch_get_shader_preset(void) const char *retroarch_get_shader_preset(void)
{ {
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
struct rarch_state *p_rarch = &rarch_st; struct rarch_state *p_rarch = &rarch_st;