No more configuration.h dependencies in core_info.c
This commit is contained in:
parent
7ccecc80c1
commit
8ca8f92aeb
|
@ -2206,7 +2206,8 @@ TODO: Add a setting for these tweaks */
|
|||
command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL);
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_libretro))
|
||||
core_info_init_list();
|
||||
core_info_init_list(settings->paths.path_libretro_info,
|
||||
settings->paths.directory_libretro);
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_CORE_DEINIT:
|
||||
|
|
33
core_info.c
33
core_info.c
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <file/config_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/archive_file.h>
|
||||
|
@ -31,7 +32,6 @@
|
|||
|
||||
#include "config.def.h"
|
||||
#include "core_info.h"
|
||||
#include "configuration.h"
|
||||
#include "file_path_special.h"
|
||||
#include "list_special.h"
|
||||
|
||||
|
@ -224,21 +224,18 @@ static bool core_info_list_iterate(
|
|||
return true;
|
||||
}
|
||||
|
||||
static core_info_list_t *core_info_list_new(const char *path)
|
||||
static core_info_list_t *core_info_list_new(const char *path, const char *libretro_info_dir)
|
||||
{
|
||||
size_t i;
|
||||
core_info_t *core_info = NULL;
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
const char *path_basedir = libretro_info_dir;
|
||||
struct string_list *contents = dir_list_new_special(
|
||||
path, DIR_LIST_CORES, NULL);
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_basedir = !string_is_empty(settings->paths.path_libretro_info) ?
|
||||
settings->paths.path_libretro_info : settings->paths.directory_libretro;
|
||||
|
||||
if (!contents)
|
||||
return NULL;
|
||||
|
||||
|
||||
core_info_list = (core_info_list_t*)calloc(1, sizeof(*core_info_list));
|
||||
if (!core_info_list)
|
||||
goto error;
|
||||
|
@ -635,14 +632,10 @@ void core_info_deinit_list(void)
|
|||
core_info_curr_list = NULL;
|
||||
}
|
||||
|
||||
bool core_info_init_list(void)
|
||||
bool core_info_init_list(const char *path_info, const char *dir_cores)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings)
|
||||
core_info_curr_list = core_info_list_new(settings->paths.directory_libretro);
|
||||
|
||||
if (!core_info_curr_list)
|
||||
if (!(core_info_curr_list = core_info_list_new(dir_cores,
|
||||
!string_is_empty(path_info) ? path_info : dir_cores)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -751,15 +744,13 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
|||
*num_infos = supported;
|
||||
}
|
||||
|
||||
void core_info_get_name(const char *path, char *s, size_t len)
|
||||
void core_info_get_name(const char *path, char *s, size_t len,
|
||||
const char *path_info, const char *dir_cores)
|
||||
{
|
||||
size_t i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *contents = dir_list_new_special(
|
||||
settings->paths.directory_libretro,
|
||||
DIR_LIST_CORES, NULL);
|
||||
const char *path_basedir = !string_is_empty(settings->paths.path_libretro_info) ?
|
||||
settings->paths.path_libretro_info : settings->paths.directory_libretro;
|
||||
const char *path_basedir = !string_is_empty(path_info) ?
|
||||
path_info : dir_cores;
|
||||
struct string_list *contents = dir_list_new_special(dir_cores, DIR_LIST_CORES, NULL);
|
||||
|
||||
if (!contents)
|
||||
return;
|
||||
|
@ -786,7 +777,7 @@ void core_info_get_name(const char *path, char *s, size_t len)
|
|||
continue;
|
||||
}
|
||||
|
||||
conf = config_file_new(info_path);
|
||||
conf = config_file_new(info_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ bool core_info_list_get_display_name(core_info_list_t *list,
|
|||
|
||||
bool core_info_get_display_name(const char *path, char *s, size_t len);
|
||||
|
||||
void core_info_get_name(const char *path, char *s, size_t len);
|
||||
void core_info_get_name(const char *path, char *s, size_t len, const char *path_info, const char *dir_cores);
|
||||
|
||||
core_info_t *core_info_get(core_info_list_t *list, size_t i);
|
||||
|
||||
|
@ -109,7 +109,7 @@ bool core_info_get_current_core(core_info_t **core);
|
|||
|
||||
void core_info_deinit_list(void);
|
||||
|
||||
bool core_info_init_list(void);
|
||||
bool core_info_init_list(const char *path_info, const char *dir_cores);
|
||||
|
||||
bool core_info_get_list(core_info_list_t **core);
|
||||
|
||||
|
|
|
@ -2267,6 +2267,7 @@ static int action_ok_core_deferred_set(const char *new_core_path,
|
|||
const char *content_label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char core_display_name[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
|
@ -2276,7 +2277,9 @@ static int action_ok_core_deferred_set(const char *new_core_path,
|
|||
core_display_name[0] = '\0';
|
||||
|
||||
core_info_get_name(new_core_path,
|
||||
core_display_name, sizeof(core_display_name));
|
||||
core_display_name, sizeof(core_display_name),
|
||||
settings->paths.path_libretro_info,
|
||||
settings->paths.directory_libretro);
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
menu->rdb_entry_start_game_selection_ptr,
|
||||
|
|
Loading…
Reference in New Issue