aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/game.cpp')
-rw-r--r--engines/saga/game.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp
index a1bdda6b57..61af35f93f 100644
--- a/engines/saga/game.cpp
+++ b/engines/saga/game.cpp
@@ -77,9 +77,29 @@ DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) {
}
PluginError Engine_SAGA_create(OSystem *syst, Engine **engine) {
+ assert(syst);
assert(engine);
- *engine = new Saga::SagaEngine(syst);
- return kNoError;
+
+ FSList fslist;
+ FilesystemNode dir(ConfMan.get("path"));
+ if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("SagaEngine: invalid game path '%s'", dir.path().c_str());
+ return kInvalidPathError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ DetectedGameList detectedGames = Engine_SAGA_detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameid == gameid) {
+ *engine = new Saga::SagaEngine(syst);
+ return kNoError;
+ }
+ }
+
+ warning("SagaEngine: Unable to locate game data at path '%s'", dir.path().c_str());
+ return kNoGameDataFoundError;
}
REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment");