SCI: Move the engine options into the engine plugin

This commit is contained in:
Cameron Cawley 2021-09-05 20:36:44 +01:00 committed by Eugene Sandulenko
parent 06cd9b6d16
commit afe9a804f6
6 changed files with 410 additions and 294 deletions

View file

@ -32,6 +32,7 @@
#include "gui/widgets/popup.h" #include "gui/widgets/popup.h"
#include "sci/detection.h" #include "sci/detection.h"
#include "sci/dialogs.h"
#include "sci/graphics/helpers_detection_enums.h" #include "sci/graphics/helpers_detection_enums.h"
#include "sci/sci.h" #include "sci/sci.h"
@ -164,216 +165,10 @@ static const PlainGameDescriptor s_sciGameTitles[] = {
} // End of namespace Sci } // End of namespace Sci
#include "sci/detection_tables.h" #include "sci/detection_tables.h"
#include "sci/detection_options.h"
namespace Sci { namespace Sci {
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_EGA_UNDITHER,
{
_s("Skip EGA dithering pass (full color backgrounds)"),
_s("Skip dithering pass in EGA games, graphics are shown with full colors"),
"disable_dithering",
false
}
},
{
GAMEOPTION_HIGH_RESOLUTION_GRAPHICS,
{
_s("Enable high resolution graphics"),
_s("Enable high resolution graphics/content"),
"enable_high_resolution_graphics",
true
}
},
{
GAMEOPTION_ENABLE_BLACK_LINED_VIDEO,
{
_s("Enable black-lined video"),
_s("Draw black lines over videos to increase their apparent sharpness"),
"enable_black_lined_video",
false
}
},
#ifdef USE_RGB_COLOR
{
GAMEOPTION_HQ_VIDEO,
{
_s("Use high-quality video scaling"),
_s("Use linear interpolation when upscaling videos, where possible"),
"enable_hq_video",
true
}
},
#endif
{
GAMEOPTION_LARRYSCALE,
{
_s("Use high-quality \"LarryScale\" cel scaling"),
_s("Use special cartoon scaler for drawing character sprites"),
"enable_larryscale",
true
}
},
{
GAMEOPTION_PREFER_DIGITAL_SFX,
{
_s("Prefer digital sound effects"),
_s("Prefer digital sound effects instead of synthesized ones"),
"prefer_digitalsfx",
true
}
},
{
GAMEOPTION_ORIGINAL_SAVELOAD,
{
_s("Use original save/load screens"),
_s("Use the original save/load screens instead of the ScummVM ones"),
"originalsaveload",
false
}
},
// Jones in the Fast Lane - CD audio tracks or resource.snd
{
GAMEOPTION_JONES_CDAUDIO,
{
_s("Use CD audio"),
_s("Use CD audio instead of in-game audio, if available"),
"use_cdaudio",
true
}
},
// KQ5 and KQ6 and SQ4 CD Windows - windows cursors
{
GAMEOPTION_WINDOWS_CURSORS,
{
_s("Use Windows cursors"),
_s("Use the Windows cursors (smaller and monochrome) instead of the DOS ones"),
"windows_cursors",
false
}
},
// SQ4 CD - silver cursors
{
GAMEOPTION_SQ4_SILVER_CURSORS,
{
_s("Use silver cursors"),
_s("Use the alternate set of silver cursors instead of the normal golden ones"),
"silver_cursors",
false
}
},
// Phantasmagoria 2 - content censoring option
{
GAMEOPTION_ENABLE_CENSORING,
{
_s("Enable content censoring"),
_s("Enable the game's built-in optional content censoring"),
"enable_censoring",
false
}
},
// KQ7 - Upscale videos to double their size (The in-game "Full screen" video setting)
{
GAMEOPTION_UPSCALE_VIDEOS,
{
_s("Upscale videos"),
_s("Upscale videos to double their size"),
"enable_video_upscale",
true
}
},
// SCI16 games: use RGB renderer instead of indexed
{
GAMEOPTION_RGB_RENDERING,
{
_s("Use RGB rendering"),
_s("Use RGB rendering to improve screen transitions"),
"rgb_rendering",
false
}
},
// SCI16 games: use custom per-resource palettes to improve visuals
{
GAMEOPTION_PALETTE_MODS,
{
_s("Use per-resource modified palettes"),
_s("Use custom per-resource palettes to improve visuals"),
"palette_mods",
false
}
},
// SQ1: Enable graphics that were disabled for legal reasons
{
GAMEOPTION_SQ1_BEARDED_MUSICIANS,
{
_s("Enable bearded musicians"),
_s("Enable graphics that were disabled for legal reasons"),
"enable_bearded_musicians",
false
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
struct PopUpOptionsItem {
const char *label;
int configValue;
};
#define POPUP_OPTIONS_ITEMS_TERMINATOR { nullptr, 0 }
struct PopUpOptionsMap {
const char *guioFlag;
const char *label;
const char *tooltip;
const char *configOption;
int defaultState;
PopUpOptionsItem items[10];
};
#define POPUP_OPTIONS_TERMINATOR { nullptr, nullptr, nullptr, nullptr, 0, { POPUP_OPTIONS_ITEMS_TERMINATOR } }
static const PopUpOptionsMap popUpOptionsList[] = {
{
GAMEOPTION_MIDI_MODE,
_s("MIDI mode:"),
_s("When using external MIDI devices (e.g. through USB-MIDI), select your device here"),
"midi_mode",
kMidiModeStandard,
{
{
_s("Standard (GM / MT-32)"),
kMidiModeStandard
},
{
_s("Roland D-110 / D-10 / D-20"),
kMidiModeD110
},
{
_s("Yamaha FB-01"),
kMidiModeFB01
},
POPUP_OPTIONS_ITEMS_TERMINATOR
}
},
POPUP_OPTIONS_TERMINATOR
};
static const char *directoryGlobs[] = { static const char *directoryGlobs[] = {
"avi", "avi",
"english", "english",
@ -386,88 +181,6 @@ static const char *directoryGlobs[] = {
0 0
}; };
class OptionsWidget : public GUI::OptionsContainerWidget {
public:
explicit OptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
// OptionsContainerWidget API
void load() override;
bool save() override;
private:
// OptionsContainerWidget API
void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
Common::String _guiOptions;
Common::HashMap<Common::String, GUI::CheckboxWidget *> _checkboxes;
Common::HashMap<Common::String, GUI::PopUpWidget *> _popUps;
};
OptionsWidget::OptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
OptionsContainerWidget(boss, name, "SciGameOptionsDialog", false, domain) {
_guiOptions = ConfMan.get("guioptions", domain);
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_checkboxes[entry->option.configOption] = new GUI::CheckboxWidget(widgetsBoss(), _dialogLayout + "." + entry->option.configOption, _(entry->option.label), _(entry->option.tooltip));
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions)) {
GUI::StaticTextWidget *textWidget = new GUI::StaticTextWidget(widgetsBoss(), _dialogLayout + "." + entry->configOption + "_desc", _(entry->label), _(entry->tooltip));
textWidget->setAlign(Graphics::kTextAlignRight);
_popUps[entry->configOption] = new GUI::PopUpWidget(widgetsBoss(), _dialogLayout + "." + entry->configOption);
for (uint i = 0; entry->items[i].label; ++i)
_popUps[entry->configOption]->appendEntry(_(entry->items[i].label), entry->items[i].configValue);
}
}
void OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
layouts.addDialog(layoutName, overlayedLayout);
layouts.addLayout(GUI::ThemeLayout::kLayoutVertical).addPadding(16, 16, 16, 16);
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
layouts.addWidget(entry->option.configOption, "Checkbox");
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry) {
layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal).addPadding(0, 0, 0, 0);
layouts.addWidget(Common::String(entry->configOption) + "_desc", "OptionsLabel");
layouts.addWidget(entry->configOption, "PopUp").closeLayout();
}
layouts.closeLayout().closeDialog();
}
void OptionsWidget::load() {
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_checkboxes[entry->option.configOption]->setState(ConfMan.getBool(entry->option.configOption, _domain));
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_popUps[entry->configOption]->setSelectedTag(ConfMan.getInt(entry->configOption, _domain));
// If the deprecated native_fb01 option is set, use it to set midi_mode
if (ConfMan.hasKey("native_fb01", _domain) && ConfMan.getBool("native_fb01", _domain))
_popUps["midi_mode"]->setSelectedTag(kMidiModeFB01);
}
bool OptionsWidget::save() {
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
ConfMan.setBool(entry->option.configOption, _checkboxes[entry->option.configOption]->getState(), _domain);
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
ConfMan.setInt(entry->configOption, _popUps[entry->configOption]->getSelectedTag(), _domain);
// Remove deprecated option
ConfMan.removeKey("native_fb01", _domain);
return true;
}
class SciMetaEngineDetection : public AdvancedMetaEngineDetection { class SciMetaEngineDetection : public AdvancedMetaEngineDetection {
public: public:
SciMetaEngineDetection() : AdvancedMetaEngineDetection(Sci::SciGameDescriptions, sizeof(ADGameDescription), s_sciGameTitles, optionsList) { SciMetaEngineDetection() : AdvancedMetaEngineDetection(Sci::SciGameDescriptions, sizeof(ADGameDescription), s_sciGameTitles, optionsList) {
@ -500,7 +213,6 @@ public:
ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override; ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override;
void registerDefaultSettings(const Common::String &target) const override; void registerDefaultSettings(const Common::String &target) const override;
GUI::OptionsContainerWidget *buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
}; };
void SciMetaEngineDetection::registerDefaultSettings(const Common::String &target) const { void SciMetaEngineDetection::registerDefaultSettings(const Common::String &target) const {
@ -510,10 +222,6 @@ void SciMetaEngineDetection::registerDefaultSettings(const Common::String &targe
ConfMan.registerDefault(entry->configOption, entry->defaultState); ConfMan.registerDefault(entry->configOption, entry->defaultState);
} }
GUI::OptionsContainerWidget *SciMetaEngineDetection::buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
return new OptionsWidget(boss, name, target);
}
ADDetectedGame SciMetaEngineDetection::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const { ADDetectedGame SciMetaEngineDetection::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const {
/** /**
* Fallback detection for Sci heavily depends on engine resources, so it's not possible * Fallback detection for Sci heavily depends on engine resources, so it's not possible

View file

@ -0,0 +1,219 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef SCI_DETECTION_OPTIONS_H
#define SCI_DETECTION_OPTIONS_H
namespace Sci {
const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_EGA_UNDITHER,
{
_s("Skip EGA dithering pass (full color backgrounds)"),
_s("Skip dithering pass in EGA games, graphics are shown with full colors"),
"disable_dithering",
false
}
},
{
GAMEOPTION_HIGH_RESOLUTION_GRAPHICS,
{
_s("Enable high resolution graphics"),
_s("Enable high resolution graphics/content"),
"enable_high_resolution_graphics",
true
}
},
{
GAMEOPTION_ENABLE_BLACK_LINED_VIDEO,
{
_s("Enable black-lined video"),
_s("Draw black lines over videos to increase their apparent sharpness"),
"enable_black_lined_video",
false
}
},
#ifdef USE_RGB_COLOR
{
GAMEOPTION_HQ_VIDEO,
{
_s("Use high-quality video scaling"),
_s("Use linear interpolation when upscaling videos, where possible"),
"enable_hq_video",
true
}
},
#endif
{
GAMEOPTION_LARRYSCALE,
{
_s("Use high-quality \"LarryScale\" cel scaling"),
_s("Use special cartoon scaler for drawing character sprites"),
"enable_larryscale",
true
}
},
{
GAMEOPTION_PREFER_DIGITAL_SFX,
{
_s("Prefer digital sound effects"),
_s("Prefer digital sound effects instead of synthesized ones"),
"prefer_digitalsfx",
true
}
},
{
GAMEOPTION_ORIGINAL_SAVELOAD,
{
_s("Use original save/load screens"),
_s("Use the original save/load screens instead of the ScummVM ones"),
"originalsaveload",
false
}
},
// Jones in the Fast Lane - CD audio tracks or resource.snd
{
GAMEOPTION_JONES_CDAUDIO,
{
_s("Use CD audio"),
_s("Use CD audio instead of in-game audio, if available"),
"use_cdaudio",
true
}
},
// KQ5 and KQ6 and SQ4 CD Windows - windows cursors
{
GAMEOPTION_WINDOWS_CURSORS,
{
_s("Use Windows cursors"),
_s("Use the Windows cursors (smaller and monochrome) instead of the DOS ones"),
"windows_cursors",
false
}
},
// SQ4 CD - silver cursors
{
GAMEOPTION_SQ4_SILVER_CURSORS,
{
_s("Use silver cursors"),
_s("Use the alternate set of silver cursors instead of the normal golden ones"),
"silver_cursors",
false
}
},
// Phantasmagoria 2 - content censoring option
{
GAMEOPTION_ENABLE_CENSORING,
{
_s("Enable content censoring"),
_s("Enable the game's built-in optional content censoring"),
"enable_censoring",
false
}
},
// KQ7 - Upscale videos to double their size (The in-game "Full screen" video setting)
{
GAMEOPTION_UPSCALE_VIDEOS,
{
_s("Upscale videos"),
_s("Upscale videos to double their size"),
"enable_video_upscale",
true
}
},
// SCI16 games: use RGB renderer instead of indexed
{
GAMEOPTION_RGB_RENDERING,
{
_s("Use RGB rendering"),
_s("Use RGB rendering to improve screen transitions"),
"rgb_rendering",
false
}
},
// SCI16 games: use custom per-resource palettes to improve visuals
{
GAMEOPTION_PALETTE_MODS,
{
_s("Use per-resource modified palettes"),
_s("Use custom per-resource palettes to improve visuals"),
"palette_mods",
false
}
},
// SQ1: Enable graphics that were disabled for legal reasons
{
GAMEOPTION_SQ1_BEARDED_MUSICIANS,
{
_s("Enable bearded musicians"),
_s("Enable graphics that were disabled for legal reasons"),
"enable_bearded_musicians",
false
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
const PopUpOptionsMap popUpOptionsList[] = {
{
GAMEOPTION_MIDI_MODE,
_s("MIDI mode:"),
_s("When using external MIDI devices (e.g. through USB-MIDI), select your device here"),
"midi_mode",
kMidiModeStandard,
{
{
_s("Standard (GM / MT-32)"),
kMidiModeStandard
},
{
_s("Roland D-110 / D-10 / D-20"),
kMidiModeD110
},
{
_s("Yamaha FB-01"),
kMidiModeFB01
},
POPUP_OPTIONS_ITEMS_TERMINATOR
}
},
POPUP_OPTIONS_TERMINATOR
};
} // End of namespace Sci
#endif

109
engines/sci/dialogs.cpp Normal file
View file

@ -0,0 +1,109 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "engines/advancedDetector.h"
#include "base/plugins.h"
#include "common/file.h"
#include "common/hashmap.h"
#include "common/ptr.h"
#include "common/translation.h"
#include "sci/detection.h"
#include "sci/dialogs.h"
#include "sci/sci.h"
/**
* When detection is compiled dynamically, options end up in detection plugin and
* engine cannot link to them so duplicate them in the engine in this case
*/
#ifndef DETECTION_STATIC
#include "sci/detection_options.h"
#endif
namespace Sci {
OptionsWidget::OptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
OptionsContainerWidget(boss, name, "SciGameOptionsDialog", false, domain) {
_guiOptions = ConfMan.get("guioptions", domain);
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_checkboxes[entry->option.configOption] = new GUI::CheckboxWidget(widgetsBoss(), _dialogLayout + "." + entry->option.configOption, _(entry->option.label), _(entry->option.tooltip));
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions)) {
GUI::StaticTextWidget *textWidget = new GUI::StaticTextWidget(widgetsBoss(), _dialogLayout + "." + entry->configOption + "_desc", _(entry->label), _(entry->tooltip));
textWidget->setAlign(Graphics::kTextAlignRight);
_popUps[entry->configOption] = new GUI::PopUpWidget(widgetsBoss(), _dialogLayout + "." + entry->configOption);
for (uint i = 0; entry->items[i].label; ++i)
_popUps[entry->configOption]->appendEntry(_(entry->items[i].label), entry->items[i].configValue);
}
}
void OptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
layouts.addDialog(layoutName, overlayedLayout);
layouts.addLayout(GUI::ThemeLayout::kLayoutVertical).addPadding(16, 16, 16, 16);
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
layouts.addWidget(entry->option.configOption, "Checkbox");
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry) {
layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal).addPadding(0, 0, 0, 0);
layouts.addWidget(Common::String(entry->configOption) + "_desc", "OptionsLabel");
layouts.addWidget(entry->configOption, "PopUp").closeLayout();
}
layouts.closeLayout().closeDialog();
}
void OptionsWidget::load() {
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_checkboxes[entry->option.configOption]->setState(ConfMan.getBool(entry->option.configOption, _domain));
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
_popUps[entry->configOption]->setSelectedTag(ConfMan.getInt(entry->configOption, _domain));
// If the deprecated native_fb01 option is set, use it to set midi_mode
if (ConfMan.hasKey("native_fb01", _domain) && ConfMan.getBool("native_fb01", _domain))
_popUps["midi_mode"]->setSelectedTag(kMidiModeFB01);
}
bool OptionsWidget::save() {
for (const ADExtraGuiOptionsMap *entry = optionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
ConfMan.setBool(entry->option.configOption, _checkboxes[entry->option.configOption]->getState(), _domain);
for (const PopUpOptionsMap *entry = popUpOptionsList; entry->guioFlag; ++entry)
if (checkGameGUIOption(entry->guioFlag, _guiOptions))
ConfMan.setInt(entry->configOption, _popUps[entry->configOption]->getSelectedTag(), _domain);
// Remove deprecated option
ConfMan.removeKey("native_fb01", _domain);
return true;
}
} // End of namespace Sci

72
engines/sci/dialogs.h Normal file
View file

@ -0,0 +1,72 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef SCI_DIALOGS_H
#define SCI_DIALOGS_H
#include "gui/ThemeEval.h"
#include "gui/widget.h"
#include "gui/widgets/popup.h"
namespace Sci {
struct PopUpOptionsItem {
const char *label;
int configValue;
};
#define POPUP_OPTIONS_ITEMS_TERMINATOR { nullptr, 0 }
struct PopUpOptionsMap {
const char *guioFlag;
const char *label;
const char *tooltip;
const char *configOption;
int defaultState;
PopUpOptionsItem items[10];
};
#define POPUP_OPTIONS_TERMINATOR { nullptr, nullptr, nullptr, nullptr, 0, { POPUP_OPTIONS_ITEMS_TERMINATOR } }
class OptionsWidget : public GUI::OptionsContainerWidget {
public:
explicit OptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
// OptionsContainerWidget API
void load() override;
bool save() override;
private:
// OptionsContainerWidget API
void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
Common::String _guiOptions;
Common::HashMap<Common::String, GUI::CheckboxWidget *> _checkboxes;
Common::HashMap<Common::String, GUI::PopUpWidget *> _popUps;
};
extern const ADExtraGuiOptionsMap optionsList[];
extern const PopUpOptionsMap popUpOptionsList[];
} // End of namespace Sci
#endif // SCI_DIALOGS_H

