From cc1ae7b190b4f586e4b0a9d2f78d9195dd88c09a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 24 Apr 2012 01:11:53 +0200 Subject: KYRA: Fix crahes in Kyra 1-3 and LoL when EGA/CGA graphics mode is selected. This is a regression from 86a817beb5eef248c5f5e28f18133db802a59c2e. Formerly Kyra always queried the render_mode and initializes its Screen functionality accordingly, even when the game actually only supported VGA. While in the "Edit game..." options only VGA was selectable, the global options still allowed for example EGA to be selected and thus messing up the internal state. I only check the render_mode setting for EoB 1 and 2 now, which are the only games which support the setting inside Screen. --- engines/kyra/screen.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'engines/kyra/screen.cpp') diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index d3b4d6f943..711fe15348 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -95,8 +95,23 @@ bool Screen::init() { _use16ColorMode = _vm->gameFlags().use16ColorMode; _isAmiga = (_vm->gameFlags().platform == Common::kPlatformAmiga); - if (ConfMan.hasKey("render_mode")) - _renderMode = Common::parseRenderMode(ConfMan.get("render_mode")); + // We only check the "render_mode" setting for both Eye of the Beholder + // games here, since all the other games do not support the render_mode + // setting or handle it differently, like Kyra 1 PC-98. This avoids + // graphics glitches and crashes in other games, when the user sets his + // global render_mode setting to EGA for example. + // TODO/FIXME: It would be nice not to hardcode this. But there is no + // trivial/non annoying way to do mode checks in an easy fashion right + // now. + // In a more general sense, we might want to think about a way to only + // pass valid config values, as in values which the engine can work with, + // to the engines. We already limit the selection via our GUIO flags in + // the game specific settings, but this is not enough due to global + // settings allowing everything. + if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2) { + if (ConfMan.hasKey("render_mode")) + _renderMode = Common::parseRenderMode(ConfMan.get("render_mode")); + } // CGA and EGA modes use additional pages to do the CGA/EGA specific graphics conversions. if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) { -- cgit v1.2.3