[Scummvm-git-logs] scummvm master -> a9ae691513f20018cc3798929dc6161828adfc7f

criezy criezy at scummvm.org
Mon Apr 24 02:10:30 CEST 2017


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3849a3e90e WINDOWS: Change location where screenshot are saved
438f23f272 SDL: Use dynamic cast instead of C cast to get screenshot path
11dd33bb73 MACOSX: Create screenshot on Desktop
e96c057c3d SDL: Allow specifying the screenshot directory in the config file
a9ae691513 SDL: Improve debug and warning messages when saving screenshots


Commit: 3849a3e90e6e679e35f8ec4517ce38d2a0c5d098
    https://github.com/scummvm/scummvm/commit/3849a3e90e6e679e35f8ec4517ce38d2a0c5d098
Author: Pala (pala at sch.bme.hu)
Date: 2017-04-24T01:06:29+01:00

Commit Message:
WINDOWS: Change location where screenshot are saved

This fixes bug #9701: WINDOWS: Flow of taking screenshots
on Windows is broken

Changed paths:
    .gitignore
    README
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/sdl.h
    backends/platform/sdl/win32/win32.cpp
    backends/platform/sdl/win32/win32.h


diff --git a/.gitignore b/.gitignore
index 585d575..1c2edd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -216,3 +216,4 @@ psp2pkg/
 
 #Ignore gmon.out created by gprof
 gmon.out
+/scummvm_libs_2015
diff --git a/README b/README
index f290dd2..828591b 100644
--- a/README
+++ b/README
@@ -81,8 +81,9 @@ Table of Contents:
 8.0) Configuration file
  * 8.1 Recognized configuration keywords
  * 8.2 Custom game options that can be toggled via the GUI
-9.0) Compiling
-10.0) Credits
+9.0) Screenshots (SDL backend only)
+10.0) Compiling
+11.0) Credits
 
 
 1.0) Introduction:
@@ -2678,7 +2679,13 @@ once or readded in the ScummVM launcher's game list. This will update the
 configuration of each entry, allowing the custom options to be shown.
 
 
-9.0) Compiling:
+9.0) Screenshots (SDL backend only):
+---- -------------------------------
+By default screenshots are put into the current directory, however on Windows
+the directory for this purpose is set to "Users\username\My Pictures\ScummVM Screenshots".
+
+
+10.0) Compiling:
 ---- ----------
 For an up-to-date overview on how to compile ScummVM for various
 platforms, please consult our Wiki, in particular this page:
@@ -2787,7 +2794,7 @@ debug messages (see <https://technet.microsoft.com/en-us/sysinternals/debugview.
       <http://wiki.scummvm.org/index.php/Compiling_ScummVM/Symbian>
 
 
-10.0) Credits
+11.0) Credits
 ----- -------
 Please refer to our extensive Credits list at:
 
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 860173a..9b25f43 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -22,6 +22,7 @@
 
 #include "backends/graphics/openglsdl/openglsdl-graphics.h"
 #include "backends/events/sdl/sdl-events.h"
+#include "backends/platform/sdl/sdl.h"
 
 #include "common/textconsole.h"
 #include "common/config-manager.h"
@@ -620,25 +621,30 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 				return true;
 			}
 
+			// Alt-s creates a screenshot
 			if (event.kbd.keycode == Common::KEYCODE_s) {
-				// Alt-s creates a screenshot
 				Common::String filename;
 
+				Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
+
 				for (int n = 0;; n++) {
 					SDL_RWops *file;
 
 					filename = Common::String::format("scummvm%05d.bmp", n);
-					file = SDL_RWFromFile(filename.c_str(), "r");
+
+					file = SDL_RWFromFile((screenshotsPath + filename).c_str(), "r");
+
 					if (!file)
 						break;
 					SDL_RWclose(file);
 				}
 
-				saveScreenshot(filename.c_str());
+				saveScreenshot((screenshotsPath + filename).c_str());
 				debug("Saved screenshot '%s'", filename.c_str());
 
 				return true;
 			}
