diff --git a/console/rgui/rgui.c b/console/rgui/rgui.c index f5eb8dc0a8..c1daa5fcc0 100644 --- a/console/rgui/rgui.c +++ b/console/rgui/rgui.c @@ -796,7 +796,7 @@ void rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action) const char *label = 0; rgui_list_at(rgui->folder_buf, rgui->directory_ptr, &label, &type, NULL); if (type == RGUI_SETTINGS_CORE) - label = default_paths.port_dir; + label = default_paths.core_dir; const char *dir = 0; rgui_file_type_t menu_type = 0; size_t directory_ptr = 0; diff --git a/gx/frontend/main.c b/gx/frontend/main.c index bc4858e709..22b444b277 100644 --- a/gx/frontend/main.c +++ b/gx/frontend/main.c @@ -285,19 +285,55 @@ static void menu_free(void) int rarch_main(int argc, char **argv); - static void get_environment_settings(void) { - getcwd(default_paths.port_dir, MAXPATHLEN); - snprintf(default_paths.core_dir, sizeof(default_paths.core_dir), default_paths.port_dir); - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%sretroarch.cfg", default_paths.port_dir); - snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.core_dir); - snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.core_dir); + snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/retroarch"); + getcwd(default_paths.core_dir, MAXPATHLEN); + snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir); + snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir); snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/"); snprintf(default_paths.filebrowser_startup_dir, sizeof(default_paths.filebrowser_startup_dir), default_paths.filesystem_root_dir); - snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.core_dir); - snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/presets/input", default_paths.core_dir); + snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.port_dir); + snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.port_dir); strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension)); + //RARCH_LOG("port_dir: %s\n", default_paths.port_dir); + RARCH_LOG("core_dir: %s\n", default_paths.core_dir); +} + +#define MAKE_FILE(x) {\ + if (!path_file_exists((x)))\ + {\ + RARCH_WARN("File \"%s\" does not exists, creating\n", (x));\ + FILE *f = fopen((x), "wb");\ + if (!f)\ + {\ + RARCH_ERR("Could not create file \"%s\"\n", (x));\ + }\ + fclose(f);\ + }\ +} + +#define MAKE_DIR(x) {\ + if (!path_is_directory((x)))\ + {\ + RARCH_WARN("Directory \"%s\" does not exists, creating\n", (x));\ + if (mkdir((x), 0777) != 0)\ + {\ + RARCH_ERR("Could not create directory \"%s\"\n", (x));\ + }\ + }\ +} + +static void make_directories(void) +{ + MAKE_DIR(default_paths.port_dir); + MAKE_DIR(default_paths.system_dir); + MAKE_DIR(default_paths.savestate_dir); + MAKE_DIR(default_paths.sram_dir); + MAKE_DIR(default_paths.input_presets_dir); + + MAKE_FILE(default_paths.config_file); } int main(void) @@ -307,7 +343,6 @@ int main(void) #endif fatInitDefault(); - get_environment_settings(); #ifdef HAVE_LOGGER g_extern.verbose = true; @@ -323,6 +358,8 @@ int main(void) dotab_stdout.write_r = gx_logger_file; #endif + get_environment_settings(); + make_directories(); config_set_defaults(); input_gx.init(); diff --git a/gx/gx_video.c b/gx/gx_video.c index 06bc6dacc6..01d3a877b5 100644 --- a/gx/gx_video.c +++ b/gx/gx_video.c @@ -194,7 +194,6 @@ static void gx_restart(void) static void *gx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { - RARCH_LOG("GX_INIT\n"); if (driver.video_data) return driver.video_data; @@ -212,7 +211,6 @@ static void *gx_init(const video_info_t *video, static void gx_start(void) { - RARCH_LOG("GX_START\n"); video_info_t video_info = {0}; video_info.vsync = g_settings.video.vsync;