aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 0ba9f7c122..4bc85bc5b4 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -635,9 +635,29 @@ DetectedGameList Engine_AGI_detectGames(const FSList &fslist) {
}
PluginError Engine_AGI_create(OSystem *syst, Engine **engine) {
+ assert(syst);
assert(engine);
- *engine = new Agi::AgiEngine(syst);
- return kNoError;
+
+ FSList fslist;
+ FilesystemNode dir(ConfMan.get("path"));
+ if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("AgiEngine: invalid game path '%s'", dir.path().c_str());
+ return kInvalidPathError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ DetectedGameList detectedGames = Engine_AGI_detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameid == gameid) {
+ *engine = new Agi::AgiEngine(syst);
+ return kNoError;
+ }
+ }
+
+ warning("AgiEngine: Unable to locate game data at path '%s'", dir.path().c_str());
+ return kNoGameDataFoundError;
}
REGISTER_PLUGIN(AGI, "AGI Engine", "TODO (C) TODO");