+
 		} else if (event.kbd.hasFlags(Common::KBD_CTRL | Common::KBD_ALT)) {
 			if (   event.kbd.keycode == Common::KEYCODE_PLUS || event.kbd.keycode == Common::KEYCODE_MINUS
 			    || event.kbd.keycode == Common::KEYCODE_KP_PLUS || event.kbd.keycode == Common::KEYCODE_KP_MINUS) {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 690e9a3..047941c 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2524,21 +2524,27 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 
 		// Alt-S: Create a screenshot
 		if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') {
-			char filename[20];
+			Common::String filename;
+
+			Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
 
 			for (int n = 0;; n++) {
 				SDL_RWops *file;
 
-				sprintf(filename, "scummvm%05d.bmp", n);
-				file = SDL_RWFromFile(filename, "r");
+				filename = Common::String::format("scummvm%05d.bmp", n);
+
+				file = SDL_RWFromFile((screenshotsPath + filename).c_str(), "r");
+
 				if (!file)
 					break;
 				SDL_RWclose(file);
 			}
-			if (saveScreenshot(filename))
-				debug("Saved screenshot '%s'", filename);
+
+			if (saveScreenshot((screenshotsPath + filename).c_str()))
+				debug("Saved screenshot '%s'", filename.c_str());
 			else
 				warning("Could not save screenshot");
+
 			return true;
 		}
 
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 1c5a7c2..09268f3 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -571,6 +571,11 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
 #endif
 }
 
+//Not specified in base class
+Common::String OSystem_SDL::getScreenshotsPath() {
+	return Common::String();
+}
+
 #ifdef USE_OPENGL
 
 const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 17b4e9b..bc4292b 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -84,6 +84,9 @@ public:
 	virtual Common::TimerManager *getTimerManager();
 	virtual Common::SaveFileManager *getSavefileManager();
 
+	//Screenshots
+	virtual Common::String getScreenshotsPath();
+
 protected:
 	bool _inited;
 	bool _initedSDL;
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 99c71a4..02ad225 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -29,6 +29,7 @@
 #include <windows.h>
 #undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
 #include <shellapi.h>
+#include <ShlObj.h>
 
 #include "common/scummsys.h"
 #include "common/config-manager.h"
@@ -145,6 +146,25 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
 	return true;
 }
 
