Create config_active_core_path_is_empty

This commit is contained in:
twinaphex 2016-07-24 11:27:44 +02:00
parent 2be127c04a
commit 16908435bb
3 changed files with 10 additions and 3 deletions

View File

@ -3146,6 +3146,12 @@ const char *config_get_active_core_path(void)
return settings->path.libretro;
}
bool config_active_core_path_is_empty(void)
{
settings_t *settings = config_get_ptr();
return !settings->path.libretro[0];
}
void config_set_active_core_path(const char *path)
{
settings_t *settings = config_get_ptr();

View File

@ -604,6 +604,8 @@ void config_set_active_core_path(const char *path);
void config_clear_active_core_path(void);
bool config_active_core_path_is_empty(void);
void config_free_state(void);
settings_t *config_get_ptr(void);

View File

@ -405,12 +405,11 @@ static void frontend_gx_process_args(int *argc, char *argv[])
{
#ifndef IS_SALAMANDER
char path[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr();
/* A big hack: sometimes Salamander doesn't save the new core
* it loads on first boot, so we make sure
* settings->path.libretro is set here. */
if (!settings->path.libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
* active core path is set here. */
if (config_active_core_path_is_empty() && *argc >= 1 && strrchr(argv[0], '/'))
{
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
if (path_file_exists(path))