diff options
author | Eugene Sandulenko | 2007-11-03 21:06:58 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2007-11-03 21:06:58 +0000 |
commit | c640d1c604f219a5be5412d6c5ea8a85f44ec4b4 (patch) | |
tree | 5d6efb4954efb93e4d6e2f71a37486a666ee20ce /engines/gob | |
parent | c06905149286c3fbd803d3ca7522bbe66a6ad129 (diff) | |
download | scummvm-rg350-c640d1c604f219a5be5412d6c5ea8a85f44ec4b4.tar.gz scummvm-rg350-c640d1c604f219a5be5412d6c5ea8a85f44ec4b4.tar.bz2 scummvm-rg350-c640d1c604f219a5be5412d6c5ea8a85f44ec4b4.zip |
Patch #1825276: "DETECTION: advanced detector engine simplification"
svn-id: r29386
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/detection.cpp | 22 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 6 | ||||
-rw-r--r-- | engines/gob/gob.h | 6 |
3 files changed, 15 insertions, 19 deletions
diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 22b249a4a8..db07c72414 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -1701,20 +1701,22 @@ static const ADParams detectionParams = { kADFlagAugmentPreferredTarget }; -ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Gob::GobEngine, detectionParams); +static bool Engine_GOB_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) { + const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)(encapsulatedDesc.realDesc); + if (gd) { + *engine = new Gob::GobEngine(syst); + ((Gob::GobEngine *)*engine)->initGame(gd); + } + return gd != 0; +} -REGISTER_PLUGIN(GOB, "Gob Engine", "Goblins Games (C) Coktel Vision"); +ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Engine_GOB_createInstance, detectionParams); +REGISTER_PLUGIN(GOB, "Gob Engine", "Goblins Games (C) Coktel Vision"); namespace Gob { -bool GobEngine::detectGame() { - Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams); - const GOBGameDescription *gd = (const GOBGameDescription *)(encapsulatedDesc.realDesc); - - if (gd == 0) - return false; - +void GobEngine::initGame(const GOBGameDescription *gd) { if (gd->startTotBase == 0) { _startTot = new char[10]; _startTot0 = new char[11]; @@ -1733,8 +1735,6 @@ bool GobEngine::detectGame() { _features = gd->features; _language = gd->desc.language; _platform = gd->desc.platform; - - return true; } } // End of namespace Gob diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 13f310aee0..aa014a0427 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -145,12 +145,6 @@ void GobEngine::validateVideoMode(int16 videoMode) { } int GobEngine::init() { - // Detect game - if (!detectGame()) { - GUIErrorMessage("No valid games were found in the specified directory."); - return -1; - } - if (!initGameParts()) { GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); return -1; diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 6f83fce1a2..9f4c90c5c5 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -167,6 +167,8 @@ private: friend class Ptr; }; +struct GOBGameDescription; + class GobEngine : public Engine { protected: GobEngine *_vm; @@ -177,8 +179,6 @@ protected: bool initGameParts(); void deinitGameParts(); - bool detectGame(); - public: static const Common::Language _gobToScummVMLang[]; @@ -237,6 +237,8 @@ public: GobEngine(OSystem *syst); virtual ~GobEngine(); + + void initGame(const GOBGameDescription *gd); }; } // End of namespace Gob |