From e98de64d33680b29d9ea2b25d97bd0c18b25eede Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 11 Jul 2016 07:15:24 +0200 Subject: [PATCH] Fix in the screenshot-related function in video.c, makes sure 'screenshots\' is always inside the PCem directory. --- src/video.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/video.c b/src/video.c index bd315323c..c418a1ab0 100644 --- a/src/video.c +++ b/src/video.c @@ -3,6 +3,7 @@ #include #include #include "ibm.h" +#include "config.h" #include "device.h" #include "mem.h" #include "video.h" @@ -460,7 +461,8 @@ void take_screenshot() #else time_t now; struct tm *info; -char screenshot_fn[1024]; +char screenshot_fn_partial[1024]; +char screenshot_fn[2048]; void take_screenshot() { @@ -468,10 +470,12 @@ void take_screenshot() time(&now); info = localtime(&now); memset(screenshot_fn, 0, 1024); + memset(screenshot_fn_partial, 0, 2048); pclog("Video API is: %i\n", vid_api); 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) { d3d_fs_take_screenshot(screenshot_fn); @@ -484,7 +488,8 @@ void take_screenshot() } 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) { ddraw_fs_take_screenshot(screenshot_fn);