From af3241f70035db44a7510d4558a52bd7e1e92722 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 4 Aug 2006 09:46:40 +0000 Subject: Run the Cine engine's game detector before starting a game, to ensure that it really is there. I hope this is the right way of fixing bug #1534073. svn-id: r23660 --- engines/cine/cine.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 6223c64398..e02c04d7cf 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -112,9 +112,29 @@ DetectedGameList Engine_CINE_detectGames(const FSList &fslist) { } PluginError Engine_CINE_create(OSystem *syst, Engine **engine) { + assert(syst); assert(engine); - *engine = new Cine::CineEngine(syst); - return kNoError; + + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + warning("CineEngine: invalid game path '%s'", dir.path().c_str()); + return kInvalidPathError; + } + + // Invoke the detector + Common::String gameid = ConfMan.get("gameid"); + DetectedGameList detectedGames = Engine_CINE_detectGames(fslist); + + for (uint i = 0; i < detectedGames.size(); i++) { + if (detectedGames[i].gameid == gameid) { + *engine = new Cine::CineEngine(syst); + return kNoError; + } + } + + warning("CineEngine: Unable to locate game data at path '%s'", dir.path().c_str()); + return kNoGameDataFoundError; } REGISTER_PLUGIN(CINE, "CINE Engine", "TODO (C) TODO"); -- cgit v1.2.3