From c640d1c604f219a5be5412d6c5ea8a85f44ec4b4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 Nov 2007 21:06:58 +0000 Subject: Patch #1825276: "DETECTION: advanced detector engine simplification" svn-id: r29386 --- engines/touche/detection.cpp | 25 +++++++++---------------- engines/touche/touche.cpp | 10 ++-------- engines/touche/touche.h | 2 +- 3 files changed, 12 insertions(+), 25 deletions(-) (limited to 'engines/touche') diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index 3fe558b01f..41b2062ffc 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -110,7 +110,7 @@ static const Common::ADFileBasedFallback fileBasedFallback[] = { { 0, { 0 } } }; -} +} // End of namespace Touche static const Common::ADParams detectionParams = { (const byte *)Touche::gameDescriptions, @@ -124,21 +124,14 @@ static const Common::ADParams detectionParams = { Common::kADFlagAugmentPreferredTarget | Common::kADFlagPrintWarningOnFileBasedFallback }; -ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Touche::ToucheEngine, detectionParams); - -REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software"); - -namespace Touche { - -bool ToucheEngine::detectGame() { - Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams); +static bool Engine_TOUCHE_createInstance(OSystem *syst, Engine **engine, const Common::EncapsulatedADGameDesc &encapsulatedDesc) { const Common::ADGameDescription *gd = encapsulatedDesc.realDesc; - - if (gd == 0) - return false; - - _language = gd->language; - return true; + if (gd) { + *engine = new Touche::ToucheEngine(syst, gd->language); + } + return gd != 0; } -} // End of namespace Touche +ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Engine_TOUCHE_createInstance, detectionParams); + +REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software"); diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 7e1a839fe9..bb02b7e58c 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -37,8 +37,8 @@ namespace Touche { -ToucheEngine::ToucheEngine(OSystem *system) - : Engine(system), _midiPlayer(0) { +ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) + : Engine(system), _midiPlayer(0), _language(language) { _saveLoadCurrentPage = 0; _saveLoadCurrentSlot = 0; @@ -87,12 +87,6 @@ int ToucheEngine::init() { _system->initSize(kScreenWidth, kScreenHeight); _system->endGFXTransaction(); - // Detect game - if (!detectGame()) { - GUIErrorMessage("No valid games were found in the specified directory."); - return -1; - } - Graphics::setupFont(_language); setupOpcodes(); diff --git a/engines/touche/touche.h b/engines/touche/touche.h index 5c27f58c92..c1bc12655f 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -351,7 +351,7 @@ public: typedef void (ToucheEngine::*OpcodeProc)(); - ToucheEngine(OSystem *system); + ToucheEngine(OSystem *system, Common::Language language); virtual ~ToucheEngine(); virtual int init(); -- cgit v1.2.3