diff --git a/configure b/configure index 0f771a4e5d7..06df933f774 100755 --- a/configure +++ b/configure @@ -6164,7 +6164,7 @@ declare -a static_detect_engines=("PLUMBERS" "AGI" "SCUMM" "SKY" "DREAMWEB" "DRA "SWORD1" "SWORD2" "SWORD25" "ADL" "QUEEN" "CGE" "CGE2" "ACCESS" "ZVISION" "AGOS" "GOB" "COMPOSER" "DM" "DRACI" "DRAGONS" "GNAP" "GRIFFON" "GROOVIE" "HDB" "HOPKINS" "HUGO" "ILLUSIONS" "KINGDOM" - "KYRA" "LAB") + "KYRA" "LAB" "LASTEXPRESS") detectId="_DETECTION" echo "Creating engines/plugins_table.h" diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp index 99431ca007b..0dcc5ccc573 100644 --- a/engines/lastexpress/detection.cpp +++ b/engines/lastexpress/detection.cpp @@ -20,7 +20,6 @@ * */ -#include "lastexpress/lastexpress.h" #include "engines/advancedDetector.h" namespace LastExpress { @@ -241,26 +240,8 @@ public: const char *getOriginalCopyright() const override { return "The Last Express (C) 1997 Smoking Car Productions"; } - -protected: - bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const override; }; -bool LastExpressMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { - if (gd) { - *engine = new LastExpressEngine(syst, (const ADGameDescription *)gd); - } - return gd != 0; -} - -bool LastExpressEngine::isDemo() const { - return (bool)(_gameDescription->flags & ADGF_DEMO); -} - } // End of namespace LastExpress -#if PLUGIN_ENABLED_DYNAMIC(LASTEXPRESS) - REGISTER_PLUGIN_DYNAMIC(LASTEXPRESS, PLUGIN_TYPE_ENGINE, LastExpress::LastExpressMetaEngine); -#else - REGISTER_PLUGIN_STATIC(LASTEXPRESS, PLUGIN_TYPE_ENGINE, LastExpress::LastExpressMetaEngine); -#endif +REGISTER_PLUGIN_STATIC(LASTEXPRESS_DETECTION, PLUGIN_TYPE_METAENGINE, LastExpress::LastExpressMetaEngine); diff --git a/engines/lastexpress/metaengine.cpp b/engines/lastexpress/metaengine.cpp new file mode 100644 index 00000000000..b9ebb244fbc --- /dev/null +++ b/engines/lastexpress/metaengine.cpp @@ -0,0 +1,55 @@ +/* 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 "lastexpress/lastexpress.h" +#include "engines/advancedDetector.h" + +namespace LastExpress { + +class LastExpressMetaEngineConnect : public AdvancedMetaEngineConnect { +public: + const char *getName() const override { + return "lastexpress"; + } + +protected: + bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const override; +}; + +bool LastExpressMetaEngineConnect::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { + if (gd) { + *engine = new LastExpressEngine(syst, (const ADGameDescription *)gd); + } + return gd != 0; +} + +bool LastExpressEngine::isDemo() const { + return (bool)(_gameDescription->flags & ADGF_DEMO); +} + +} // End of namespace LastExpress + +#if PLUGIN_ENABLED_DYNAMIC(LASTEXPRESS) + REGISTER_PLUGIN_DYNAMIC(LASTEXPRESS, PLUGIN_TYPE_ENGINE, LastExpress::LastExpressMetaEngineConnect); +#else + REGISTER_PLUGIN_STATIC(LASTEXPRESS, PLUGIN_TYPE_ENGINE, LastExpress::LastExpressMetaEngineConnect); +#endif diff --git a/engines/lastexpress/module.mk b/engines/lastexpress/module.mk index afce0b07490..d25a57c5814 100644 --- a/engines/lastexpress/module.mk +++ b/engines/lastexpress/module.mk @@ -69,9 +69,9 @@ MODULE_OBJS := \ sound/queue.o \ sound/sound.o \ debug.o \ - detection.o \ graphics.o \ lastexpress.o \ + metaengine.o \ resource.o # This module can be built as a plugin @@ -81,3 +81,6 @@ endif # Include common rules include $(srcdir)/rules.mk + +# Detection objects +DETECT_OBJS += $(MODULE)/detection.o