mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
(Menu) Refactor init_core_info calls
This commit is contained in:
parent
57cf883814
commit
728b18a9fe
@ -2507,8 +2507,6 @@ static int menu_common_iterate(unsigned action)
|
||||
if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "libretro_dir_path")))
|
||||
menu_common_setting_set_current_string_dir(current_setting, dir);
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
||||
}
|
||||
else if (menu_type == MENU_CONFIG_DIR_PATH)
|
||||
@ -2523,8 +2521,6 @@ static int menu_common_iterate(unsigned action)
|
||||
if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "libretro_info_path")))
|
||||
menu_common_setting_set_current_string_dir(current_setting, dir);
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
||||
}
|
||||
else if (menu_type == MENU_SHADER_DIR_PATH)
|
||||
@ -3694,19 +3690,13 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
|
||||
strlcpy(g_extern.savestate_dir, g_defaults.savestate_dir, sizeof(g_extern.savestate_dir));
|
||||
break;
|
||||
case MENU_LIBRETRO_DIR_PATH:
|
||||
if (action == MENU_ACTION_START)
|
||||
{
|
||||
*g_settings.libretro_directory = '\0';
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
}
|
||||
break;
|
||||
case MENU_LIBRETRO_INFO_DIR_PATH:
|
||||
if (action == MENU_ACTION_START)
|
||||
{
|
||||
*g_settings.libretro_info_path = '\0';
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
*setting->value.string = '\0';
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
}
|
||||
break;
|
||||
case MENU_CONFIG_DIR_PATH:
|
||||
|
@ -114,6 +114,7 @@ enum basic_event
|
||||
RARCH_CMD_RECORD_DEINIT,
|
||||
RARCH_CMD_HISTORY_DEINIT,
|
||||
RARCH_CMD_HISTORY_INIT,
|
||||
RARCH_CMD_CORE_INFO_INIT,
|
||||
};
|
||||
|
||||
enum menu_enums
|
||||
|
@ -3224,6 +3224,12 @@ void rarch_main_command(unsigned action)
|
||||
content_playlist_free(g_extern.history);
|
||||
g_extern.history = NULL;
|
||||
break;
|
||||
case RARCH_CMD_CORE_INFO_INIT:
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1032,6 @@ static void general_read_handler(const void *data)
|
||||
static void general_write_handler(const void *data)
|
||||
{
|
||||
unsigned rarch_cmd = RARCH_CMD_NONE;
|
||||
bool has_set_libretro_dir = false;
|
||||
const rarch_setting_t *setting = (const rarch_setting_t*)data;
|
||||
|
||||
if (!setting)
|
||||
@ -1306,9 +1305,15 @@ static void general_write_handler(const void *data)
|
||||
else if (!strcmp(setting->name, "libretro_path"))
|
||||
strlcpy(g_settings.libretro, setting->value.string, sizeof(g_settings.libretro));
|
||||
else if (!strcmp(setting->name, "libretro_info_path"))
|
||||
{
|
||||
strlcpy(g_settings.libretro_info_path, setting->value.string, sizeof(g_settings.libretro_info_path));
|
||||
rarch_cmd = RARCH_CMD_CORE_INFO_INIT;
|
||||
}
|
||||
else if (!strcmp(setting->name, "libretro_dir_path"))
|
||||
{
|
||||
strlcpy(g_settings.libretro_directory, setting->value.string, sizeof(g_settings.libretro_directory));
|
||||
rarch_cmd = RARCH_CMD_CORE_INFO_INIT;
|
||||
}
|
||||
else if (!strcmp(setting->name, "core_options_path"))
|
||||
strlcpy(g_settings.core_options_path, setting->value.string, sizeof(g_settings.core_options_path));
|
||||
else if (!strcmp(setting->name, "cheat_database_path"))
|
||||
@ -1369,14 +1374,6 @@ static void general_write_handler(const void *data)
|
||||
|
||||
if (rarch_cmd)
|
||||
rarch_main_command(rarch_cmd);
|
||||
|
||||
if (has_set_libretro_dir)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#define NEXT (list[index++])
|
||||
|
Loading…
x
Reference in New Issue
Block a user