View file

@ -32,6 +32,7 @@
#include "graphics/surface.h" #include "graphics/surface.h"
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/dialogs.h"
#include "sci/engine/kernel.h" #include "sci/engine/kernel.h"
#include "sci/engine/savegame.h" #include "sci/engine/savegame.h"
#include "sci/engine/script.h" #include "sci/engine/script.h"
@ -282,6 +283,8 @@ public:
// A fallback detection method. This is not ideal as all detection lives in MetaEngine, but // A fallback detection method. This is not ideal as all detection lives in MetaEngine, but
// here fb detection has many engine dependencies. // here fb detection has many engine dependencies.
virtual ADDetectedGame fallbackDetectExtern(uint md5Bytes, const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override; virtual ADDetectedGame fallbackDetectExtern(uint md5Bytes, const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override;
GUI::OptionsContainerWidget *buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
}; };
Common::Error SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { Common::Error SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@ -705,6 +708,10 @@ ADDetectedGame SciMetaEngine::fallbackDetectExtern(uint md5Bytes, const FileMap
return ADDetectedGame(&s_fallbackDesc); return ADDetectedGame(&s_fallbackDesc);
} }
GUI::OptionsContainerWidget *SciMetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
return new OptionsWidget(boss, name, target);
}
} // End of namespace Sci } // End of namespace Sci
#if PLUGIN_ENABLED_DYNAMIC(SCI) #if PLUGIN_ENABLED_DYNAMIC(SCI)

View file

@ -2,6 +2,7 @@ MODULE := engines/sci
MODULE_OBJS := \ MODULE_OBJS := \
console.o \ console.o \
dialogs.o \
event.o \ event.o \
metaengine.o \ metaengine.o \
sci.o \ sci.o \