From 471347689d1cb7160a4b69bb70ded38d74b9a6bb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 Sep 2016 13:47:26 +0200 Subject: [PATCH] Create path_clear_all --- managers/core_option_manager.c | 2 +- managers/core_option_manager.h | 2 +- paths.c | 11 +++++++++++ paths.h | 2 ++ runloop.c | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/managers/core_option_manager.c b/managers/core_option_manager.c index df6575adde..70ca896b96 100644 --- a/managers/core_option_manager.c +++ b/managers/core_option_manager.c @@ -247,7 +247,7 @@ bool core_option_manager_flush(core_option_manager_t *opt) * successfully saved to disk, otherwise false (0). **/ bool core_option_manager_flush_game_specific( - core_option_manager_t *opt, char* path) + core_option_manager_t *opt, const char* path) { size_t i; for (i = 0; i < opt->size; i++) diff --git a/managers/core_option_manager.h b/managers/core_option_manager.h index 2ee2db3354..46929df1f8 100644 --- a/managers/core_option_manager.h +++ b/managers/core_option_manager.h @@ -90,7 +90,7 @@ bool core_option_manager_flush(core_option_manager_t *opt); * successfully saved to disk, otherwise false (0). **/ bool core_option_manager_flush_game_specific( - core_option_manager_t *opt, char* path); + core_option_manager_t *opt, const char* path); /** * core_option_manager_free: diff --git a/paths.c b/paths.c index 64cd7a51cf..600335268e 100644 --- a/paths.c +++ b/paths.c @@ -513,6 +513,17 @@ const char *path_get_core_options(void) return NULL; } +void path_clear_all(void) +{ + global_t *global = global_get_ptr(); + + path_clear_core(); + path_clear_core_options(); + + if (global) + memset(&global->path, 0, sizeof(struct rarch_path)); +} + enum rarch_content_type path_is_media_type(const char *path) { char ext_lower[PATH_MAX_LENGTH] = {0}; diff --git a/paths.h b/paths.h index 2279f2b6ff..e0d897f33d 100644 --- a/paths.h +++ b/paths.h @@ -61,6 +61,8 @@ void path_clear_core(void); void path_clear_core_options(void); +void path_clear_all(void); + enum rarch_content_type path_is_media_type(const char *path); RETRO_END_DECLS diff --git a/runloop.c b/runloop.c index 41cf62f4e9..38969dd04c 100644 --- a/runloop.c +++ b/runloop.c @@ -745,6 +745,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) runloop_frontend_key_event = NULL; audio_driver_unset_callback(); + path_clear_all(); memset(&runloop_system, 0, sizeof(rarch_system_info_t)); break; case RUNLOOP_CTL_SET_FRAME_TIME_LAST: