From 5aebdb748415047c7be8b5f20bb0d6917a235a5e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 Sep 2016 12:35:29 +0200 Subject: [PATCH] Mov code to paths.c --- configuration.c | 43 +------------------------------------------ configuration.h | 14 -------------- frontend/frontend.c | 2 +- menu/menu_setting.c | 2 +- menu/menu_shader.c | 1 + paths.c | 43 +++++++++++++++++++++++++++++++++++++++++++ paths.h | 14 ++++++++++++++ runloop.c | 1 + tasks/task_content.c | 1 + 9 files changed, 63 insertions(+), 58 deletions(-) diff --git a/configuration.c b/configuration.c index ce4bd3954a..4628c96fde 100644 --- a/configuration.c +++ b/configuration.c @@ -38,6 +38,7 @@ #include "input/input_remapping.h" #include "defaults.h" #include "core.h" +#include "paths.h" #include "retroarch.h" #include "runloop.h" #include "verbosity.h" @@ -3217,48 +3218,6 @@ bool config_replace(char *path) return true; } -static char path_libretro[PATH_MAX_LENGTH]; - -char *config_get_active_core_path_ptr(void) -{ - return path_libretro; -} - -const char *config_get_active_core_path(void) -{ - return path_libretro; -} - -bool config_active_core_path_is_empty(void) -{ - return !path_libretro[0]; -} - -size_t config_get_active_core_path_size(void) -{ - return sizeof(path_libretro); -} - -void config_set_active_core_path(const char *path) -{ - strlcpy(path_libretro, path, sizeof(path_libretro)); -} - -void config_clear_active_core_path(void) -{ - *path_libretro = '\0'; -} - -const char *config_get_active_path(void) -{ - global_t *global = global_get_ptr(); - - if (!string_is_empty(global->path.config)) - return global->path.config; - - return NULL; -} - void config_free_state(void) { } diff --git a/configuration.h b/configuration.h index 602e3cb25c..a2f38187ae 100644 --- a/configuration.h +++ b/configuration.h @@ -631,20 +631,6 @@ bool config_overlay_enable_default(void); void config_free(void); -const char *config_get_active_path(void); - -const char *config_get_active_core_path(void); - -char *config_get_active_core_path_ptr(void); - -void config_set_active_core_path(const char *path); - -void config_clear_active_core_path(void); - -bool config_active_core_path_is_empty(void); - -size_t config_get_active_core_path_size(void); - void config_free_state(void); settings_t *config_get_ptr(void); diff --git a/frontend/frontend.c b/frontend/frontend.c index 577f8409b1..766a0dd659 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -30,8 +30,8 @@ #include "../ui/ui_companion_driver.h" #include "../tasks/tasks_internal.h" -#include "../configuration.h" #include "../driver.h" +#include "../paths.h" #include "../retroarch.h" #include "../runloop.h" diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 4bbc769230..c6e24eec76 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -56,7 +56,7 @@ #include "../msg_hash.h" #include "../defaults.h" #include "../driver.h" -#include "../core.h" +#include "../paths.h" #include "../dynamic.h" #include "../runloop.h" #include "../verbosity.h" diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 11c41c3bd4..e09134bb54 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -29,6 +29,7 @@ #include "menu_shader.h" #include "../file_path_special.h" #include "../configuration.h" +#include "../paths.h" #include "../runloop.h" #include "../verbosity.h" diff --git a/paths.c b/paths.c index 3e3d68d3b4..f21d949823 100644 --- a/paths.c +++ b/paths.c @@ -13,6 +13,7 @@ * If not, see . */ +#include #include #include #include @@ -30,6 +31,7 @@ #include "command.h" #include "content.h" #include "dynamic.h" +#include "movie.h" #include "file_path_special.h" #include "core.h" @@ -41,6 +43,7 @@ #define MENU_VALUE_NO_CORE 0x7d5472cbU static char current_savefile_dir[PATH_MAX_LENGTH] = {0}; +static char path_libretro[PATH_MAX_LENGTH] = {0}; void path_set_redirect(void) { @@ -411,3 +414,43 @@ void path_fill_names(void) file_path_str(FILE_PATH_IPS_EXTENSION), sizeof(global->name.ips)); } + +char *config_get_active_core_path_ptr(void) +{ + return path_libretro; +} + +const char *config_get_active_core_path(void) +{ + return path_libretro; +} + +bool config_active_core_path_is_empty(void) +{ + return !path_libretro[0]; +} + +size_t config_get_active_core_path_size(void) +{ + return sizeof(path_libretro); +} + +void config_set_active_core_path(const char *path) +{ + strlcpy(path_libretro, path, sizeof(path_libretro)); +} + +void config_clear_active_core_path(void) +{ + *path_libretro = '\0'; +} + +const char *config_get_active_path(void) +{ + global_t *global = global_get_ptr(); + + if (!string_is_empty(global->path.config)) + return global->path.config; + + return NULL; +} diff --git a/paths.h b/paths.h index adc2a92ba4..043b6a27d6 100644 --- a/paths.h +++ b/paths.h @@ -35,6 +35,20 @@ void path_set_basename(const char *path); const char *path_get_current_savefile_dir(void); +const char *config_get_active_path(void); + +const char *config_get_active_core_path(void); + +char *config_get_active_core_path_ptr(void); + +void config_set_active_core_path(const char *path); + +void config_clear_active_core_path(void); + +bool config_active_core_path_is_empty(void); + +size_t config_get_active_core_path_size(void); + RETRO_END_DECLS #endif diff --git a/runloop.c b/runloop.c index 78ac4b27a8..24b6f5950f 100644 --- a/runloop.c +++ b/runloop.c @@ -61,6 +61,7 @@ #include "configuration.h" #include "driver.h" #include "movie.h" +#include "paths.h" #include "retroarch.h" #include "runloop.h" #include "file_path_special.h" diff --git a/tasks/task_content.c b/tasks/task_content.c index b994179a8f..8ceeeea6d6 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -85,6 +85,7 @@ #include "../retroarch.h" #include "../file_path_special.h" #include "../core.h" +#include "../paths.h" #include "../verbosity.h" #ifdef HAVE_7ZIP