diff options
author | Paul Gilbert | 2018-10-17 22:45:25 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 5f626f7a6abbcc2ec18cc50df1ce5ba705f967cd (patch) | |
tree | e216ba69ac7b6b0ef6e135f0003957c4f9d50555 | |
parent | ef161922d85a23ea99d9e86417c6ac8b675dc43d (diff) | |
download | scummvm-rg350-5f626f7a6abbcc2ec18cc50df1ce5ba705f967cd.tar.gz scummvm-rg350-5f626f7a6abbcc2ec18cc50df1ce5ba705f967cd.tar.bz2 scummvm-rg350-5f626f7a6abbcc2ec18cc50df1ce5ba705f967cd.zip |
GLK: Add detection logic needed for engine startup
-rw-r--r-- | engines/gargoyle/detection.cpp | 29 | ||||
-rw-r--r-- | engines/gargoyle/gargoyle.cpp | 7 | ||||
-rw-r--r-- | engines/gargoyle/gargoyle.h | 24 | ||||
-rw-r--r-- | engines/gargoyle/scott/detection.cpp | 2 |
4 files changed, 59 insertions, 3 deletions
diff --git a/engines/gargoyle/detection.cpp b/engines/gargoyle/detection.cpp index f86e34cd21..b7a32a780a 100644 --- a/engines/gargoyle/detection.cpp +++ b/engines/gargoyle/detection.cpp @@ -37,9 +37,13 @@ namespace Gargoyle { struct GargoyleGameDescription { ADGameDescription desc; + Common::String filename; InterpreterType interpType; }; +const Common::String &GargoyleEngine::getFilename() const { + return _gameDescription->filename; +} uint32 GargoyleEngine::getFeatures() const { return _gameDescription->desc.flags; } @@ -63,6 +67,7 @@ static const PlainGameDescriptor gargoyleGames[] = { {0, 0} }; +#include "common/config-manager.h" #include "gargoyle/detection_tables.h" #include "gargoyle/scott/detection.h" #include "gargoyle/scott/scott.h" @@ -89,6 +94,8 @@ public: SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual DetectedGames detectGames(const Common::FSList &fslist) const override; + + virtual ADDetectedGames detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const override; }; bool GargoyleMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -108,7 +115,9 @@ bool Gargoyle::GargoyleEngine::hasFeature(EngineFeature f) const { } bool GargoyleMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { - const Gargoyle::GargoyleGameDescription *gd = (const Gargoyle::GargoyleGameDescription *)desc; + Gargoyle::GargoyleGameDescription *gd = (Gargoyle::GargoyleGameDescription *)desc; + gd->filename = ConfMan.get("filename"); + switch (gd->interpType) { case Gargoyle::INTERPRETER_SCOTT: *engine = new Gargoyle::Scott::Scott(syst, gd); @@ -143,6 +152,24 @@ DetectedGames GargoyleMetaEngine::detectGames(const Common::FSList &fslist) cons return detectedGames; } +static Gargoyle::GargoyleGameDescription gameDescription; + +ADDetectedGames GargoyleMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const { + ADDetectedGames detectedGames; + static char gameId[100]; + strcpy(gameId, ConfMan.get("gameid").c_str()); + + gameDescription.desc.gameId = gameId; + gameDescription.desc.language = language; + gameDescription.desc.platform = platform; + gameDescription.desc.extra = extra.c_str(); + gameDescription.filename = ConfMan.get("filename"); + + ADDetectedGame dg((ADGameDescription *)&gameDescription); + detectedGames.push_back(dg); + return detectedGames; +} + #if PLUGIN_ENABLED_DYNAMIC(GARGOYLE) REGISTER_PLUGIN_DYNAMIC(Gargoyle, PLUGIN_TYPE_ENGINE, GargoyleMetaEngine); #else diff --git a/engines/gargoyle/gargoyle.cpp b/engines/gargoyle/gargoyle.cpp index 7953c684f8..561f14ae01 100644 --- a/engines/gargoyle/gargoyle.cpp +++ b/engines/gargoyle/gargoyle.cpp @@ -24,6 +24,7 @@ #include "common/config-manager.h" #include "common/debug-channels.h" #include "common/events.h" +#include "common/file.h" #include "engines/util.h" #include "graphics/scaler.h" #include "graphics/thumbnail.h" @@ -54,8 +55,10 @@ void GargoyleEngine::initialize() { Common::Error GargoyleEngine::run() { initialize(); - // TODO: Pass proper gamefile - runGame(nullptr); + Common::File f; + if (!f.open(getFilename())) + error("Could not open game file"); + runGame(&f); return Common::kNoError; } diff --git a/engines/gargoyle/gargoyle.h b/engines/gargoyle/gargoyle.h index 37c1a22196..3cfee29c87 100644 --- a/engines/gargoyle/gargoyle.h +++ b/engines/gargoyle/gargoyle.h @@ -75,6 +75,10 @@ protected: // Engine APIs virtual Common::Error run(); + + /** + * Returns true whether a given feature is supported by the engine + */ virtual bool hasFeature(EngineFeature f) const; /** @@ -85,10 +89,30 @@ public: GargoyleEngine(OSystem *syst, const GargoyleGameDescription *gameDesc); virtual ~GargoyleEngine(); + /** + * Returns the bitset of game features + */ uint32 getFeatures() const; + + /** + * Returns whether the game is a demo + */ bool isDemo() const; + + /** + * Returns the language + */ Common::Language getLanguage() const; + + /** + * Returns the running interpreter type + */ InterpreterType getInterpreterType() const; + + /** + * Returns the primary filename for the game + */ + const Common::String &GargoyleEngine::getFilename() const; }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/scott/detection.cpp b/engines/gargoyle/scott/detection.cpp index fdf659e7b7..d2ed4391d0 100644 --- a/engines/gargoyle/scott/detection.cpp +++ b/engines/gargoyle/scott/detection.cpp @@ -58,6 +58,8 @@ void ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g if (p->_filesize) { // Found a match DetectedGame gd("scott", p->_desc, Common::EN_ANY, Common::kPlatformUnknown, "Scott"); + gd.addExtraEntry("filename", file->getName()); + gameList.push_back(gd); } |