(iOS) Fix stale sram and state paths after loading a game through RGUI.

This commit is contained in:
meancoot 2013-04-05 12:09:03 -04:00
parent 0d3e025121
commit ed01b57036
3 changed files with 16 additions and 3 deletions

View File

@ -17,11 +17,12 @@
#include <dispatch/dispatch.h>
#include <pthread.h>
#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();

View File

@ -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]);
}

View File

@ -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);