(iOS) Fixes:

Only display the limited permissions warning if the content actually failed to load.
	Fix loading a second game through the cocoa menu.
This commit is contained in:
meancoot 2013-12-24 14:21:57 -05:00
parent 090c0d8e84
commit 06c3cc1cb8
2 changed files with 31 additions and 40 deletions

View File

@ -32,18 +32,31 @@ NSString* apple_core;
static CFRunLoopObserverRef iterate_observer; static CFRunLoopObserverRef iterate_observer;
static void apple_rarch_exited()
{
NSString* used_core = apple_core;
apple_core = 0;
if (apple_is_running)
{
apple_is_running = false;
[apple_platform unloadingCore:used_core];
}
#ifdef OSX
[used_core release];
#endif
if (apple_use_tv_mode)
apple_run_core(nil, 0);
}
static void do_iteration() static void do_iteration()
{ {
if (iterate_observer && apple_is_running && !g_extern.is_paused) if (iterate_observer && apple_is_running && !g_extern.is_paused)
{ {
if (apple_rarch_iterate_once()) if (apple_rarch_iterate_once())
{ apple_rarch_exited();
CFRunLoopObserverInvalidate(iterate_observer);
CFRelease(iterate_observer);
iterate_observer = 0;
apple_rarch_exited(false);
}
else else
CFRunLoopWakeUp(CFRunLoopGetMain()); CFRunLoopWakeUp(CFRunLoopGetMain());
} }
@ -72,14 +85,6 @@ void apple_run_core(NSString* core, const char* file)
{ {
if (!apple_is_running) if (!apple_is_running)
{ {
#ifndef OSX
char basedir[256];
fill_pathname_basedir(basedir, file, sizeof(basedir));
if (file && access(basedir, R_OK | W_OK | X_OK))
apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
"prevent zipped content from loading, and will cause some cores to not function.", 0);
#endif
[apple_platform loadingCore:core withFile:file]; [apple_platform loadingCore:core withFile:file];
apple_core = core; apple_core = core;
@ -107,28 +112,16 @@ void apple_run_core(NSString* core, const char* file)
char** argv = (char**)((file && core) ? argv_game : argv_menu); char** argv = (char**)((file && core) ? argv_game : argv_menu);
if (apple_rarch_load_content(argc, argv)) if (apple_rarch_load_content(argc, argv))
apple_rarch_exited(true); {
} char basedir[256];
} fill_pathname_basedir(basedir, file ? file : "", sizeof(basedir));
if (file && access(basedir, R_OK | W_OK | X_OK))
void apple_rarch_exited(bool on_error) apple_display_alert(@"The directory containing the selected file must have write premissions. This will "
{ "prevent zipped content from loading, and will cause some cores to not function.", 0);
if (on_error) else
apple_display_alert(@"Failed to load content.", 0); apple_display_alert(@"Failed to load content.", 0);
NSString* used_core = apple_core; apple_rarch_exited();
apple_core = 0; }
if (apple_is_running)
{
apple_is_running = false;
[apple_platform unloadingCore:used_core];
} }
#ifdef OSX
[used_core release];
#endif
if (apple_use_tv_mode)
apple_run_core(nil, 0);
} }

View File

@ -19,8 +19,6 @@
#include "gfx/gfx_context.h" #include "gfx/gfx_context.h"
void apple_rarch_exited (bool on_error);
// These functions must only be called in gfx/context/apple_gl_context.c // These functions must only be called in gfx/context/apple_gl_context.c
bool apple_gfx_ctx_init(void); bool apple_gfx_ctx_init(void);
void apple_gfx_ctx_destroy(void); void apple_gfx_ctx_destroy(void);