diff options
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r-- | gui/launcher.cpp | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index a3e4925848..0f4867ced5 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -145,10 +145,27 @@ protected: CheckboxWidget *_globalMIDIOverride; CheckboxWidget *_globalMT32Override; CheckboxWidget *_globalVolumeOverride; + + ExtraGuiOptions _engineOptions; }; EditGameDialog::EditGameDialog(const String &domain, const String &desc) : OptionsDialog(domain, "GameOptions") { + // Retrieve all game specific options. + const EnginePlugin *plugin = 0; + // To allow for game domains without a gameid. + // TODO: Is it intentional that this is still supported? + String gameId(ConfMan.get("gameid", domain)); + if (gameId.empty()) + gameId = domain; + // Retrieve the plugin, since we need to access the engine's MetaEngine + // implementation. + EngineMan.findGame(gameId, &plugin); + if (plugin) { + _engineOptions = (*plugin)->getExtraGuiOptions(domain); + } else { + warning("Plugin for target \"%s\" not found! Game specific settings might be missing", domain.c_str()); + } // GAME: Path to game data (r/o), extra data (r/o), and save data (r/w) String gamePath(ConfMan.get("path", _domain)); @@ -208,7 +225,16 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) } // - // 2) The graphics tab + // 2) The engine tab (shown only if there are custom engine options) + // + if (_engineOptions.size() > 0) { + tab->addTab(_("Engine")); + + addEngineControls(tab, "GameOptions_Engine.", _engineOptions); + } + + // + // 3) The graphics tab // _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX")); @@ -220,7 +246,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) addGraphicControls(tab, "GameOptions_Graphics."); // - // 3) The audio tab + // 4) The audio tab // tab->addTab(_("Audio")); @@ -233,7 +259,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) addSubtitleControls(tab, "GameOptions_Audio."); // - // 4) The volume tab + // 5) The volume tab // if (g_system->getOverlayWidth() > 320) tab->addTab(_("Volume")); @@ -248,7 +274,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) addVolumeControls(tab, "GameOptions_Volume."); // - // 5) The MIDI tab + // 6) The MIDI tab // if (!_guioptions.contains(GUIO_NOMIDI)) { tab->addTab(_("MIDI")); @@ -262,7 +288,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) } // - // 6) The MT-32 tab + // 7) The MT-32 tab // if (!_guioptions.contains(GUIO_NOMIDI)) { tab->addTab(_("MT-32")); @@ -276,7 +302,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) } // - // 7) The Paths tab + // 8) The Paths tab // if (g_system->getOverlayWidth() > 320) tab->addTab(_("Paths")); @@ -311,7 +337,6 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear); - // Activate the first tab tab->setActiveTab(0); _tabWidget = tab; @@ -342,8 +367,7 @@ void EditGameDialog::open() { e = ConfMan.hasKey("gfx_mode", _domain) || ConfMan.hasKey("render_mode", _domain) || ConfMan.hasKey("fullscreen", _domain) || - ConfMan.hasKey("aspect_ratio", _domain) || - ConfMan.hasKey("disable_dithering", _domain); + ConfMan.hasKey("aspect_ratio", _domain); _globalGraphicsOverride->setState(e); e = ConfMan.hasKey("music_driver", _domain) || @@ -386,6 +410,19 @@ void EditGameDialog::open() { _langPopUp->setEnabled(false); } + // Set the state of engine-specific checkboxes + for (uint j = 0; j < _engineOptions.size(); ++j) { + // The default values for engine-specific checkboxes are not set when + // ScummVM starts, as this would require us to load and poll all of the + // engine plugins on startup. Thus, we set the state of each custom + // option checkbox to what is specified by the engine plugin, and + // update it only if a value has been set in the configuration of the + // currently selected game. + bool isChecked = _engineOptions[j].defaultState; + if (ConfMan.hasKey(_engineOptions[j].configOption, _domain)) + isChecked = ConfMan.getBool(_engineOptions[j].configOption, _domain); + _engineCheckboxes[j]->setState(isChecked); + } const Common::PlatformDescription *p = Common::g_platforms; const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain)); @@ -429,6 +466,11 @@ void EditGameDialog::close() { ConfMan.removeKey("platform", _domain); else ConfMan.set("platform", Common::getPlatformCode(platform), _domain); + + // Set the state of engine-specific checkboxes + for (uint i = 0; i < _engineOptions.size(); i++) { + ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain); + } } OptionsDialog::close(); } @@ -621,7 +663,6 @@ LauncherDialog::LauncherDialog() _list->setEditable(false); _list->setNumberingMode(kListNumberingOff); - // Populate the list updateListing(); @@ -636,7 +677,7 @@ LauncherDialog::LauncherDialog() _browser = new BrowserDialog(_("Select directory with game data"), true); // Create Load dialog - _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load")); + _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false); } void LauncherDialog::selectTarget(const String &target) { |