(Apple) Refactor apple_run_core

This commit is contained in:
Twinaphex 2014-07-24 04:32:46 +02:00
parent fa2135fa3e
commit 350913daa7
4 changed files with 10 additions and 10 deletions

View File

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

View File

@ -43,7 +43,7 @@ extern char** apple_argv;
extern id<RetroArch_Platform> 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);

View File

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

View File

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