[Scummvm-git-logs] scummvm master -> f3dc1df7d81377cdf3b2fd4e9ec630c2bbb3f135
criezy
noreply at scummvm.org
Wed Feb 16 22:24:10 UTC 2022
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
54c84b8700 BASE: Add command line option to set screenshot path
533693437d SDL: Do not query directly ConfMan for the screenshotpath in Windows and macOS backends
f3dc1df7d8 SDL: Get a user-specified screenshotpath from ConfMan at the start
Commit: 54c84b87005e8e296ab34d14b05050a87fc277be
https://github.com/scummvm/scummvm/commit/54c84b87005e8e296ab34d14b05050a87fc277be
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-02-16T22:24:07Z
Commit Message:
BASE: Add command line option to set screenshot path
Note that since the ConfMan transient domain is cleared when opening
the launcher, this only work when specifying a game on the command
line as well, and only until returning to the launcher.
Changed paths:
base/commandLine.cpp
doc/docportal/advanced_topics/command_line.rst
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 19d3778f071..7588ab25f89 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -98,6 +98,7 @@ static const char HELP_STRING[] =
" -c, --config=CONFIG Use alternate configuration file\n"
#if defined(SDL_BACKEND)
" -l, --logfile=PATH Use alternate path for log file\n"
+ " --screenshotpath=PATH Specify path where screenshot files are created\n"
#endif
" -p, --path=PATH Path to where the game is installed\n"
" -x, --save-slot[=NUM] Save game slot to load (default: autosave)\n"
@@ -597,6 +598,15 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
#if defined(SDL_BACKEND)
DO_OPTION('l', "logfile")
END_OPTION
+
+ DO_LONG_OPTION("screenshotpath")
+ Common::FSNode path(option);
+ if (!path.exists()) {
+ usage("Non-existent game path '%s'", option);
+ } else if (!path.isWritable()) {
+ usage("Non-writable screenshot path '%s'", option);
+ }
+ END_OPTION
#endif
DO_OPTION_INT('b', "boot-param")
diff --git a/doc/docportal/advanced_topics/command_line.rst b/doc/docportal/advanced_topics/command_line.rst
index 46595cfa546..9ce114386e1 100755
--- a/doc/docportal/advanced_topics/command_line.rst
+++ b/doc/docportal/advanced_topics/command_line.rst
@@ -157,6 +157,7 @@ Short options are listed where they are available.
``--render-mode=MODE``,,":ref:`Enables additional render modes <render>`"
``--save-slot=NUM``,``-x``,"Specifies the saved game slot to load (default: autosave)"
``--savepath=PATH``,,":ref:`Specifies path to where saved games are stored <savepath>`"
+ ``--screenshotpath=PATH``,,"Specify path where screenshot files are created (SDL backend only)"
``--sfx-volume=NUM``,``-s``,":ref:`Sets the sfx volume <sfx>`, 0-255 (default: 192)"
``--soundfont=FILE``,,":ref:`Selects the SoundFont for MIDI playback. <soundfont>`. Only supported by some MIDI drivers."
``--speech-volume=NUM``,``-r``,":ref:`Sets the speech volume <speechvol>`, 0-255 (default: 192)"
Commit: 533693437dd6ba1999732af9a919a02120e499b3
https://github.com/scummvm/scummvm/commit/533693437dd6ba1999732af9a919a02120e499b3
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-02-16T22:24:07Z
Commit Message:
SDL: Do not query directly ConfMan for the screenshotpath in Windows and macOS backends
Instead we call the OSystem_SDL implementation of getScreenshotsPath(),
as done in the POSIX backend. This change means that if we change how
we handle a user-specified screenshot path in the SDL backend, the
Windows and macOS backends will still get the correct path.
Changed paths:
backends/platform/sdl/macosx/macosx.cpp
backends/platform/sdl/win32/win32.cpp
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index ec2e19a94a6..b23c190fdf4 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -269,12 +269,15 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
}
Common::String OSystem_MacOSX::getScreenshotsPath() {
- Common::String path = ConfMan.get("screenshotpath");
- if (path.empty())
- path = getDesktopPathMacOSX();
- if (!path.empty() && !path.hasSuffix("/"))
- path += "/";
- return path;
+ // If the user has configured a screenshots path, use it
+ const Common::String path = OSystem_SDL::getScreenshotsPath();
+ if (!path.empty())
+ return path;
+
+ Common::String desktopPath = getDesktopPathMacOSX();
+ if (!desktopPath.empty() && !desktopPath.hasSuffix("/"))
+ desktopPath += "/";
+ return desktopPath;
}
AudioCDManager *OSystem_MacOSX::createAudioCDManager() {
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 42757cf2b3c..fe3f6f4cc37 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -238,10 +238,15 @@ Common::String OSystem_Win32::getSystemLanguage() const {
}
Common::String OSystem_Win32::getScreenshotsPath() {
- Common::String screenshotsPath = ConfMan.get("screenshotpath");
+ // If the user has configured a screenshots path, use it
+ Common::String screenshotsPath = OSystem_SDL::getScreenshotsPath();
if (!screenshotsPath.empty()) {
- if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/"))
- screenshotsPath += "\\";
+ // OSystem_SDL may have appended a '/' at the end
+ if (screenshotsPath.hasSuffix("/")) {
+ screenshotsPath.deleteLastChar();
+ if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/"))
+ screenshotsPath += "\\";
+ }
return screenshotsPath;
}
Commit: f3dc1df7d81377cdf3b2fd4e9ec630c2bbb3f135
https://github.com/scummvm/scummvm/commit/f3dc1df7d81377cdf3b2fd4e9ec630c2bbb3f135
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-02-16T22:24:07Z
Commit Message:
SDL: Get a user-specified screenshotpath from ConfMan at the start
There are two ways the user can specify a screenshot path: by
editing the config file manually, or by passing it on the command
line. In the later case it is added to the transient domain that
is cleared when opening the launcher, so it only worked when also
specifying a game to start on the command line. With this change
a screenshot path specified on the command line will be used until
quitting ScummVM.
This could be confusing if the user had the ability to specify the
path in the ScummVM Options, as then we would probably want to use
the new specified path immediately. But since the path does not
appear in the options, this change should work fine.
Changed paths:
backends/platform/sdl/sdl.cpp
backends/platform/sdl/sdl.h
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 1bebde1c9f6..f39ac65c247 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -196,6 +196,13 @@ void OSystem_SDL::initBackend() {
_logger->open(logFile);
}
+ // In case the user specified the screenshot path, we get it here.
+ // That way if it was specified on the command line we will not lose it
+ // when the launcher is started (as it clears the ConfMan transient domain).
+ _userScreenshotPath = ConfMan.get("screenshotpath");
+ if (!_userScreenshotPath.empty() && !_userScreenshotPath.hasSuffix("/"))
+ _userScreenshotPath += "/";
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
const char *sdlDriverName = SDL_GetCurrentVideoDriver();
// Allow the screen to turn off
@@ -716,10 +723,7 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
//Not specified in base class
Common::String OSystem_SDL::getScreenshotsPath() {
- Common::String path = ConfMan.get("screenshotpath");
- if (!path.empty() && !path.hasSuffix("/"))
- path += "/";
- return path;
+ return _userScreenshotPath;
}
#ifdef USE_OPENGL
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index cf0a4022ee0..5de4e01343e 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -118,6 +118,12 @@ protected:
*/
Common::String _logFilePath;
+ /**
+ * A path specified by the user where screenshots are created.
+ * This may be empty, in which case a OS-dependent default path is used.
+ */
+ Common::String _userScreenshotPath;
+
/**
* The event source we use for obtaining SDL events.
*/
More information about the Scummvm-git-logs
mailing list