set SAVE directory correctly when using content dir on cores that don't use the SRAM interface

This commit is contained in:
radius 2016-03-10 17:36:46 -05:00
parent 82084205d8
commit 761ece0f3c
5 changed files with 50 additions and 24 deletions

View file

@ -581,6 +581,9 @@ static const bool post_filter_record = false;
/* Screenshots post-shaded GPU output if available. */
static const bool gpu_screenshot = true;
/* Screenshots named automatically. */
static const bool auto_screenshot_filename = true;
/* Record post-shaded GPU output instead of raw game footage if available. */
static const bool gpu_record = false;

View file

@ -553,6 +553,7 @@ static void config_set_defaults(void)
settings->video.post_filter_record = post_filter_record;
settings->video.gpu_record = gpu_record;
settings->video.gpu_screenshot = gpu_screenshot;
settings->auto_screenshot_filename = auto_screenshot_filename;
settings->video.rotation = ORIENTATION_NORMAL;
settings->audio.enable = audio_enable;
@ -905,7 +906,7 @@ static void config_set_defaults(void)
rarch_ctl(RARCH_CTL_SET_BLOCK_CONFIG_READ, NULL);
else
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
first_initialized = false;
}
@ -1569,6 +1570,7 @@ static bool config_load_file(const char *path, bool set_defaults)
*settings->screenshot_directory = '\0';
}
}
CONFIG_GET_BOOL_BASE(conf, settings, auto_screenshot_filename, "auto_screenshot_filename");
config_get_path(conf, "resampler_directory", settings->resampler_directory,
sizeof(settings->resampler_directory));
@ -1722,7 +1724,7 @@ static bool config_load_file(const char *path, bool set_defaults)
config_get_bool(conf, tmp, &settings->network_remote_enable_user[i]);
}
CONFIG_GET_INT_BASE(conf, settings, network_remote_base_port, "network_remote_base_port");
#endif
CONFIG_GET_BOOL_BASE(conf, settings, debug_panel_enable, "debug_panel_enable");
@ -1944,7 +1946,7 @@ bool config_load_override(void)
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (system)
@ -2121,7 +2123,7 @@ bool config_load_remap(void)
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (system)
@ -2648,6 +2650,8 @@ bool config_save_file(const char *path)
config_set_path(conf, "screenshot_directory",
*settings->screenshot_directory ?
settings->screenshot_directory : "default");
config_set_bool(conf, "auto_screenshot_filename",
settings->auto_screenshot_filename);
config_set_int(conf, "aspect_ratio_index", settings->video.aspect_ratio_idx);
config_set_string(conf, "audio_device", settings->audio.device);
config_set_string(conf, "video_filter", settings->video.softfilter_plugin);

View file

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
@ -336,6 +336,8 @@ typedef struct settings
char screenshot_directory[PATH_MAX_LENGTH];
char system_directory[PATH_MAX_LENGTH];
bool auto_screenshot_filename;
char cache_directory[PATH_MAX_LENGTH];
char playlist_directory[PATH_MAX_LENGTH];

View file

