aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-10-01 16:23:22 -0500
committerColin Snover2017-10-07 12:30:29 -0500
commit6e157429b7a5a64af6265d075c88595df2d6fd79 (patch)
tree6e16e359d2f427ff0aa17ae229780509595ee1b1 /engines
parent24f5d456195df3b65ed2876cbca2e2981f3d1a07 (diff)
downloadscummvm-rg350-6e157429b7a5a64af6265d075c88595df2d6fd79.tar.gz
scummvm-rg350-6e157429b7a5a64af6265d075c88595df2d6fd79.tar.bz2
scummvm-rg350-6e157429b7a5a64af6265d075c88595df2d6fd79.zip
BACKENDS: Fix window sizing of games that switch between multiple resolutions
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/cine.cpp6
-rw-r--r--engines/dreamweb/stubs.cpp6
-rw-r--r--engines/engine.cpp39
-rw-r--r--engines/gob/gob.cpp8
-rw-r--r--engines/util.h14
5 files changed, 48 insertions, 25 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 777cbe279f..5ecf78d8b4 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -94,8 +94,14 @@ void CineEngine::syncSoundSettings() {
}
Common::Error CineEngine::run() {
+ Graphics::ModeList modes;
+ modes.push_back(Graphics::Mode(320, 200));
if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD)) {
+ modes.push_back(Graphics::Mode(640, 480));
+ initGraphicsModes(modes);
showSplashScreen();
+ } else {
+ initGraphicsModes(modes);
}
// Initialize backend
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 4aa487d13f..401ecf038c 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -22,6 +22,7 @@
#include "dreamweb/sound.h"
#include "dreamweb/dreamweb.h"
+#include "engines/util.h"
#include "common/config-manager.h"
#include "common/file.h"
@@ -563,6 +564,11 @@ void DreamWebEngine::dreamweb() {
break;
}
+ Graphics::ModeList modes;
+ modes.push_back(Graphics::Mode(320, 200));
+ modes.push_back(Graphics::Mode(640, 480));
+ initGraphicsModes(modes);
+
allocateBuffers();
// setMouse
diff --git a/engines/engine.cpp b/engines/engine.cpp
index ae82692992..8f412ba911 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -32,6 +32,7 @@
#include "engines/engine.h"
#include "engines/dialogs.h"
+#include "engines/util.h"
#include "common/config-manager.h"
#include "common/events.h"
@@ -195,35 +196,21 @@ void Engine::initializePath(const Common::FSNode &gamePath) {
}
void initCommonGFX() {
- const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
- assert(transientDomain);
-
- // Override global scaler with any game-specific define
- if (ConfMan.hasKey("gfx_mode")) {
- Common::String gfxMode = ConfMan.get("gfx_mode");
- g_system->setGraphicsMode(gfxMode.c_str());
- }
-
- // Note: The following code deals with the fullscreen / ASR settings. This
- // is a bit tricky, because there are three ways the user can affect these
- // settings: Via the config file, via the command line, and via in-game
- // hotkeys.
// Any global or command line settings already have been applied at the time
- // we get here. Hence we only do something
+ // we get here, so we only do something if the game domain overrides those
+ // values
+ if (gameDomain) {
+ if (gameDomain->contains("aspect_ratio"))
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
- // (De)activate aspect-ratio correction as determined by the config settings
- if (gameDomain && gameDomain->contains("aspect_ratio"))
- g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
+ if (gameDomain->contains("fullscreen"))
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
- // (De)activate fullscreen mode as determined by the config settings
- if (gameDomain && gameDomain->contains("fullscreen"))
- g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
-
- // (De)activate filtering mode as determined by the config settings
- if (gameDomain && gameDomain->contains("filtering"))
- g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering"));
+ if (gameDomain->contains("filtering"))
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering"));
+ }
}
// Please leave the splash screen in working order for your releases, even if they're commercial.
@@ -285,6 +272,10 @@ void splashScreen() {
splash = true;
}
+void initGraphicsModes(const Graphics::ModeList &modes) {
+ g_system->initSizeHint(modes);
+}
+
void initGraphics(int width, int height, const Graphics::PixelFormat *format) {
g_system->beginGFXTransaction();
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index c9eaec9ef0..46f32a9f32 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -25,6 +25,7 @@
#include "backends/audiocd/audiocd.h"
#include "base/plugins.h"
#include "common/config-manager.h"
+#include "engines/util.h"
#include "audio/mididrv.h"
#include "audio/mixer.h"
@@ -708,6 +709,13 @@ Common::Error GobEngine::initGraphics() {
_mode = 0x14;
}
+ Graphics::ModeList modes;
+ modes.push_back(Graphics::Mode(_width, _height));
+ if (getGameType() == kGameTypeLostInTime) {
+ modes.push_back(Graphics::Mode(640, 400));
+ }
+ initGraphicsModes(modes);
+
_video->setSize();
_pixelFormat = g_system->getScreenFormat();
diff --git a/engines/util.h b/engines/util.h
index fdac02f005..ccf28f2e22 100644
--- a/engines/util.h
+++ b/engines/util.h
@@ -23,9 +23,11 @@
#ifndef ENGINES_UTIL_H
#define ENGINES_UTIL_H
+#include "common/array.h"
#include "common/scummsys.h"
#include "common/list.h"
#include "graphics/pixelformat.h"
+#include "graphics/mode.h"
/**
* Setup the backend's graphics mode.
@@ -33,7 +35,17 @@
void initCommonGFX();
/**
- * Setup the backend's screen size and graphics mode.
+ * Sends a list of graphics modes to the backend so it can make a decision
+ * about the best way to set up the display hardware.
+ *
+ * Engines that switch between different virtual screen sizes during a game
+ * should call this function prior to any call to initGraphics. Engines that use
+ * only a single screen size do not need to call this function.
+ */
+void initGraphicsModes(const Graphics::ModeList &modes);
+
+/**
+ * Sets up the backend's screen size and graphics mode.
*
* Shows an various warnings on certain backend graphics
* transaction failures (aspect switch, fullscreen switch, etc.).