WINDOWS: Change location where screenshot are saved
This fixes bug #9701: WINDOWS: Flow of taking screenshots on Windows is broken
This commit is contained in:
parent
28ab63136a
commit
3849a3e90e
8 changed files with 62 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -216,3 +216,4 @@ psp2pkg/
|
||||||
|
|
||||||
#Ignore gmon.out created by gprof
|
#Ignore gmon.out created by gprof
|
||||||
gmon.out
|
gmon.out
|
||||||
|
/scummvm_libs_2015
|
||||||
|
|
15
README
15
README
|
@ -81,8 +81,9 @@ Table of Contents:
|
||||||
8.0) Configuration file
|
8.0) Configuration file
|
||||||
* 8.1 Recognized configuration keywords
|
* 8.1 Recognized configuration keywords
|
||||||
* 8.2 Custom game options that can be toggled via the GUI
|
* 8.2 Custom game options that can be toggled via the GUI
|
||||||
9.0) Compiling
|
9.0) Screenshots (SDL backend only)
|
||||||
10.0) Credits
|
10.0) Compiling
|
||||||
|
11.0) Credits
|
||||||
|
|
||||||
|
|
||||||
1.0) Introduction:
|
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.
|
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
|
For an up-to-date overview on how to compile ScummVM for various
|
||||||
platforms, please consult our Wiki, in particular this page:
|
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>
|
<http://wiki.scummvm.org/index.php/Compiling_ScummVM/Symbian>
|
||||||
|
|
||||||
|
|
||||||
10.0) Credits
|
11.0) Credits
|
||||||
----- -------
|
----- -------
|
||||||
Please refer to our extensive Credits list at:
|
Please refer to our extensive Credits list at:
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
|
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
|
||||||
#include "backends/events/sdl/sdl-events.h"
|
#include "backends/events/sdl/sdl-events.h"
|
||||||
|
#include "backends/platform/sdl/sdl.h"
|
||||||
|
|
||||||
#include "common/textconsole.h"
|
#include "common/textconsole.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
@ -620,25 +621,30 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.kbd.keycode == Common::KEYCODE_s) {
|
|
||||||
// Alt-s creates a screenshot
|
// Alt-s creates a screenshot
|
||||||
|
if (event.kbd.keycode == Common::KEYCODE_s) {
|
||||||
Common::String filename;
|
Common::String filename;
|
||||||
|
|
||||||
|
Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
|
||||||
|
|
||||||
for (int n = 0;; n++) {
|
for (int n = 0;; n++) {
|
||||||
SDL_RWops *file;
|
SDL_RWops *file;
|
||||||
|
|
||||||
filename = Common::String::format("scummvm%05d.bmp", n);
|
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)
|
if (!file)
|
||||||
break;
|
break;
|
||||||
SDL_RWclose(file);
|
SDL_RWclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveScreenshot(filename.c_str());
|
saveScreenshot((screenshotsPath + filename).c_str());
|
||||||
debug("Saved screenshot '%s'", filename.c_str());
|
debug("Saved screenshot '%s'", filename.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (event.kbd.hasFlags(Common::KBD_CTRL | Common::KBD_ALT)) {
|
} else if (event.kbd.hasFlags(Common::KBD_CTRL | Common::KBD_ALT)) {
|
||||||
if ( event.kbd.keycode == Common::KEYCODE_PLUS || event.kbd.keycode == Common::KEYCODE_MINUS
|
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) {
|
|| event.kbd.keycode == Common::KEYCODE_KP_PLUS || event.kbd.keycode == Common::KEYCODE_KP_MINUS) {
|
||||||
|
|
|
@ -2524,21 +2524,27 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
|
||||||
|
|
||||||
// Alt-S: Create a screenshot
|
// Alt-S: Create a screenshot
|
||||||
if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') {
|
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++) {
|
for (int n = 0;; n++) {
|
||||||
SDL_RWops *file;
|
SDL_RWops *file;
|
||||||
|
|
||||||
sprintf(filename, "scummvm%05d.bmp", n);
|
filename = Common::String::format("scummvm%05d.bmp", n);
|
||||||
file = SDL_RWFromFile(filename, "r");
|
|
||||||
|
file = SDL_RWFromFile((screenshotsPath + filename).c_str(), "r");
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
break;
|
break;
|
||||||
SDL_RWclose(file);
|
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
|
else
|
||||||
warning("Could not save screenshot");
|
warning("Could not save screenshot");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -571,6 +571,11 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Not specified in base class
|
||||||
|
Common::String OSystem_SDL::getScreenshotsPath() {
|
||||||
|
return Common::String();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
||||||
const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const {
|
const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const {
|
||||||
|
|
|
@ -84,6 +84,9 @@ public:
|
||||||
virtual Common::TimerManager *getTimerManager();
|
virtual Common::TimerManager *getTimerManager();
|
||||||
virtual Common::SaveFileManager *getSavefileManager();
|
virtual Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
|
//Screenshots
|
||||||
|
virtual Common::String getScreenshotsPath();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _inited;
|
bool _inited;
|
||||||
bool _initedSDL;
|
bool _initedSDL;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
|
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <ShlObj.h>
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
@ -145,6 +146,25 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
|
||||||
return true;
|
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() {
|
Common::String OSystem_Win32::getDefaultConfigFileName() {
|
||||||
char configFile[MAXPATHLEN];
|
char configFile[MAXPATHLEN];
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
|
|
||||||
virtual bool openUrl(const Common::String &url);
|
virtual bool openUrl(const Common::String &url);
|
||||||
|
|
||||||
|
virtual Common::String getScreenshotsPath();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* The path of the currently open log file, if any.
|
* The path of the currently open log file, if any.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue