[Scummvm-cvs-logs] SF.net SVN: scummvm: [23741] scummvm/trunk/engines/sword2/sword2.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Wed Aug 23 06:26:09 CEST 2006
Revision: 23741
Author: eriktorbjorn
Date: 2006-08-22 21:26:01 -0700 (Tue, 22 Aug 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23741&view=rev
Log Message:
-----------
Run the game detector before creating the engine. This is based entirely on a
recent change to the CINE engine (which in turn was based on some other engine,
I forget which), and should fix bug #1544796. Of course, given how primitive
the Broken Sword 2 detector is, it's easy to fool it. There isn't really any
need for it to be smart, though.
Modified Paths:
--------------
scummvm/trunk/engines/sword2/sword2.cpp
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2006-08-21 21:29:30 UTC (rev 23740)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2006-08-23 04:26:01 UTC (rev 23741)
@@ -111,9 +111,29 @@
}
PluginError Engine_SWORD2_create(OSystem *syst, Engine **engine) {
+ assert(syst);
assert(engine);
- *engine = new Sword2::Sword2Engine(syst);
- return kNoError;
+
+ FSList fslist;
+ FilesystemNode dir(ConfMan.get("path"));
+ if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("Sword2Engine: invalid game path '%s'", dir.path().c_str());
+ return kInvalidPathError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ DetectedGameList detectedGames = Engine_SWORD2_detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameid == gameid) {
+ *engine = new Sword2::Sword2Engine(syst);
+ return kNoError;
+ }
+ }
+
+ warning("Sword2Engine: Unable to locate game data at path '%s'", dir.path().c_str());
+ return kNoGameDataFoundError;
}
REGISTER_PLUGIN(SWORD2, "Broken Sword 2", "Broken Sword Games (C) Revolution");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list