scummvm/engines/gob/metaengine.cpp
2021-12-26 18:48:43 +01:00

86 lines
2.4 KiB
C++

/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "engines/advancedDetector.h"
#include "gob/gob.h"
// For struct GOBGameDescription.
#include "gob/detection/detection.h"
class GobMetaEngine : public AdvancedMetaEngine {
public:
const char *getName() const override {
return "gob";
}
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
};
bool GobMetaEngine::hasFeature(MetaEngineFeature f) const {
return false;
}
bool Gob::GobEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsReturnToLauncher);
}
Common::Error GobMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)desc;
*engine = new Gob::GobEngine(syst);
((Gob::GobEngine *)*engine)->initGame(gd);
return Common::kNoError;
}
#if PLUGIN_ENABLED_DYNAMIC(GOB)
REGISTER_PLUGIN_DYNAMIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
#else
REGISTER_PLUGIN_STATIC(GOB, PLUGIN_TYPE_ENGINE, GobMetaEngine);
#endif
namespace Gob {
void GobEngine::initGame(const GOBGameDescription *gd) {
if (gd->startTotBase == nullptr)
_startTot = "intro.tot";
else
_startTot = gd->startTotBase;
if (gd->startStkBase == nullptr)
_startStk = "intro.stk";
else
_startStk = gd->startStkBase;
_demoIndex = gd->demoIndex;
_gameType = gd->gameType;
_features = gd->features;
_language = gd->desc.language;
_platform = gd->desc.platform;
}
} // End of namespace Gob