aboutsummaryrefslogtreecommitdiff
path: root/engines/touche
diff options
context:
space:
mode:
authorEugene Sandulenko2007-11-03 21:06:58 +0000
committerEugene Sandulenko2007-11-03 21:06:58 +0000
commitc640d1c604f219a5be5412d6c5ea8a85f44ec4b4 (patch)
tree5d6efb4954efb93e4d6e2f71a37486a666ee20ce /engines/touche
parentc06905149286c3fbd803d3ca7522bbe66a6ad129 (diff)
downloadscummvm-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/touche')
-rw-r--r--engines/touche/detection.cpp25
-rw-r--r--engines/touche/touche.cpp10
-rw-r--r--engines/touche/touche.h2
3 files changed, 12 insertions, 25 deletions
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();