(Apple) Got rid of apple_is_running global variable

This commit is contained in:
Twinaphex 2014-07-10 22:02:54 +02:00
parent c65af98255
commit 7dc418fcdd
4 changed files with 13 additions and 24 deletions

View File

@ -180,10 +180,7 @@ static char** waiting_argv;
apple_display_alert("No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there.", "RetroArch");
if (waiting_argc)
{
apple_is_running = true;
apple_rarch_load_content(&waiting_argc, waiting_argv);
}
apple_rarch_load_content(&waiting_argc, waiting_argv);
else if (!_wantReload)
apple_run_core(nil, 0);
else
@ -202,12 +199,15 @@ static char** waiting_argv;
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
NSApplicationTerminateReply reply = NSTerminateNow;
_isTerminating = true;
if (apple_is_running)
g_extern.system.shutdown = true;
if (g_extern.main_is_init)
reply = NSTerminateCancel;
g_extern.system.shutdown = true;
return apple_is_running ? NSTerminateCancel : NSTerminateNow;
return reply;
}
@ -255,9 +255,9 @@ static char** waiting_argv;
// This utility function will queue the self.core and self.file instance values for running.
- (void)runCore
{
_wantReload = apple_is_running;
_wantReload = g_extern.main_is_init;
if (!apple_is_running)
if (!g_extern.main_is_init)
apple_run_core(self.core, self.file.UTF8String);
else
g_extern.system.shutdown = true;
@ -324,7 +324,7 @@ static char** waiting_argv;
- (IBAction)basicEvent:(id)sender
{
if (!apple_is_running)
if (!g_extern.main_is_init)
return;
apple_event_basic_command([sender tag]);

View File

@ -45,7 +45,6 @@
extern char** apple_argv;
extern bool apple_is_paused;
extern bool apple_is_running;
extern bool apple_use_tv_mode;
extern NSString* apple_core;

View File

@ -23,7 +23,6 @@
id<RetroArch_Platform> apple_platform;
#pragma mark EMULATION
bool apple_is_running;
bool apple_use_tv_mode;
NSString* apple_core;
@ -31,12 +30,7 @@ void apple_rarch_exited(void)
{
NSString *used_core = (NSString*)apple_core;
apple_core = 0;
if (apple_is_running)
{
apple_is_running = false;
[apple_platform unloadingCore:used_core];
}
[apple_platform unloadingCore:used_core];
#ifdef OSX
[used_core release];
@ -53,14 +47,10 @@ void apple_run_core(NSString* core, const char* file)
int argc;
(void)config_path;
if (apple_is_running)
return;
[apple_platform loadingCore:core withFile:file];
apple_core = core;
apple_is_running = true;
if (file && core)
{

View File

@ -526,7 +526,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
action:^{ [weakSelf.navigationController pushViewController:[RAFrontendSettingsMenu new] animated:YES]; }],
nil];
if (!apple_is_running)
if (!g_extern.main_is_init)
{
[self.sections addObject:[NSArray arrayWithObjects:BOXSTRING("Content"),
[RAMenuItemBasic itemWithDescription:BOXSTRING("Choose Core")
@ -557,7 +557,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
[self.sections addObject:settings];
if (apple_is_running)
if (g_extern.main_is_init)
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Resume") style:UIBarButtonItemStyleBordered target:[RetroArch_iOS get] action:@selector(showGameView)];
else
self.navigationItem.leftBarButtonItem = nil;