GLK: Move the engine options into the MetaEngine subclass

This commit is contained in:
Cameron Cawley 2022-11-03 20:36:09 +00:00 committed by Eugene Sandulenko
parent c11cf35f48
commit 2d6ac650b3
4 changed files with 29 additions and 32 deletions

View File

@ -1,6 +1,6 @@
engines/glk/detection.cpp
engines/glk/glk_api.cpp
engines/glk/quetzal.cpp
engines/glk/metaengine.cpp
engines/glk/streams.cpp
engines/glk/adrift/os_glk.cpp
engines/glk/advsys/advsys.cpp

View File

@ -24,7 +24,6 @@
#include "common/memstream.h"
#include "common/str-array.h"
#include "common/file.h"
#include "common/translation.h"
#include "common/config-manager.h"
#include "glk/detection.h"
@ -231,29 +230,4 @@ void GlkMetaEngineDetection::detectClashes() const {
#endif
}
const ExtraGuiOptions GlkMetaEngineDetection::getExtraGuiOptions(const Common::String &) const {
ExtraGuiOptions options;
#if defined(USE_TTS)
static const ExtraGuiOption ttsSpeakOptions = {
_s("Enable Text to Speech"),
_s("Use TTS to read the text"),
"speak",
false,
0,
0
};
static const ExtraGuiOption ttsSpeakInputOptions = {
_s("Also read input text"),
_s("Use TTS to read the input text"),
"speak_input",
false,
0,
0
};
options.push_back(ttsSpeakOptions);
options.push_back(ttsSpeakInputOptions);
#endif
return options;
}
REGISTER_PLUGIN_STATIC(GLK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GlkMetaEngineDetection);

View File

@ -67,11 +67,6 @@ public:
* Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
*/
void detectClashes() const;
/**
* Return a list of extra GUI options for the specified target.
*/
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
};
namespace Glk {

View File

@ -65,6 +65,7 @@
#include "common/savefile.h"
#include "common/str-array.h"
#include "common/system.h"
#include "common/translation.h"
#include "graphics/surface.h"
#include "common/config-manager.h"
#include "common/file.h"
@ -82,6 +83,8 @@ public:
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine) override;
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
SaveStateList listSaves(const char *target) const override;
int getMaximumSaveSlot() const override;
void removeSaveState(const char *target, int slot) const override;
@ -233,6 +236,31 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) {
return *engine ? Common::kNoError : Common::kUserCanceled;
}
const ExtraGuiOptions GlkMetaEngine::getExtraGuiOptions(const Common::String &) const {
ExtraGuiOptions options;
#if defined(USE_TTS)
static const ExtraGuiOption ttsSpeakOptions = {
_s("Enable Text to Speech"),
_s("Use TTS to read the text"),
"speak",
false,
0,
0
};
static const ExtraGuiOption ttsSpeakInputOptions = {
_s("Also read input text"),
_s("Use TTS to read the input text"),
"speak_input",
false,
0,
0
};
options.push_back(ttsSpeakOptions);
options.push_back(ttsSpeakInputOptions);
#endif
return options;
}
SaveStateList GlkMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;