(Frontend) Move more platform-specific code into environment_get function

implementations
This commit is contained in:
twinaphex 2013-08-10 20:59:10 +02:00
parent b33d4d29d2
commit d640c16eb3
8 changed files with 61 additions and 26 deletions

View File

@ -83,22 +83,9 @@ void rarch_make_dir(const char *x, const char *name)
}
#endif
static void rarch_get_environment(int argc, char *argv[])
{
g_extern.verbose = true;
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
g_extern.log_file = fopen("/retroarch-log.txt", "w");
#endif
if (frontend_ctx && frontend_ctx->environment_get)
frontend_ctx->environment_get(argc, argv);
config_load();
#if defined(RARCH_CONSOLE)
void rarch_get_environment_console(void)
{
init_libretro_sym(false);
rarch_init_system_info();
@ -135,8 +122,8 @@ static void rarch_get_environment(int argc, char *argv[])
snprintf(g_extern.input_config_path, sizeof(g_extern.input_config_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name);
config_read_keybinds(g_extern.input_config_path);
#endif
#endif
}
#endif
#if defined(IOS) || defined(OSX)
void* rarch_main(void* args)
@ -155,9 +142,8 @@ int main(int argc, char *argv[])
rarch_main_clear_state();
#endif
#ifndef __APPLE__
rarch_get_environment(argc, argv);
#endif
if (frontend_ctx && frontend_ctx->environment_get)
frontend_ctx->environment_get(argc, argv);
#if !defined(RARCH_CONSOLE) && !defined(HAVE_BB10)
#if defined(__APPLE__)

View File

@ -58,6 +58,7 @@ const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suita
#ifdef RARCH_CONSOLE
extern void rarch_make_dir(const char *x, const char *name);
extern void rarch_get_environment_console(void);
#endif
#endif

View File

@ -93,6 +93,8 @@ static void environment_get(int argc, char *argv[])
strlcpy(g_extern.savestate_dir, system_directory, sizeof(g_extern.savestate_dir));
strlcpy(g_extern.savefile_dir, system_directory, sizeof(g_extern.savefile_dir));
free(system_directory);
config_load();
#endif
}

View File

@ -231,8 +231,15 @@ extern char gx_rom_path[PATH_MAX];
static void get_environment_settings(int argc, char *argv[])
{
(void)argc;
(void)argv;
#ifndef IS_SALAMANDER
g_extern.verbose = true;
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
g_extern.log_file = fopen("/retroarch-log.txt", "w");
#endif
#endif
#ifdef HW_DOL
chdir("carda:/retroarch");
@ -272,6 +279,10 @@ static void get_environment_settings(int argc, char *argv[])
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
rarch_make_dir(default_paths.sram_dir, "sram_dir");
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
config_load();
rarch_get_environment_console();
#endif
}

View File

@ -186,6 +186,16 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
static void get_environment_settings(int argc, char *argv[])
{
#ifndef IS_SALAMANDER
g_extern.verbose = true;
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
g_extern.log_file = fopen("/retroarch-log.txt", "w");
#endif
#endif
int ret;
unsigned int get_type;
unsigned int get_attributes;
@ -283,6 +293,10 @@ static void get_environment_settings(int argc, char *argv[])
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
rarch_make_dir(default_paths.sram_dir, "sram_dir");
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
config_load();
rarch_get_environment_console();
#endif
}

View File

@ -44,11 +44,14 @@ static int exit_callback(int arg1, int arg2, void *common)
static void get_environment_settings(int argc, char *argv[])
{
(void)argc;
(void)argv;
#ifndef IS_SALAMANDER
g_extern.verbose = true;
#ifdef HAVE_FILE_LOGGER
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
g_extern.log_file = fopen("ms0:/retroarch-log.txt", "w");
#endif
#endif
fill_pathname_basedir(default_paths.port_dir, argv[0], sizeof(default_paths.port_dir));
@ -74,6 +77,10 @@ static void get_environment_settings(int argc, char *argv[])
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
rarch_make_dir(default_paths.sram_dir, "sram_dir");
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
config_load();
rarch_get_environment_console();
#endif
}

View File

@ -32,6 +32,8 @@ static void get_environment_settings(int argc, char *argv[])
strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path));
strlcpy(g_settings.video.shader_dir, "app/native/shaders_glsl", sizeof(g_settings.video.shader_dir));
#endif
config_load();
}
static void system_init(void)

View File

@ -184,10 +184,18 @@ static HRESULT xbox_io_unmount(char *szDrive)
static void get_environment_settings(int argc, char *argv[])
{
HRESULT ret;
(void)argc;
(void)argv;
(void)ret;
#ifndef IS_SALAMANDER
g_extern.verbose = true;
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
g_extern.log_file = fopen("/retroarch-log.txt", "w");
#endif
#endif
#ifdef _XBOX360
// detect install environment
unsigned long license_mask;
@ -254,6 +262,10 @@ static void get_environment_settings(int argc, char *argv[])
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
rarch_make_dir(default_paths.sram_dir, "sram_dir");
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
config_load();
rarch_get_environment_console();
#endif
}