mirror of
https://github.com/libretro/RetroArch
synced 2025-04-25 09:02:44 +00:00
Rename screenshot_generate_filename
This commit is contained in:
parent
6e0fdb269a
commit
0a0aba068d
2
file.h
2
file.h
@ -97,6 +97,8 @@ bool path_is_absolute(const char *path);
|
|||||||
// E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" => out_path = "/foo/bar/baz/boo"
|
// E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" => out_path = "/foo/bar/baz/boo"
|
||||||
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size);
|
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size);
|
||||||
|
|
||||||
|
void fill_dated_filename(char *out_filename, size_t size);
|
||||||
|
|
||||||
// Appends a filename extension 'replace' to 'in_path', and outputs result in 'out_path'.
|
// Appends a filename extension 'replace' to 'in_path', and outputs result in 'out_path'.
|
||||||
// Assumes in_path has no extension. If an extension is still present in 'in_path', it will be ignored.
|
// Assumes in_path has no extension. If an extension is still present in 'in_path', it will be ignored.
|
||||||
// 'size' is buffer size of 'out_path'.
|
// 'size' is buffer size of 'out_path'.
|
||||||
|
14
file_path.c
14
file_path.c
@ -460,6 +460,20 @@ void fill_pathname_parent_dir(char *out_dir, const char *in_dir, size_t size)
|
|||||||
path_parent_dir(out_dir);
|
path_parent_dir(out_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fill_dated_filename(char *out_filename, size_t size)
|
||||||
|
{
|
||||||
|
time_t cur_time;
|
||||||
|
time(&cur_time);
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB_DEFLATE
|
||||||
|
#define IMG_EXT "png"
|
||||||
|
#else
|
||||||
|
#define IMG_EXT "bmp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
strftime(out_filename, size, "RetroArch-%m%d-%H%M%S." IMG_EXT, localtime(&cur_time));
|
||||||
|
}
|
||||||
|
|
||||||
void path_basedir(char *path)
|
void path_basedir(char *path)
|
||||||
{
|
{
|
||||||
if (strlen(path) < 2)
|
if (strlen(path) < 2)
|
||||||
|
@ -252,7 +252,7 @@ static void gfx_ctx_xdk_menu_screenshot_dump(void *data)
|
|||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
char shotname[PATH_MAX];
|
char shotname[PATH_MAX];
|
||||||
|
|
||||||
screenshot_generate_filename(shotname, sizeof(shotname));
|
fill_dated_filename(shotname, sizeof(shotname));
|
||||||
snprintf(filename, sizeof(filename), "%s\\%s", default_paths.screenshots_dir, shotname);
|
snprintf(filename, sizeof(filename), "%s\\%s", default_paths.screenshots_dir, shotname);
|
||||||
|
|
||||||
#if defined(_XBOX1)
|
#if defined(_XBOX1)
|
||||||
|
16
screenshot.c
16
screenshot.c
@ -144,20 +144,6 @@ end:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void screenshot_generate_filename(char *filename, size_t size)
|
|
||||||
{
|
|
||||||
time_t cur_time;
|
|
||||||
time(&cur_time);
|
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_DEFLATE
|
|
||||||
#define IMG_EXT "png"
|
|
||||||
#else
|
|
||||||
#define IMG_EXT "bmp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
strftime(filename, size, "RetroArch-%m%d-%H%M%S." IMG_EXT, localtime(&cur_time));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take frame bottom-up.
|
// Take frame bottom-up.
|
||||||
bool screenshot_dump(const char *folder, const void *frame,
|
bool screenshot_dump(const char *folder, const void *frame,
|
||||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||||
@ -165,7 +151,7 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
char shotname[PATH_MAX];
|
char shotname[PATH_MAX];
|
||||||
|
|
||||||
screenshot_generate_filename(shotname, sizeof(shotname));
|
fill_dated_filename(shotname, sizeof(shotname));
|
||||||
fill_pathname_join(filename, folder, shotname, sizeof(filename));
|
fill_pathname_join(filename, folder, shotname, sizeof(filename));
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_DEFLATE
|
#ifdef HAVE_ZLIB_DEFLATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user