@ -386,11 +386,18 @@ static void set_special_paths(char **argv, unsigned num_content)
const char *rarch_get_current_savefile_dir(void)
{
global_t *global = global_get_ptr();
char* ret = strdup(global->name.base);
if (!string_is_empty(current_savefile_dir))
ret = current_savefile_dir;
else
path_basedir(ret);
RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n",
current_savefile_dir);
if (*current_savefile_dir)
return current_savefile_dir;
return NULL;
ret);
return ret;
}
static void set_paths_redirect(const char *path)
@ -401,7 +408,7 @@ static void set_paths_redirect(const char *path)
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (!global)
{
@ -410,10 +417,10 @@ static void set_paths_redirect(const char *path)
}
if (info->info.library_name &&
!string_is_empty(info->info.library_name))
global_library_name_hash =
global_library_name_hash =
msg_hash_calculate(info->info.library_name);
/* Initialize current save directories
/* Initialize current save directories
* with the values from the config. */
strlcpy(current_savefile_dir,
global->dir.savefile,
@ -431,7 +438,7 @@ static void set_paths_redirect(const char *path)
if (check_global_library_name_hash)
{
/* per-core saves: append the library_name to the save location */
if (settings->sort_savefiles_enable
if (settings->sort_savefiles_enable
&& !string_is_empty(global->dir.savefile))
{
fill_pathname_join(
@ -442,7 +449,7 @@ static void set_paths_redirect(const char *path)
/* If path doesn't exist, try to create it,
* if everything fails revert to the original path. */
if(!path_is_directory(current_savefile_dir)
if(!path_is_directory(current_savefile_dir)
&& !string_is_empty(current_savefile_dir))
{
path_mkdir(current_savefile_dir);
@ -459,7 +466,7 @@ static void set_paths_redirect(const char *path)
}
/* per-core states: append the library_name to the save location */
if (settings->sort_savestates_enable
if (settings->sort_savestates_enable
&& !string_is_empty(global->dir.savestate))
{
fill_pathname_join(
@ -470,7 +477,7 @@ static void set_paths_redirect(const char *path)
/* If path doesn't exist, try to create it.
* If everything fails, revert to the original path. */
if(!path_is_directory(current_savestate_dir) &&
if(!path_is_directory(current_savestate_dir) &&
!string_is_empty(current_savestate_dir))
{
path_mkdir(current_savestate_dir);
@ -682,7 +689,7 @@ static void parse_input(int argc, char *argv[])
/* Make sure we can call parse_input several times ... */
optind = 0;
optstring = "hs:fvS:A:c:U:DN:d:"
optstring = "hs:fvS:A:c:U:DN:d:"
BSV_MOVIE_ARG NETPLAY_ARG DYNAMIC_ARG FFMPEG_RECORD_ARG;
for (;;)
@ -1018,7 +1025,7 @@ static void rarch_init_savefile_paths(void)
{
global_t *global = global_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
event_cmd_ctl(EVENT_CMD_SAVEFILES_DEINIT, NULL);
@ -1418,7 +1425,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
}
break;
case RARCH_CTL_SET_SRAM_ENABLE:
global->sram.use = rarch_ctl(RARCH_CTL_IS_PLAIN_CORE, NULL)
global->sram.use = rarch_ctl(RARCH_CTL_IS_PLAIN_CORE, NULL)
&& !content_ctl(CONTENT_CTL_DOES_NOT_NEED_CONTENT, NULL);
break;
case RARCH_CTL_SET_ERROR_ON_INIT:
@ -1635,7 +1642,7 @@ int rarch_info_get_capabilities(enum rarch_capabilities type,
void retro_fail(int error_code, const char *error)
{
/* We cannot longjmp unless we're in rarch_main_init().
* If not, something went very wrong, and we should
* If not, something went very wrong, and we should
* just exit right away. */
retro_assert(rarch_ctl(RARCH_CTL_IS_ERROR_ON_INIT, NULL));

View file

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
@ -54,6 +54,8 @@
static bool screenshot_dump(const char *folder, const void *frame,
unsigned width, unsigned height, int pitch, bool bgr24)
{
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
bool ret;
char filename[PATH_MAX_LENGTH];
char shotname[256];
@ -62,8 +64,16 @@ static bool screenshot_dump(const char *folder, const void *frame,
struct scaler_ctx scaler = {0};
#endif
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
fill_pathname_join(filename, folder, shotname, sizeof(filename));
if (settings->auto_screenshot_filename)
{
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
fill_pathname_join(filename, folder, shotname, sizeof(filename));
}
else
{
snprintf(shotname, sizeof(shotname),"%s.png", path_basename(global->name.base));
fill_pathname_join(filename, folder, shotname, sizeof(filename));
}
#ifdef _XBOX1
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(true);
@ -172,7 +182,7 @@ static bool take_screenshot_raw(void)
settings_t *settings = config_get_ptr();
video_driver_cached_frame_get(&data, &width, &height, &pitch);
screenshot_dir = settings->screenshot_directory;
if (!*settings->screenshot_directory)