Rename default_paths to g_defaults

This commit is contained in:
twinaphex 2014-06-12 18:06:29 +02:00
parent 0b076883d6
commit 97a262dd60
10 changed files with 111 additions and 108 deletions

View File

@ -313,30 +313,28 @@ returntype main_entry(signature())
if (driver.frontend_ctx && driver.frontend_ctx->environment_get)
{
driver.frontend_ctx->environment_get(rarch_argc_ptr, rarch_argv_ptr, args, wrap_args);
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
if (*default_paths.autoconfig_dir)
path_mkdir(default_paths.autoconfig_dir);
if (*default_paths.audio_filter_dir)
path_mkdir(default_paths.audio_filter_dir);
if (*default_paths.assets_dir)
path_mkdir(default_paths.assets_dir);
if (*default_paths.core_dir)
path_mkdir(default_paths.core_dir);
if (*default_paths.core_info_dir)
path_mkdir(default_paths.core_info_dir);
if (*default_paths.overlay_dir)
path_mkdir(default_paths.overlay_dir);
if (*default_paths.port_dir)
path_mkdir(default_paths.port_dir);
if (*default_paths.shader_dir)
path_mkdir(default_paths.shader_dir);
if (*default_paths.savestate_dir)
path_mkdir(default_paths.savestate_dir);
if (*default_paths.sram_dir)
path_mkdir(default_paths.sram_dir);
if (*default_paths.system_dir)
path_mkdir(default_paths.system_dir);
#endif
if (*g_defaults.autoconfig_dir)
path_mkdir(g_defaults.autoconfig_dir);
if (*g_defaults.audio_filter_dir)
path_mkdir(g_defaults.audio_filter_dir);
if (*g_defaults.assets_dir)
path_mkdir(g_defaults.assets_dir);
if (*g_defaults.core_dir)
path_mkdir(g_defaults.core_dir);
if (*g_defaults.core_info_dir)
path_mkdir(g_defaults.core_info_dir);
if (*g_defaults.overlay_dir)
path_mkdir(g_defaults.overlay_dir);
if (*g_defaults.port_dir)
path_mkdir(g_defaults.port_dir);
if (*g_defaults.shader_dir)
path_mkdir(g_defaults.shader_dir);
if (*g_defaults.savestate_dir)
path_mkdir(g_defaults.savestate_dir);
if (*g_defaults.sram_dir)
path_mkdir(g_defaults.sram_dir);
if (*g_defaults.system_dir)
path_mkdir(g_defaults.system_dir);
if (wrap_args->touched)
{

View File

@ -25,7 +25,7 @@
#include "../file_ext.h"
#include "frontend_context.h"
struct defaults default_paths;
struct defaults g_defaults;
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
@ -84,11 +84,11 @@ static void find_and_set_first_file(char *path, size_t sizeof_path, const char *
char first_file[PATH_MAX] = {0};
find_first_libretro_core(first_file, sizeof(first_file),
default_paths.core_dir, ext);
g_defaults.core_dir, ext);
if (first_file)
{
fill_pathname_join(path, default_paths.core_dir, first_file, sizeof_path);
fill_pathname_join(path, g_defaults.core_dir, first_file, sizeof_path);
RARCH_LOG("libretro_path now set to: %s.\n", path);
}
else
@ -100,13 +100,13 @@ static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
//normal executable loading path
bool config_file_exists = false;
if (path_file_exists(default_paths.config_path))
if (path_file_exists(g_defaults.config_path))
config_file_exists = true;
if (config_file_exists)
{
char tmp_str[PATH_MAX];
config_file_t * conf = (config_file_t*)config_file_new(default_paths.config_path);
config_file_t * conf = (config_file_t*)config_file_new(g_defaults.config_path);
if (conf)
{
@ -132,7 +132,7 @@ static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
if (conf)
{
config_set_string(conf, "libretro_path", libretro_path);
config_file_write(conf, default_paths.config_path);
config_file_write(conf, g_defaults.config_path);
config_file_free(conf);
}
}

View File

@ -2438,7 +2438,7 @@ static int menu_common_iterate(unsigned action)
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)path);
#if defined(GEKKO) && defined(HW_RVL)
fill_pathname_join(g_extern.fullpath, default_paths.core_dir,
fill_pathname_join(g_extern.fullpath, g_defaults.core_dir,
SALAMANDER_FILE, sizeof(g_extern.fullpath));
#else
fill_pathname_join(g_settings.libretro, dir, path, sizeof(g_settings.libretro));
@ -3725,7 +3725,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
if (action == MENU_ACTION_OK)
{
#if defined(GEKKO) && defined(HW_RVL)
fill_pathname_join(g_extern.fullpath, default_paths.core_dir, SALAMANDER_FILE,
fill_pathname_join(g_extern.fullpath, g_defaults.core_dir, SALAMANDER_FILE,
sizeof(g_extern.fullpath));
#endif
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);

View File

@ -550,7 +550,7 @@ static void process_pending_intent(void *data)
if (android_app->getPendingIntentConfigPath && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
strlcpy(default_paths.config_path, argv, sizeof(default_paths.config_path));
strlcpy(g_defaults.config_path, argv, sizeof(g_defaults.config_path));
(*env)->ReleaseStringUTFChars(env, jstr, argv);
RARCH_LOG("Config file: [%s].\n", g_extern.config_path);
@ -574,11 +574,11 @@ static void process_pending_intent(void *data)
if (android_app->getPendingIntentLibretroPath && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
strlcpy(default_paths.core_path, argv, sizeof(default_paths.core_path));
strlcpy(g_defaults.core_path, argv, sizeof(g_defaults.core_path));
(*env)->ReleaseStringUTFChars(env, jstr, argv);
}
RARCH_LOG("Libretro path: [%s].\n", default_paths.core_path);
RARCH_LOG("Libretro path: [%s].\n", g_defaults.core_path);
if (startgame)
{

View File

@ -175,20 +175,20 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
#ifdef HW_DOL
chdir("carda:/retroarch");
#endif
getcwd(default_paths.core_dir, MAXPATHLEN);
char *last_slash = strrchr(default_paths.core_dir, '/');
getcwd(g_defaults.core_dir, MAXPATHLEN);
char *last_slash = strrchr(g_defaults.core_dir, '/');
if (last_slash)
*last_slash = 0;
char *device_end = strchr(default_paths.core_dir, '/');
char *device_end = strchr(g_defaults.core_dir, '/');
if (device_end)
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir);
snprintf(g_defaults.port_dir, sizeof(g_defaults.port_dir), "%.*s/retroarch", device_end - g_defaults.core_dir, g_defaults.core_dir);
else
fill_pathname_join(default_paths.port_dir, default_paths.port_dir, "retroarch", sizeof(default_paths.port_dir));
fill_pathname_join(default_paths.overlay_dir, default_paths.core_dir, "overlays", sizeof(default_paths.overlay_dir));
fill_pathname_join(default_paths.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(default_paths.config_path));
fill_pathname_join(default_paths.system_dir, default_paths.port_dir, "system", sizeof(default_paths.system_dir));
fill_pathname_join(default_paths.sram_dir, default_paths.port_dir, "savefiles", sizeof(default_paths.sram_dir));
fill_pathname_join(default_paths.savestate_dir, default_paths.port_dir, "savefiles", sizeof(default_paths.savestate_dir));
fill_pathname_join(g_defaults.port_dir, g_defaults.port_dir, "retroarch", sizeof(g_defaults.port_dir));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.system_dir, g_defaults.port_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.port_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.port_dir, "savefiles", sizeof(g_defaults.savestate_dir));
#ifdef IS_SALAMANDER
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
@ -295,7 +295,7 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
// FIXME/TODO - hack
// direct loading failed (out of memory), try to jump to salamander then load the correct core
fill_pathname_join(core_path, default_paths.core_dir, "boot.dol", sizeof_core_path);
fill_pathname_join(core_path, g_defaults.core_dir, "boot.dol", sizeof_core_path);
#endif
frontend_gx_exec(core_path, should_load_game);
}

View File

@ -175,13 +175,13 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
ret = cellGameContentPermit(contentInfoPath, default_paths.port_dir);
ret = cellGameContentPermit(contentInfoPath, g_defaults.port_dir);
#ifdef HAVE_MULTIMAN
if (g_extern.lifecycle_state & (1ULL << MODE_EXTLAUNCH_MULTIMAN))
{
fill_pathname_join(contentInfoPath, "/dev_hdd0/game/", EMULATOR_CONTENT_DIR, sizeof(contentInfoPath));
fill_pathname_join(default_paths.port_dir, contentInfoPath, "USRDIR", sizeof(default_paths.port_dir));
fill_pathname_join(g_defaults.port_dir, contentInfoPath, "USRDIR", sizeof(g_defaults.port_dir));
}
#endif
@ -191,21 +191,21 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
{
RARCH_LOG("cellGameContentPermit() OK.\n");
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
RARCH_LOG("usrDirPath : [%s].\n", g_defaults.port_dir);
}
fill_pathname_join(default_paths.core_dir, default_paths.port_dir, "cores", sizeof(default_paths.core_dir));
fill_pathname_join(default_paths.core_info_dir, default_paths.port_dir, "cores", sizeof(default_paths.core_info_dir));
fill_pathname_join(default_paths.savestate_dir, default_paths.core_dir, "savestates", sizeof(default_paths.savestate_dir));
fill_pathname_join(default_paths.sram_dir, default_paths.core_dir, "savefiles", sizeof(default_paths.sram_dir));
fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir));
fill_pathname_join(default_paths.shader_dir, default_paths.core_dir, "shaders", sizeof(default_paths.shader_dir));
fill_pathname_join(default_paths.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(default_paths.config_path));
fill_pathname_join(default_paths.overlay_dir, default_paths.core_dir, "overlays", sizeof(default_paths.overlay_dir));
fill_pathname_join(default_paths.assets_dir, default_paths.core_dir, "media", sizeof(default_paths.assets_dir));
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.shader_dir, g_defaults.core_dir, "shaders", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.assets_dir, g_defaults.core_dir, "media", sizeof(g_defaults.assets_dir));
#ifndef IS_SALAMANDER
#ifdef HAVE_RMENU
fill_pathname_join(g_extern.menu_texture_path, default_paths.core_dir, "borders/Menu/main-menu_1080p.png",
fill_pathname_join(g_extern.menu_texture_path, g_defaults.core_dir, "borders/Menu/main-menu_1080p.png",
sizeof(g_extern.menu_texture_path));
#endif
#endif

View File

@ -58,16 +58,16 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
strlcpy(eboot_path, argv[0], sizeof(eboot_path));
fill_pathname_basedir(default_paths.port_dir, argv[0], sizeof(default_paths.port_dir));
RARCH_LOG("port dir: [%s]\n", default_paths.port_dir);
fill_pathname_basedir(g_defaults.port_dir, argv[0], sizeof(g_defaults.port_dir));
RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir);
fill_pathname_join(default_paths.assets_dir, default_paths.port_dir, "media", sizeof(default_paths.assets_dir));
fill_pathname_join(default_paths.core_dir, default_paths.port_dir, "cores", sizeof(default_paths.core_dir));
fill_pathname_join(default_paths.core_info_dir, default_paths.port_dir, "cores", sizeof(default_paths.core_info_dir));
fill_pathname_join(default_paths.savestate_dir, default_paths.core_dir, "savestates", sizeof(default_paths.savestate_dir));
fill_pathname_join(default_paths.sram_dir, default_paths.core_dir, "savefiles", sizeof(default_paths.sram_dir));
fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir));
fill_pathname_join(default_paths.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(default_paths.config_path));
fill_pathname_join(g_defaults.assets_dir, g_defaults.port_dir, "media", sizeof(g_defaults.assets_dir));
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
if (argv[1] && (argv[1][0] != '\0'))
{

View File

@ -135,24 +135,24 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
#endif
#if defined(_XBOX1)
strlcpy(default_paths.core_dir, "D:", sizeof(default_paths.core_dir));
strlcpy(default_paths.core_info_dir, "D:", sizeof(default_paths.core_info_dir));
fill_pathname_join(default_paths.config_path, default_paths.core_dir, "retroarch.cfg", sizeof(default_paths.config_path));
fill_pathname_join(default_paths.savestate_dir, default_paths.core_dir, "savestates", sizeof(default_paths.savestate_dir));
fill_pathname_join(default_paths.sram_dir, default_paths.core_dir, "savefiles", sizeof(default_paths.sram_dir));
fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir));
fill_pathname_join(default_paths.screenshot_dir, default_paths.core_dir, "screenshots", sizeof(default_paths.screenshot_dir));
strlcpy(g_defaults.core_dir, "D:", sizeof(g_defaults.core_dir));
strlcpy(g_defaults.core_info_dir, "D:", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.core_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.screenshot_dir, g_defaults.core_dir, "screenshots", sizeof(g_defaults.screenshot_dir));
#ifndef IS_SALAMANDER
strlcpy(g_extern.menu_texture_path, "D:\\Media\\main-menu_480p.png", sizeof(g_extern.menu_texture_path));
#endif
#elif defined(_XBOX360)
strlcpy(default_paths.core_dir, "game:", sizeof(default_paths.core_dir));
strlcpy(default_paths.core_info_dir, "game:", sizeof(default_paths.core_info_dir));
strlcpy(default_paths.config_path, "game:\\retroarch.cfg", sizeof(default_paths.config_path));
strlcpy(default_paths.screenshot_dir, "game:", sizeof(default_paths.screenshot_dir));
strlcpy(default_paths.savestate_dir, "game:\\savestates", sizeof(default_paths.savestate_dir));
strlcpy(default_paths.sram_dir, "game:\\savefiles", sizeof(default_paths.sram_dir));
strlcpy(default_paths.system_dir, "game:\\system", sizeof(default_paths.system_dir));
strlcpy(g_defaults.core_dir, "game:", sizeof(g_defaults.core_dir));
strlcpy(g_defaults.core_info_dir, "game:", sizeof(g_defaults.core_info_dir));
strlcpy(g_defaults.config_path, "game:\\retroarch.cfg", sizeof(g_defaults.config_path));
strlcpy(g_defaults.screenshot_dir, "game:", sizeof(g_defaults.screenshot_dir));
strlcpy(g_defaults.savestate_dir, "game:\\savestates", sizeof(g_defaults.savestate_dir));
strlcpy(g_defaults.sram_dir, "game:\\savefiles", sizeof(g_defaults.sram_dir));
strlcpy(g_defaults.system_dir, "game:\\system", sizeof(g_defaults.system_dir));
#endif
#ifndef IS_SALAMANDER

