BASE: Implemented --window-size command line option

This commit is contained in:
Eugene Sandulenko 2021-04-21 00:57:10 +02:00
parent d7ea2efd3a
commit 06794e48c6
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 31 additions and 0 deletions

View File

@ -32,6 +32,8 @@ For a more comprehensive changelog of the latest experimental code, see:
- Display path to scummvm configuration file in GUI -> Options -> Paths.
- Added new optional dependency, giflib >= 5.0.0. Used by some version of LBA.
- Added HiDPI support to the ScummVM GUI.
- Added command line option --window-size for specifying ScummVM window size,
applicable only to the OpenGL renderer.
AGOS:
- Added support for the Japanese PC-98 version of Elvira 1.

View File

@ -104,6 +104,10 @@ static const char HELP_STRING[] =
" --stretch-mode=MODE Select stretch mode (center, integral, fit, stretch)\n"
" --filtering Force filtered graphics mode\n"
" --no-filtering Force unfiltered graphics mode\n"
#ifdef USE_OPENGL
" --window-size=W,H Set the ScummVM window size to the specified dimensions\n"
" (OpenGL only)\n"
#endif
" --gui-theme=THEME Select GUI theme\n"
" --themepath=PATH Path to where GUI themes are stored\n"
" --list-themes Display list of all usable GUI themes\n"
@ -607,6 +611,25 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
DO_LONG_OPTION_BOOL("filtering")
END_OPTION
#ifdef USE_OPENGL
DO_LONG_OPTION("window-size")
Common::StringTokenizer tokenizer(option, ",");
if (tokenizer.empty())
usage("Invalid window format specified: %s", option);
Common::String w = tokenizer.nextToken();
if (tokenizer.empty())
usage("Invalid window format specified: %s", option);
Common::String h = tokenizer.nextToken();
if (atoi(w.c_str()) == 0 || atoi(h.c_str()) == 0)
usage("Invalid window format specified: %s", option);
settings["last_window_width"] = w;
settings["last_window_height"] = h;
settings.erase("window_size");
END_OPTION
#endif
#ifdef ENABLE_EVENTRECORDER
DO_LONG_OPTION_INT("disable-display")
END_OPTION

View File

@ -469,6 +469,12 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
ConfMan.registerDefault("dump_midi", true);
}
#ifdef USE_OPENGL
if (settings.contains("last_window_width")) {
ConfMan.setInt("last_window_width", atoi(settings["last_window_width"].c_str()));
ConfMan.setInt("last_window_height", atoi(settings["last_window_height"].c_str()));
}
#endif
// Init the backend. Must take place after all config data (including
// the command line params) was read.