+Common::String OSystem_Win32::getScreenshotsPath() {
+	char picturesPath[MAXPATHLEN];
+
+	// Use the My Pictures folder.
+	if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK)
+		error("Unable to access My Pictures directory");
+
+	Common::String screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
+
+	// If the directory already exists (as it should in most cases),
+	// we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+	if (!CreateDirectory(screenshotsPath.c_str(), NULL)) {
+		if (GetLastError() != ERROR_ALREADY_EXISTS)
+			error("Cannot create ScummVM Screenshots folder");
+	}
+
+	return screenshotsPath;
+}
+
 Common::String OSystem_Win32::getDefaultConfigFileName() {
 	char configFile[MAXPATHLEN];
 
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 636ebae..6764a7f 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -38,6 +38,8 @@ public:
 
 	virtual bool openUrl(const Common::String &url);
 
+	virtual Common::String getScreenshotsPath();
+
 protected:
 	/**
 	 * The path of the currently open log file, if any.


Commit: 438f23f2723b384098828fde3cf2b6b20fca9bc7
    https://github.com/scummvm/scummvm/commit/438f23f2723b384098828fde3cf2b6b20fca9bc7
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T01:06:40+01:00

Commit Message:
SDL: Use dynamic cast instead of C cast to get screenshot path

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 9b25f43..ccb2572 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -625,7 +625,10 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 			if (event.kbd.keycode == Common::KEYCODE_s) {
 				Common::String filename;
 
-				Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
+				Common::String screenshotsPath;
+				OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system);
+				if (sdl_g_system)
+					screenshotsPath = sdl_g_system->getScreenshotsPath();
 
 				for (int n = 0;; n++) {
 					SDL_RWops *file;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 047941c..dd28f32 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2526,7 +2526,10 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 		if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') {
 			Common::String filename;
 
-			Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
+			Common::String screenshotsPath;
+			OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system);
+			if (sdl_g_system)
+				screenshotsPath = sdl_g_system->getScreenshotsPath();
 
 			for (int n = 0;; n++) {
 				SDL_RWops *file;


Commit: 11dd33bb73c998116c2b862389b616fe9249579b
    https://github.com/scummvm/scummvm/commit/11dd33bb73c998116c2b862389b616fe9249579b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T01:06:50+01:00

Commit Message:
MACOSX: Create screenshot on Desktop

This is consistent with the OS shortcut (Crtl+Shift+3) to take a
screenshot.

Changed paths:
    README
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/macosx/macosx_wrapper.h
    backends/platform/sdl/macosx/macosx_wrapper.mm


diff --git a/README b/README
index 828591b..15da89c 100644
--- a/README
+++ b/README
@@ -2681,8 +2681,12 @@ configuration of each entry, allowing the custom options to be shown.
 
 9.0) Screenshots (SDL backend only):
 ---- -------------------------------
-By default screenshots are put into the current directory, however on Windows
-the directory for this purpose is set to "Users\username\My Pictures\ScummVM Screenshots".
+On systems using the SDL backend (for example Windows, Mac or Linux) you can use
+alt+s to take snapshots (see section 5.4 - Hotkeys). The location of the created
+screenshot file depends on the OS:
+  Windows: In Users\username\My Pictures\ScummVM Screenshots.
+  macOS X: On the Desktop.
+  Any other OS: In the current directoty.
 
 
 10.0) Compiling:
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index e90d459..500e438 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -187,6 +187,13 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
 #endif // USE_DETECTLANG
 }
 
+Common::String OSystem_MacOSX::getScreenshotsPath() {
+	Common::String path = getDesktopPathMacOSX();
+	if (!path.empty() && !path.hasSuffix("/"))
+		path += "/";
+	return path;
+}
+
 AudioCDManager *OSystem_MacOSX::createAudioCDManager() {
 	return createMacOSXAudioCDManager();
 }
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 72bb4a4..ba07364 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -44,6 +44,9 @@ public:
 	virtual void initBackend();
 	virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
 
+	//Screenshots
+	virtual Common::String getScreenshotsPath();
+
 protected:
 	// Override createAudioCDManager() to get our Mac-specific
 	// version.
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.h b/backends/platform/sdl/macosx/macosx_wrapper.h
index 3b346fc..84f0c1b 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.h
+++ b/backends/platform/sdl/macosx/macosx_wrapper.h
@@ -27,5 +27,6 @@
 
 bool hasTextInClipboardMacOSX();
 Common::String getTextFromClipboardMacOSX();
+Common::String getDesktopPathMacOSX();
 
 #endif
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 8ec9eac..5de3eb6 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -27,6 +27,8 @@
 
 #include <AppKit/NSPasteboard.h>
 #include <Foundation/NSArray.h>
+#include <Foundation/NSPathUtilities.h>
+#include <AvailabilityMacros.h>
 
 bool hasTextInClipboardMacOSX() {
 	return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] != nil;
@@ -46,3 +48,17 @@ Common::String getTextFromClipboardMacOSX() {
 	// we should use NSISOLatin1StringEncoding?).
 	return Common::String([str cStringUsingEncoding:NSASCIIStringEncoding]);
 }
+
+Common::String getDesktopPathMacOSX() {
+	// The recommanded method is to use NSFileManager.
+	// NSUrl *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask] firstObject];
+	// However it is only available in OS X 10.6+. So use NSSearchPathForDirectoriesInDomains instead (available since OS X 10.0)
+	// [NSArray firstObject] is also only available in OS X 10.6+. So we need to use [NSArray count] and [NSArray objectAtIndex:]
+	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, NO);
+	if ([paths count] == 0)
+		return Common::String();
+	NSString *path = [paths objectAtIndex:0];
+	if (path == nil)
+		return Common::String();
+	return Common::String([path cStringUsingEncoding:NSASCIIStringEncoding]);
+}
\ No newline at end of file


Commit: e96c057c3d7d2deb8ff31bc7d798d455f74b399a
    https://github.com/scummvm/scummvm/commit/e96c057c3d7d2deb8ff31bc7d798d455f74b399a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T01:07:05+01:00

Commit Message:
SDL: Allow specifying the screenshot directory in the config file

There is no GUI option to set the screenshot directory, but this
allows power users to set it if they don't want to use the default.

Changed paths:
    README
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/win32/win32.cpp


diff --git a/README b/README
index 15da89c..f326171 100644
--- a/README
+++ b/README
@@ -2682,11 +2682,19 @@ configuration of each entry, allowing the custom options to be shown.
 9.0) Screenshots (SDL backend only):
 ---- -------------------------------
 On systems using the SDL backend (for example Windows, Mac or Linux) you can use
-alt+s to take snapshots (see section 5.4 - Hotkeys). The location of the created
-screenshot file depends on the OS:
+alt+s to take snapshots (see section 5.4 - Hotkeys).
+
+You can specify the directory in which you want the screenshots to be created in
+the config file. To do so add a screenshotpath value under the [scummvm] section:
+
+[scummvm]
+screenshotpath=/path/to/screenshots/
+
+The default location, when no screenshot path is defined in the config file,
+depends on the OS:
   Windows: In Users\username\My Pictures\ScummVM Screenshots.
   macOS X: On the Desktop.
-  Any other OS: In the current directoty.
+  Any other OS: In the current directory.
 
 
 10.0) Compiling:
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 500e438..8669bf6 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -188,7 +188,9 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
 }
 
 Common::String OSystem_MacOSX::getScreenshotsPath() {
-	Common::String path = getDesktopPathMacOSX();
+	Common::String path = ConfMan.get("screenshotpath");
+	if (path.empty())
+		path = getDesktopPathMacOSX();
 	if (!path.empty() && !path.hasSuffix("/"))
 		path += "/";
 	return path;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 09268f3..9a5db7f 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -573,7 +573,10 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
 
 //Not specified in base class
 Common::String OSystem_SDL::getScreenshotsPath() {
-	return Common::String();
+	Common::String path = ConfMan.get("screenshotpath");
+	if (!path.empty() && !path.hasSuffix("/"))
+		path += "/";
+	return path;
 }
 
 #ifdef USE_OPENGL
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 02ad225..5724250 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -147,13 +147,22 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
 }
 
 Common::String OSystem_Win32::getScreenshotsPath() {
+	Common::String screenshotsPath = ConfMan.get("screenshotpath");
+	if (!screenshotsPath.empty()) {
+		if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/")
+			screenshotsPath += "\\";
+		return screenshotsPath;
+	}
+
 	char picturesPath[MAXPATHLEN];
 
 	// Use the My Pictures folder.
-	if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK)
-		error("Unable to access My Pictures directory");
+	if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) {
+		warning("Unable to access My Pictures directory");
+		return Common::String();
+	}
 
-	Common::String screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
+	screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
 
 	// If the directory already exists (as it should in most cases),
 	// we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)


Commit: a9ae691513f20018cc3798929dc6161828adfc7f
    https://github.com/scummvm/scummvm/commit/a9ae691513f20018cc3798929dc6161828adfc7f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T01:07:16+01:00

Commit Message:
SDL: Improve debug and warning messages when saving screenshots

In particular this adds a warning when failing to save a screenshot
in OpenGL mode (there was already one in SurfaceSDL mode).

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 7b41699..b239802 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -1302,7 +1302,7 @@ const Graphics::Font *OpenGLGraphicsManager::getFontOSD() {
 }
 #endif
 
-void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const {
+bool OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const {
 	const uint width  = _outputScreenWidth;
 	const uint height = _outputScreenHeight;
 
@@ -1332,7 +1332,10 @@ void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const
 
 	// Open file
 	Common::DumpFile out;
-	out.open(filename);
+	if (!out.open(filename)) {
+		delete[] pixels;
+		return false;
+	}
 
 	// Write BMP header
 	out.writeByte('B');
@@ -1357,6 +1360,7 @@ void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const
 
 	// Free allocated memory
 	delete[] pixels;
+	return true;
 }
 
 } // End of namespace OpenGL
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index d3f8d79..f5f4cab 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -296,8 +296,9 @@ protected:
 	 * uses Common::DumpFile for writing the screenshot.
 	 *
 	 * @param filename The output filename.
+	 * @return true on success, false otherwise
 	 */
-	void saveScreenshot(const Common::String &filename) const;
+	bool saveScreenshot(const Common::String &filename) const;
 
 private:
 	//
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index ccb2572..75e2cf8 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -642,8 +642,17 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 					SDL_RWclose(file);
 				}
 
