From 350913daa703072e223f13d5d11f056786498413 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 24 Jul 2014 04:32:46 +0200 Subject: [PATCH] (Apple) Refactor apple_run_core --- apple/OSX/platform.m | 2 +- apple/common/RetroArch_Apple.h | 2 +- apple/common/main.m | 10 +++++----- apple/iOS/menu.m | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index ea5502d007..498835925e 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -271,7 +271,7 @@ static char** waiting_argv; #endif if (!g_extern.main_is_init) - apple_run_core(0, NULL, self.core, g_extern.fullpath); + apple_run_core(0, NULL, self.core.UTF8String, g_extern.fullpath); else g_extern.system.shutdown = true; } diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index 5ee494c5f9..43dad90427 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -43,7 +43,7 @@ extern char** apple_argv; extern id apple_platform; // main.m -extern void apple_run_core(int argc, char **argv, NSString* core, const char* file); +extern void apple_run_core(int argc, char **argv, const char * core, const char* file); extern void apple_start_iteration(void); extern void apple_stop_iteration(void); diff --git a/apple/common/main.m b/apple/common/main.m index 0a1ad2e406..3c35f1a162 100644 --- a/apple/common/main.m +++ b/apple/common/main.m @@ -27,22 +27,22 @@ void apple_rarch_exited(void) [apple_platform unloadingCore]; } -void apple_run_core(int argc, char **argv, NSString* core, +void apple_run_core(int argc, char **argv, const char* core, const char* file) { static char core_path[PATH_MAX], file_path[PATH_MAX], config_path[PATH_MAX]; - [apple_platform loadingCore:core withFile:file]; + [apple_platform loadingCore:BOXSTRING(core) withFile:file]; if (file) strlcpy(file_path, file, sizeof(file_path)); if (core) - strlcpy(core_path, core.UTF8String, sizeof(core_path)); + strlcpy(core_path, core, sizeof(core_path)); strlcpy(config_path, g_defaults.config_path, sizeof(config_path)); - if (core_info_has_custom_config(core.UTF8String)) - core_info_get_custom_config(core.UTF8String, config_path, sizeof(config_path)); + if (core_info_has_custom_config(core)) + core_info_get_custom_config(core, config_path, sizeof(config_path)); static const char* const argv_game[] = { "retroarch", "-c", config_path, "-L", core_path, file_path, 0 }; static const char* const argv_menu[] = { "retroarch", "-c", config_path, "--menu", 0 }; diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index bd7b45e027..af416d2dce 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -592,7 +592,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U action: ^(NSString* core) { if (path) - apple_run_core(0, NULL, core, path.UTF8String); + apple_run_core(0, NULL, core.UTF8String, path.UTF8String); else { weakSelf.core = core; @@ -617,7 +617,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if (item && !item.isDirectory) { if (weakSelf.core) - apple_run_core(0, NULL, weakSelf.core, item.path.UTF8String); + apple_run_core(0, NULL, weakSelf.core.UTF8String, item.path.UTF8String); else [weakSelf chooseCoreWithPath:item.path]; } @@ -677,7 +677,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U for (i = 0; _history && i < content_history_size(_history); i ++) { RAMenuItemBasic* item = [RAMenuItemBasic itemWithDescription:BOXSTRING(path_basename(content_history_get_path(weakSelf.history, i))) - action:^{ apple_run_core(0, NULL, BOXSTRING(content_history_get_core_path(weakSelf.history, i)), + action:^{ apple_run_core(0, NULL, content_history_get_core_path(weakSelf.history, i), content_history_get_path(weakSelf.history, i)); } detail:^{ return BOXSTRING(content_history_get_core_name(weakSelf.history, i)); }]; [section addObject:item];