mirror of
https://github.com/libretro/RetroArch
synced 2025-02-24 00:39:54 +00:00
(Apple) common/main.m - some cleanups
This commit is contained in:
parent
5d6091ab2b
commit
0f6f14aff3
@ -27,40 +27,40 @@ void apple_rarch_exited(void)
|
|||||||
[apple_platform unloadingCore];
|
[apple_platform unloadingCore];
|
||||||
}
|
}
|
||||||
|
|
||||||
void apple_run_core(int argc, char **argv, NSString* core, const char* file)
|
void apple_run_core(int argc, char **argv, NSString* core,
|
||||||
|
const char* file)
|
||||||
{
|
{
|
||||||
static char core_path[PATH_MAX], file_path[PATH_MAX], config_path[PATH_MAX];
|
static char core_path[PATH_MAX], file_path[PATH_MAX],
|
||||||
|
config_path[PATH_MAX];
|
||||||
[apple_platform loadingCore:core withFile:file];
|
|
||||||
|
|
||||||
if (file && core)
|
[apple_platform loadingCore:core withFile:file];
|
||||||
{
|
|
||||||
strlcpy(core_path, core.UTF8String, sizeof(core_path));
|
if (file)
|
||||||
strlcpy(file_path, file, sizeof(file_path));
|
strlcpy(file_path, file, sizeof(file_path));
|
||||||
}
|
if (core)
|
||||||
|
strlcpy(core_path, core.UTF8String, sizeof(core_path));
|
||||||
if (core_info_has_custom_config(core.UTF8String))
|
|
||||||
core_info_get_custom_config(core.UTF8String, config_path, sizeof(config_path));
|
|
||||||
else
|
|
||||||
strlcpy(config_path, g_defaults.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 };
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
argc = (file && core) ? 6 : 4;
|
|
||||||
if (!argv)
|
|
||||||
argv = (char**)((file && core) ? argv_game : argv_menu);
|
|
||||||
|
|
||||||
if (rarch_main(argc, argv))
|
strlcpy(config_path, g_defaults.config_path, sizeof(config_path));
|
||||||
{
|
if (core_info_has_custom_config(core.UTF8String))
|
||||||
char basedir[256];
|
core_info_get_custom_config(core.UTF8String, config_path, sizeof(config_path));
|
||||||
fill_pathname_basedir(basedir, file ? file : "", sizeof(basedir));
|
|
||||||
if (file && access(basedir, R_OK | W_OK | X_OK))
|
static const char* const argv_game[] = { "retroarch", "-c", config_path, "-L", core_path, file_path, 0 };
|
||||||
apple_display_alert("The directory containing the selected file must have write permissions. This will prevent zipped content from loading, and will cause some cores to not function.", "Warning");
|
static const char* const argv_menu[] = { "retroarch", "-c", config_path, "--menu", 0 };
|
||||||
else
|
|
||||||
apple_display_alert("Failed to load content.", "Error");
|
if (argc == 0)
|
||||||
|
argc = (file && core) ? 6 : 4;
|
||||||
apple_rarch_exited();
|
if (!argv)
|
||||||
}
|
argv = (char**)((file && core) ? argv_game : argv_menu);
|
||||||
|
|
||||||
|
if (rarch_main(argc, argv))
|
||||||
|
{
|
||||||
|
char basedir[256];
|
||||||
|
fill_pathname_basedir(basedir, file ? file : "", sizeof(basedir));
|
||||||
|
if (file && access(basedir, R_OK | W_OK | X_OK))
|
||||||
|
apple_display_alert("The directory containing the selected file must have write permissions. This will prevent zipped content from loading, and will cause some cores to not function.", "Warning");
|
||||||
|
else
|
||||||
|
apple_display_alert("Failed to load content.", "Error");
|
||||||
|
|
||||||
|
apple_rarch_exited();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user