Merge pull request #3407 from meleu/screenshot_with_gamename

Screenshot with gamename
This commit is contained in:
Alcaro 2016-08-19 22:08:34 +02:00 committed by GitHub
commit e559085540
3 changed files with 45 additions and 5 deletions

View File

@ -415,14 +415,38 @@ void fill_pathname_parent_dir(char *out_dir,
void fill_dated_filename(char *out_filename,
const char *ext, size_t size)
{
time_t cur_time;
time(&cur_time);
time_t cur_time = time(NULL);
strftime(out_filename, size,
"RetroArch-%m%d-%H%M%S.", localtime(&cur_time));
strlcat(out_filename, ext, size);
}
/**
* fill_str_dated_filename:
* @out_filename : output filename
* @in_str : input string
* @ext : extension of output filename
* @size : buffer size of output filename
*
* Creates a 'dated' filename prefixed by the string @in_str, and
* concatenates extension (@ext) to it.
*
* E.g.:
* out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
**/
void fill_str_dated_filename(char *out_filename,
const char *in_str, const char *ext, size_t size)
{
char format[256] = {0};
time_t cur_time = time(NULL);
strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", localtime(&cur_time));
strlcpy(out_filename, in_str, size);
strlcat(out_filename, format, size);
strlcat(out_filename, ext, size);
}
/**
* path_basedir:
* @path : path

View File

@ -194,6 +194,22 @@ void fill_pathname(char *out_path, const char *in_path,
void fill_dated_filename(char *out_filename,
const char *ext, size_t size);
/**
* fill_str_dated_filename:
* @out_filename : output filename
* @in_str : input string
* @ext : extension of output filename
* @size : buffer size of output filename
*
* Creates a 'dated' filename prefixed by the string @in_str, and
* concatenates extension (@ext) to it.
*
* E.g.:
* out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
**/
void fill_str_dated_filename(char *out_filename,
const char *in_str, const char *ext, size_t size);
/**
* fill_pathname_noext:
* @out_path : output path

View File

@ -78,14 +78,14 @@ static bool screenshot_dump(
if (settings->auto_screenshot_filename)
{
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
fill_pathname_join(filename, folder, shotname, sizeof(filename));
fill_str_dated_filename(shotname, path_basename(global_name_base),
IMG_EXT, sizeof(shotname));
}
else
{
snprintf(shotname, sizeof(shotname),"%s.png", path_basename(global_name_base));
fill_pathname_join(filename, folder, shotname, sizeof(filename));
}
fill_pathname_join(filename, folder, shotname, sizeof(filename));
#ifdef _XBOX1
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(true);