View File

@ -138,6 +138,11 @@ struct defaults
char sram_dir[PATH_MAX];
char screenshot_dir[PATH_MAX];
char system_dir[PATH_MAX];
struct
{
int out_latency;
} settings;
};
// All config related settings go here.
@ -709,7 +714,7 @@ struct rarch_main_wrap
// Public data structures
extern struct settings g_settings;
extern struct global g_extern;
extern struct defaults default_paths;
extern struct defaults g_defaults;
/////////
// Public functions

View File

@ -31,7 +31,7 @@
struct settings g_settings;
struct global g_extern;
struct defaults default_paths;
struct defaults g_defaults;
const char *config_get_default_audio(void)
{
@ -470,33 +470,33 @@ void config_set_defaults(void)
if (default_config_path)
fill_pathname_expand_special(g_extern.config_path, default_config_path, sizeof(g_extern.config_path));
if (*default_paths.audio_filter_dir)
strlcpy(g_settings.audio.filter_dir, default_paths.audio_filter_dir, sizeof(g_settings.audio.filter_dir));
if (*default_paths.assets_dir)
strlcpy(g_settings.assets_directory, default_paths.assets_dir, sizeof(g_settings.assets_directory));
if (*default_paths.core_dir)
strlcpy(g_settings.libretro_directory, default_paths.core_dir, sizeof(g_settings.libretro_directory));
if (*default_paths.core_path)
strlcpy(g_settings.libretro, default_paths.core_path, sizeof(g_settings.libretro));
if (*default_paths.core_info_dir)
strlcpy(g_settings.libretro_info_path, default_paths.core_info_dir, sizeof(g_settings.libretro_info_path));
if (*g_defaults.audio_filter_dir)
strlcpy(g_settings.audio.filter_dir, g_defaults.audio_filter_dir, sizeof(g_settings.audio.filter_dir));
if (*g_defaults.assets_dir)
strlcpy(g_settings.assets_directory, g_defaults.assets_dir, sizeof(g_settings.assets_directory));
if (*g_defaults.core_dir)
strlcpy(g_settings.libretro_directory, g_defaults.core_dir, sizeof(g_settings.libretro_directory));
if (*g_defaults.core_path)
strlcpy(g_settings.libretro, g_defaults.core_path, sizeof(g_settings.libretro));
if (*g_defaults.core_info_dir)
strlcpy(g_settings.libretro_info_path, g_defaults.core_info_dir, sizeof(g_settings.libretro_info_path));
#ifdef HAVE_OVERLAY
if (*default_paths.overlay_dir)
strlcpy(g_extern.overlay_dir, default_paths.overlay_dir, sizeof(g_extern.overlay_dir));
if (*g_defaults.overlay_dir)
strlcpy(g_extern.overlay_dir, g_defaults.overlay_dir, sizeof(g_extern.overlay_dir));
#endif
if (*default_paths.shader_dir)
strlcpy(g_settings.video.shader_dir, default_paths.shader_dir, sizeof(g_settings.video.shader_dir));
if (*default_paths.savestate_dir)
strlcpy(g_extern.savestate_dir, default_paths.savestate_dir, sizeof(g_extern.savestate_dir));
if (*default_paths.sram_dir)
strlcpy(g_extern.savefile_dir, default_paths.sram_dir, sizeof(g_extern.savefile_dir));
if (*default_paths.system_dir)
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
if (*default_paths.screenshot_dir)
strlcpy(g_settings.screenshot_directory, default_paths.screenshot_dir, sizeof(g_settings.screenshot_directory));
if (*g_defaults.shader_dir)
strlcpy(g_settings.video.shader_dir, g_defaults.shader_dir, sizeof(g_settings.video.shader_dir));
if (*g_defaults.savestate_dir)
strlcpy(g_extern.savestate_dir, g_defaults.savestate_dir, sizeof(g_extern.savestate_dir));
if (*g_defaults.sram_dir)
strlcpy(g_extern.savefile_dir, g_defaults.sram_dir, sizeof(g_extern.savefile_dir));
if (*g_defaults.system_dir)
strlcpy(g_settings.system_directory, g_defaults.system_dir, sizeof(g_settings.system_directory));
if (*g_defaults.screenshot_dir)
strlcpy(g_settings.screenshot_directory, g_defaults.screenshot_dir, sizeof(g_settings.screenshot_directory));
if (*default_paths.config_path)
strlcpy(g_extern.config_path, default_paths.config_path, sizeof(g_extern.config_path));
if (*g_defaults.config_path)
strlcpy(g_extern.config_path, g_defaults.config_path, sizeof(g_extern.config_path));
g_extern.config_save_on_exit = config_save_on_exit;