Cleanups / get rid of more dependencies

This commit is contained in:
twinaphex 2018-04-10 04:31:19 +02:00
parent 6f0fc2426d
commit c9e48cd9de
5 changed files with 42 additions and 17 deletions

View File

@ -2202,12 +2202,20 @@ TODO: Add a setting for these tweaks */
break;
case CMD_EVENT_CORE_INFO_INIT:
{
char ext_name[255];
ext_name[0] = '\0';
settings_t *settings = config_get_ptr();
command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL);
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return false;
if (!string_is_empty(settings->paths.directory_libretro))
core_info_init_list(settings->paths.path_libretro_info,
settings->paths.directory_libretro);
settings->paths.directory_libretro,
ext_name,
settings->bools.show_hidden_files
);
}
break;
case CMD_EVENT_CORE_DEINIT:

View File

@ -29,10 +29,8 @@
#include "verbosity.h"
#include "config.def.h"
#include "core_info.h"
#include "file_path_special.h"
#include "list_special.h"
static const char *core_info_tmp_path = NULL;
static const struct string_list *core_info_tmp_list = NULL;
@ -223,15 +221,20 @@ static bool core_info_list_iterate(
return true;
}
static core_info_list_t *core_info_list_new(const char *path, const char *libretro_info_dir)
static core_info_list_t *core_info_list_new(const char *path,
const char *libretro_info_dir,
const char *exts,
bool show_hidden_files)
{
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);
struct string_list *contents = dir_list_new(
path, exts,
false,
show_hidden_files,
false, false);
if (!contents)
return NULL;
@ -631,10 +634,13 @@ void core_info_deinit_list(void)
core_info_curr_list = NULL;
}
bool core_info_init_list(const char *path_info, const char *dir_cores)
bool core_info_init_list(const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files)
{
if (!(core_info_curr_list = core_info_list_new(dir_cores,
!string_is_empty(path_info) ? path_info : dir_cores)))
!string_is_empty(path_info) ? path_info : dir_cores,
exts,
show_hidden_files)))
return false;
return true;
}
@ -746,14 +752,14 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
}
void core_info_get_name(const char *path, char *s, size_t len,
const char *path_info, const char *dir_cores)
const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files)
{
size_t i;
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);
struct string_list *contents = dir_list_new(
dir_cores, exts, false, show_hidden_files, false, false);
if (!contents)
return;

View File

@ -97,7 +97,9 @@ 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, const char *path_info, const char *dir_cores);
void core_info_get_name(const char *path, char *s, size_t len,
const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files);
core_info_t *core_info_get(core_info_list_t *list, size_t i);
@ -109,7 +111,8 @@ bool core_info_get_current_core(core_info_t **core);
void core_info_deinit_list(void);
bool core_info_init_list(const char *path_info, const char *dir_cores);
bool core_info_init_list(const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files);
bool core_info_get_list(core_info_list_t **core);

View File

@ -2268,20 +2268,28 @@ static int action_ok_path_scan_directory(const char *path,
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 ext_name[255];
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();
ext_name[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return menu_cbs_exit();
core_display_name[0] = '\0';
core_info_get_name(new_core_path,
core_display_name, sizeof(core_display_name),
settings->paths.path_libretro_info,
settings->paths.directory_libretro);
settings->paths.directory_libretro,
ext_name,
settings->bools.show_hidden_files);
command_playlist_update_write(
NULL,
menu->rdb_entry_start_game_selection_ptr,

View File

@ -28,6 +28,7 @@
#include <streams/interface_stream.h>
#include "tasks_internal.h"
#include "../core_info.h"
#include "../database_info.h"
#include "../file_path_special.h"
@ -37,7 +38,6 @@
#include "../retroarch.h"
#endif
#include "../verbosity.h"
#include "../core_info.h"
#ifndef COLLECTION_SIZE
#define COLLECTION_SIZE 99999