From ed01b57036cd91492d75c0544214ebe6136ff6cf Mon Sep 17 00:00:00 2001 From: meancoot Date: Fri, 5 Apr 2013 12:09:03 -0400 Subject: [PATCH] (iOS) Fix stale sram and state paths after loading a game through RGUI. --- frontend/frontend_ios.c | 11 ++++++++--- ios/RetroArch/main.m | 5 +++++ ios/RetroArch/rarch_wrapper.h | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/frontend_ios.c b/frontend/frontend_ios.c index 7f415e8b85..ed014ab36f 100644 --- a/frontend/frontend_ios.c +++ b/frontend/frontend_ios.c @@ -17,11 +17,12 @@ #include #include -#include "../ios/RetroArch/rarch_wrapper.h" #include "../general.h" #include "../conf/config_file.h" #include "../file.h" +#include "../ios/RetroArch/rarch_wrapper.h" + #ifdef HAVE_RGUI #include "../frontend/menu/rgui.h" #endif @@ -89,6 +90,8 @@ void* rarch_main_ios(void* args) } #ifdef HAVE_RGUI + char* system_directory = ios_get_rarch_system_directory(); + menu_init(); g_extern.lifecycle_mode_state |= 1ULL << MODE_GAME; @@ -114,8 +117,8 @@ void* rarch_main_ios(void* args) args.verbose = g_extern.verbose; args.config_path = *g_extern.config_path ? g_extern.config_path : NULL; - args.sram_path = NULL; - args.state_path = NULL; + args.sram_path = system_directory; + args.state_path = system_directory; args.rom_path = g_extern.fullpath; args.libretro_path = g_settings.libretro; @@ -149,6 +152,8 @@ void* rarch_main_ios(void* args) menu_free(); if (g_extern.main_is_init) rarch_main_deinit(); + + free(system_directory); #else while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate()); rarch_main_deinit(); diff --git a/ios/RetroArch/main.m b/ios/RetroArch/main.m index 60d5a46397..94a9cb50e2 100644 --- a/ios/RetroArch/main.m +++ b/ios/RetroArch/main.m @@ -454,3 +454,8 @@ void ios_rarch_exited(void* result) { [[RetroArch_iOS get] rarchExited:result ? NO : YES]; } + +char* ios_get_rarch_system_directory() +{ + return strdup([RetroArch_iOS.get.system_directory UTF8String]); +} diff --git a/ios/RetroArch/rarch_wrapper.h b/ios/RetroArch/rarch_wrapper.h index e191e5a356..2e2e5e48cc 100644 --- a/ios/RetroArch/rarch_wrapper.h +++ b/ios/RetroArch/rarch_wrapper.h @@ -16,6 +16,9 @@ #ifndef __IOS_RARCH_WRAPPER_H__ #define __IOS_RARCH_WRAPPER_H__ +// The result needs to be free()'d +char* ios_get_rarch_system_directory(); + // These functions should only be called as arguments to dispatch_sync void ios_rarch_exited(void* result);