Add 'Unload Core' option

This commit is contained in:
twinaphex 2015-03-24 14:32:42 +01:00
parent e05af60111
commit ca8e38fa18
4 changed files with 23 additions and 3 deletions

View File

@ -944,6 +944,12 @@ static int action_ok_disk_cycle_tray_status(const char *path,
return generic_action_ok_command(RARCH_CMD_DISK_EJECT_TOGGLE);
}
static int action_ok_unload_core(const char *path,
const char *label, unsigned type, size_t idx)
{
return generic_action_ok_command(RARCH_CMD_UNLOAD_CORE);
}
static int action_ok_quit(const char *path,
const char *label, unsigned type, size_t idx)
{
@ -1197,6 +1203,8 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
cbs->action_ok = action_ok_file_load_or_resume;
else if (!strcmp(label, "quit_retroarch"))
cbs->action_ok = action_ok_quit;
else if (!strcmp(label, "unload_core"))
cbs->action_ok = action_ok_unload_core;
else if (!strcmp(label, "save_new_config"))
cbs->action_ok = action_ok_save_new_config;
else if (!strcmp(label, "help"))

View File

@ -1841,12 +1841,13 @@ static void init_system_av_info(void)
runloop->frames.limit.last_time = rarch_get_time_usec();
}
static void deinit_core(void)
static void deinit_core(bool reinit)
{
pretro_unload_game();
pretro_deinit();
rarch_main_command(RARCH_CMD_DRIVERS_DEINIT);
if (reinit)
rarch_main_command(RARCH_CMD_DRIVERS_DEINIT);
uninit_libretro_sym();
}
@ -2394,6 +2395,9 @@ bool rarch_main_command(unsigned cmd)
global->system.shutdown = false;
}
break;
case RARCH_CMD_UNLOAD_CORE:
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
break;
case RARCH_CMD_QUIT:
rarch_main_set_state(RARCH_ACTION_STATE_QUIT);
break;
@ -2602,7 +2606,7 @@ bool rarch_main_command(unsigned cmd)
global->core_info = core_info_list_new(settings->libretro_directory);
break;
case RARCH_CMD_CORE_DEINIT:
deinit_core();
deinit_core(true);
break;
case RARCH_CMD_CORE_INIT:
if (!init_core())

View File

@ -36,6 +36,7 @@ enum basic_event
RARCH_CMD_LOAD_CORE_DEINIT,
RARCH_CMD_LOAD_CORE,
RARCH_CMD_LOAD_CORE_PERSIST,
RARCH_CMD_UNLOAD_CORE,
RARCH_CMD_LOAD_STATE,
RARCH_CMD_SAVE_STATE,
/* Takes screenshot. */

View File

@ -3373,6 +3373,12 @@ static bool setting_append_list_main_menu_options(
(*list)[list_info->index - 1].change_handler = load_content_change_handler;
settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION);
CONFIG_ACTION(
"unload_core",
"Unload Core",
group_info.name,
subgroup_info.name);
settings_list_current_add_cmd(list, list_info, RARCH_CMD_UNLOAD_CORE);
CONFIG_ACTION(
"core_information",
@ -3482,6 +3488,7 @@ static bool setting_append_list_main_menu_options(
group_info.name,
subgroup_info.name);
#if !defined(IOS)
/* Apple rejects iOS apps that lets you forcibly quit an application. */
CONFIG_ACTION(