diff --git a/apple/OSX/platform.h b/apple/OSX/platform.h index 706148dfcf..8190fc9213 100644 --- a/apple/OSX/platform.h +++ b/apple/OSX/platform.h @@ -49,7 +49,7 @@ + (RetroArch_OSX*)get; - (void)loadingCore:(NSString*)core withFile:(const char*)file; -- (void)unloadingCore:(NSString*)core; +- (void)unloadingCore; @end diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 7af425f8ca..c3f13e0bca 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -282,7 +282,7 @@ static char** waiting_argv; [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:BOXSTRING(file)]]; } -- (void)unloadingCore:(const NSString*)core +- (void)unloadingCore { if (g_extern.system.shutdown) [[NSApplication sharedApplication] terminate:nil]; diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index a30f7b6d98..db833d25f9 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -29,7 +29,7 @@ @protocol RetroArch_Platform - (void)loadingCore:(NSString*)core withFile:(const char*)file; -- (void)unloadingCore:(NSString*)core; +- (void)unloadingCore; @end #ifdef IOS @@ -40,7 +40,7 @@ #endif extern char** apple_argv; -extern NSString* apple_core; +extern char apple_core[PATH_MAX]; extern id apple_platform; diff --git a/apple/common/main.m b/apple/common/main.m index 9c2cd20da9..4d4a45ae13 100644 --- a/apple/common/main.m +++ b/apple/common/main.m @@ -23,17 +23,11 @@ id apple_platform; #pragma mark EMULATION -NSString* apple_core; +char apple_core[PATH_MAX]; void apple_rarch_exited(void) { - NSString *used_core = (NSString*)apple_core; - apple_core = 0; - [apple_platform unloadingCore:used_core]; - -#ifdef OSX - [used_core release]; -#endif + [apple_platform unloadingCore]; } void apple_run_core(NSString* core, const char* file) @@ -44,16 +38,17 @@ void apple_run_core(NSString* core, const char* file) [apple_platform loadingCore:core withFile:file]; - apple_core = core; + if (core.UTF8String && core.UTF8String[0] != '\0') + strlcpy(apple_core, core.UTF8String, sizeof(apple_core)); if (file && core) { - strlcpy(core_path, apple_core.UTF8String, sizeof(core_path)); + strlcpy(core_path, apple_core, sizeof(core_path)); strlcpy(file_path, file, sizeof(file_path)); } - if (core_info_has_custom_config(apple_core.UTF8String)) - core_info_get_custom_config(apple_core.UTF8String, config_path, sizeof(config_path)); + if (core_info_has_custom_config(apple_core)) + core_info_get_custom_config(apple_core, config_path, sizeof(config_path)); else strlcpy(config_path, g_defaults.config_path, sizeof(config_path)); diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 95947f873c..6bc79c50fb 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -550,7 +550,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U nil]]; [settings addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("Core") - action:^{ [weakSelf.navigationController pushViewController:[[RACoreSettingsMenu alloc] initWithCore:apple_core] animated:YES]; }]]; + action:^{ [weakSelf.navigationController pushViewController:[[RACoreSettingsMenu alloc] initWithCore:BOXSTRING(apple_core)] animated:YES]; }]]; [settings addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("Core Options") action:^{ [weakSelf.navigationController pushViewController:[RACoreOptionsMenu new] animated:YES]; }]]; } diff --git a/apple/iOS/platform.h b/apple/iOS/platform.h index 77c4dd580b..0bf7845ef6 100644 --- a/apple/iOS/platform.h +++ b/apple/iOS/platform.h @@ -42,7 +42,7 @@ const void* apple_get_frontend_settings(void); - (void)showGameView; - (void)loadingCore:(NSString*)core withFile:(const char*)file; -- (void)unloadingCore:(NSString*)core; +- (void)unloadingCore; - (void)refreshSystemConfig; diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index ed5cdb6657..ccc7a46160 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -297,7 +297,7 @@ static void handle_touch_event(NSArray* touches) [self showGameView]; } -- (void)unloadingCore:(NSString*)core +- (void)unloadingCore { [self showPauseMenu:self];