Skip to content

Commit

Permalink
Get rid of configuration.h dependency in list_special.c
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jul 18, 2016
1 parent 8345ad2 commit 397f82c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 9 additions & 2 deletions core_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,15 @@ static core_info_list_t *core_info_list_new(void)
size_t i;
core_info_t *core_info = NULL;
core_info_list_t *core_info_list = NULL;
struct string_list *contents =
dir_list_new_special(NULL, DIR_LIST_CORES, NULL);
struct string_list *contents = NULL;
settings_t *settings = config_get_ptr();

if (!settings)
return NULL;

contents = dir_list_new_special(
settings->directory.libretro,
DIR_LIST_CORES, NULL);

if (!contents)
return NULL;
Expand Down
9 changes: 3 additions & 6 deletions list_special.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "list_special.h"
#include "frontend/frontend_driver.h"
#include "configuration.h"
#include "core_info.h"

#ifdef HAVE_MENU
Expand Down Expand Up @@ -54,10 +53,8 @@ struct string_list *dir_list_new_special(const char *input_dir,
const char *dir = NULL;
const char *exts = NULL;
bool include_dirs = false;
settings_t *settings = config_get_ptr();

(void)input_dir;
(void)settings;

switch (type)
{
Expand All @@ -66,7 +63,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
exts = filter;
break;
case DIR_LIST_CORES:
dir = settings->directory.libretro;
dir = input_dir;

if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return NULL;
Expand Down Expand Up @@ -109,11 +106,11 @@ struct string_list *dir_list_new_special(const char *input_dir,
}
break;
case DIR_LIST_COLLECTIONS:
dir = settings->directory.playlist;
dir = input_dir;
exts = "lpl";
break;
case DIR_LIST_DATABASES:
dir = settings->path.content_database;
dir = input_dir;
exts = "rdb";
break;
case DIR_LIST_PLAIN:
Expand Down
4 changes: 3 additions & 1 deletion tasks/task_database.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ static void task_database_cleanup_state(

static void task_database_handler(retro_task_t *task)
{
settings_t *settings = config_get_ptr();
db_handle_t *db = (db_handle_t*)task->state;
database_info_handle_t *dbinfo = db->handle;
database_state_handle_t *dbstate = &db->state;
Expand All @@ -578,7 +579,8 @@ static void task_database_handler(retro_task_t *task)
case DATABASE_STATUS_ITERATE_BEGIN:
if (dbstate && !dbstate->list)
dbstate->list = dir_list_new_special(
NULL, DIR_LIST_DATABASES, NULL);
settings->path.content_database,
DIR_LIST_DATABASES, NULL);
dbinfo->status = DATABASE_STATUS_ITERATE_START;
break;
case DATABASE_STATUS_ITERATE_START:
Expand Down

0 comments on commit 397f82c

Please sign in to comment.