diff options
author | Johannes Schickel | 2013-10-07 00:58:19 +0200 |
---|---|---|
committer | Johannes Schickel | 2013-10-19 22:17:42 +0200 |
commit | ed180f6b67b0f8c0bedfca7117ab279349c45e1e (patch) | |
tree | b6040bf74ecc867cde0a0c5a3318f0e6fa1ff12f /base/main.cpp | |
parent | 20e4a7f0ce86bc93511643e4943b29044c84263f (diff) | |
download | scummvm-rg350-ed180f6b67b0f8c0bedfca7117ab279349c45e1e.tar.gz scummvm-rg350-ed180f6b67b0f8c0bedfca7117ab279349c45e1e.tar.bz2 scummvm-rg350-ed180f6b67b0f8c0bedfca7117ab279349c45e1e.zip |
BASE: Add hack to switch graphics manager in runGame.
This is a (temporary) hack to assure that when the launcher is set up as an
SurfaceSDL graphics mode and the game is using an OpenGL graphics mode
everything will work as expected.
Diffstat (limited to 'base/main.cpp')
-rw-r--r-- | base/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/main.cpp b/base/main.cpp index 103d743bbc..c993dfa57a 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -134,6 +134,19 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const Common::Error err = Common::kNoError; Engine *engine = 0; +#if defined(SDL_BACKEND) && defined(USE_OPENGL) && defined(USE_RGB_COLOR) + // HACK: We set up the requested graphics mode setting here to allow the + // backend to switch from Surface SDL to OpenGL if necessary. This is + // needed because otherwise the g_system->getSupportedFormats might return + // bad values. + g_system->beginGFXTransaction(); + g_system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + if (g_system->endGFXTransaction() != OSystem::kTransactionSuccess) { + warning("Switching graphics mode to '%s' failed", ConfMan.get("gfx_mode").c_str()); + return Common::kUnknownError; + } +#endif + // Verify that the game path refers to an actual directory if (!(dir.exists() && dir.isDirectory())) err = Common::kPathNotDirectory; |