-				saveScreenshot((screenshotsPath + filename).c_str());
-				debug("Saved screenshot '%s'", filename.c_str());
+				if (saveScreenshot(screenshotsPath + filename)) {
+					if (screenshotsPath.empty())
+						debug("Saved screenshot '%s' in current directory", filename.c_str());
+					else
+						debug("Saved screenshot '%s' in directory '%s'", filename.c_str(), screenshotsPath.c_str());
+				} else {
+					if (screenshotsPath.empty())
+						warning("Could not save screenshot in current directory");
+					else
+						warning("Could not save screenshot in directory '%s'", screenshotsPath.c_str());
+				}
 
 				return true;
 			}
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index dd28f32..ccfcc94 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2543,10 +2543,17 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
 				SDL_RWclose(file);
 			}
 
-			if (saveScreenshot((screenshotsPath + filename).c_str()))
-				debug("Saved screenshot '%s'", filename.c_str());
-			else
-				warning("Could not save screenshot");
+			if (saveScreenshot((screenshotsPath + filename).c_str())) {
+				if (screenshotsPath.empty())
+					debug("Saved screenshot '%s' in current directory", filename.c_str());
+				else
+					debug("Saved screenshot '%s' in directory '%s'", filename.c_str(), screenshotsPath.c_str());
+			} else {
+				if (screenshotsPath.empty())
+					warning("Could not save screenshot in current directory");
+				else
+					warning("Could not save screenshot in directory '%s'", screenshotsPath.c_str());
+			}
 
 			return true;
 		}





More information about the Scummvm-git-logs mailing list