Fix in the screenshot-related function in video.c, makes sure 'screenshots\<file>' is always inside the PCem directory.

This commit is contained in:
OBattler
2016-07-11 07:15:24 +02:00
parent e34f587905
commit e98de64d33

View File

@ -3,6 +3,7 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include "ibm.h" #include "ibm.h"
#include "config.h"
#include "device.h" #include "device.h"
#include "mem.h" #include "mem.h"
#include "video.h" #include "video.h"
@ -460,7 +461,8 @@ void take_screenshot()
#else #else
time_t now; time_t now;
struct tm *info; struct tm *info;
char screenshot_fn[1024]; char screenshot_fn_partial[1024];
char screenshot_fn[2048];
void take_screenshot() void take_screenshot()
{ {
@ -468,10 +470,12 @@ void take_screenshot()
time(&now); time(&now);
info = localtime(&now); info = localtime(&now);
memset(screenshot_fn, 0, 1024); memset(screenshot_fn, 0, 1024);
memset(screenshot_fn_partial, 0, 2048);
pclog("Video API is: %i\n", vid_api); pclog("Video API is: %i\n", vid_api);
if (vid_api == 1) if (vid_api == 1)
{ {
strftime(screenshot_fn, 1024, "screenshots\\%Y%m%d_%H%M%S.png", info); strftime(screenshot_fn_partial, 1024, "screenshots\\%Y%m%d_%H%M%S.png", info);
append_filename(screenshot_fn, pcempath, screenshot_fn_partial, 2047);
if (video_fullscreen) if (video_fullscreen)
{ {
d3d_fs_take_screenshot(screenshot_fn); d3d_fs_take_screenshot(screenshot_fn);
@ -484,7 +488,8 @@ void take_screenshot()
} }
else if (vid_api == 0) else if (vid_api == 0)
{ {
strftime(screenshot_fn, 1024, "screenshots\\%Y%m%d_%H%M%S.bmp", info); strftime(screenshot_fn_partial, 1024, "screenshots\\%Y%m%d_%H%M%S.bmp", info);
append_filename(screenshot_fn, pcempath, screenshot_fn_partial, 2047);
if (video_fullscreen) if (video_fullscreen)
{ {
ddraw_fs_take_screenshot(screenshot_fn); ddraw_fs_take_screenshot(screenshot_fn);