(Menu/General) Refactor rarch_defer_core

This commit is contained in:
twinaphex 2014-09-03 05:59:16 +02:00
parent 2eb350e6a2
commit 5574e00ae3
3 changed files with 16 additions and 18 deletions

View File

@ -1947,12 +1947,21 @@ static int menu_action_ok(const char *dir,
{
if (driver.menu->defer_core)
{
int ret = menu_defer_core(driver.menu->core_info, dir, path,
driver.menu->deferred_path,
const core_info_t *info = NULL;
int ret = rarch_defer_core(info, driver.menu->core_info,
dir, path, driver.menu->deferred_path,
sizeof(driver.menu->deferred_path));
if (ret == -1)
{
strlcpy(g_extern.fullpath, driver.menu->deferred_path,
sizeof(g_extern.fullpath));
if (path_file_exists(info->path))
strlcpy(g_settings.libretro, info->path,
sizeof(g_settings.libretro));
rarch_main_command(RARCH_CMD_LOAD_CONTENT);
rarch_main_command(RARCH_CMD_LOAD_CORE);
menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
driver.menu->msg_force = true;

View File

@ -57,10 +57,10 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content)
/* When selection is presented back, returns 0.
* If it can make a decision right now, returns -1. */
int menu_defer_core(core_info_list_t *core_info, const char *dir,
int rarch_defer_core(const core_info_t *info,
core_info_list_t *core_info, const char *dir,
const char *path, char *deferred_path, size_t sizeof_deferred_path)
{
const core_info_t *info = NULL;
size_t supported = 0;
fill_pathname_join(deferred_path, dir, path, sizeof_deferred_path);
@ -71,19 +71,7 @@ int menu_defer_core(core_info_list_t *core_info, const char *dir,
/* Can make a decision right now. */
if (supported == 1)
{
strlcpy(g_extern.fullpath, deferred_path, sizeof(g_extern.fullpath));
if (path_file_exists(info->path))
strlcpy(g_settings.libretro, info->path, sizeof(g_settings.libretro));
#ifdef HAVE_DYNAMIC
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
#else
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)g_extern.fullpath);
#endif
return -1;
}
return 0;
}

View File

@ -184,8 +184,9 @@ bool menu_replace_config(const char *path);
bool menu_save_new_config(void);
int menu_defer_core(core_info_list_t *data, const char *dir,
const char *path, char *deferred_path, size_t sizeof_deferred_path);
int rarch_defer_core(const core_info_t *info, core_info_list_t *data,
const char *dir, const char *path, char *deferred_path,
size_t sizeof_deferred_path);
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);