[Scummvm-cvs-logs] SF.net SVN: scummvm:[53251] scummvm/trunk/engines/sword25

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 00:48:45 CEST 2010


Revision: 53251
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53251&view=rev
Author:   sev
Date:     2010-10-12 22:48:45 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Added possibility to run from extracted game.

Still doesn't start though

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/detection.cpp
    scummvm/trunk/engines/sword25/package/scummvmpackagemanager.cpp
    scummvm/trunk/engines/sword25/sword25.cpp
    scummvm/trunk/engines/sword25/sword25.h

Modified: scummvm/trunk/engines/sword25/detection.cpp
===================================================================
--- scummvm/trunk/engines/sword25/detection.cpp	2010-10-12 22:48:22 UTC (rev 53250)
+++ scummvm/trunk/engines/sword25/detection.cpp	2010-10-12 22:48:45 UTC (rev 53251)
@@ -30,17 +30,7 @@
 #include "sword25/sword25.h"
 
 namespace Sword25 {
-
-struct Sword25GameDescription {
-	ADGameDescription desc;
-
-	uint32 features;
-};
-
-uint32 Sword25Engine::getFeatures() const { return _gameDescription->features; }
-Common::Language Sword25Engine::getLanguage() const { return _gameDescription->desc.language; }
-Common::Platform Sword25Engine::getPlatform() const { return _gameDescription->desc.platform; }
-
+uint32 Sword25Engine::getGameFlags() const { return _gameDescription->flags; }
 }
 
 static const PlainGameDescriptor Sword25Game[] = {
@@ -53,29 +43,43 @@
 // TODO: Need to decide whether we're going to implement code to detect all the various languages allowed,
 // both by the core data package, as well as the extra languages added by the patch file; also, I don't
 // think that all the languages supported by the game currently have constants in ScummVM
-static const Sword25GameDescription gameDescriptions[] = {
+static const ADGameDescription gameDescriptions[] = {
 	{
-		{
-			"sword25",
-			"",
-			AD_ENTRY1s("data.b25c", "f8b6e03ada2d2f6cf27fbc11ad1572e9", 654310588),
-			Common::EN_ANY,
-			Common::kPlatformUnknown,
-			ADGF_NO_FLAGS,
-			Common::GUIO_NONE
-		},
-		0
+		"sword25",
+		"",
+		AD_ENTRY1s("data.b25c", "f8b6e03ada2d2f6cf27fbc11ad1572e9", 654310588),
+		Common::EN_ANY,
+		Common::kPlatformUnknown,
+		ADGF_NO_FLAGS,
+		Common::GUIO_NONE
 	},
-	{ AD_TABLE_END_MARKER, 0 }
+	{
+		"sword25",
+		"Extracted",
+		{{"_includes.lua", 0, 0, -1},
+		 {"boot.lua", 0, 0, -1},
+		 {"kernel.lua", 0, 0, -1},
+		 AD_LISTEND},
+		Common::EN_ANY,
+		Common::kPlatformUnknown,
+		GF_EXTRACTED,
+		Common::GUIO_NONE
+	},
+	AD_TABLE_END_MARKER
 };
 
 } // end of namespace Sword25
 
+static const char *directoryGlobs[] = {
+	"system", // Used by extracted dats
+	0
+};
+
 static const ADParams detectionParams = {
 	// Pointer to ADGameDescription or its superset structure
 	(const byte *)Sword25::gameDescriptions,
 	// Size of that superset structure
-	sizeof(Sword25::Sword25GameDescription),
+	sizeof(ADGameDescription),
 	// Number of bytes to compute MD5 sum for
 	5000,
 	// List of all engine targets
@@ -91,9 +95,9 @@
 	// Additional GUI options (for every game}
 	Common::GUIO_NOMIDI,
 	// Maximum directory depth
-	1,
+	2,
 	// List of directory globs
-	0
+	directoryGlobs
 };
 
 class Sword25MetaEngine : public AdvancedMetaEngine {
@@ -112,11 +116,10 @@
 };
 
 bool Sword25MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
-	const Sword25::Sword25GameDescription *gd = (const Sword25::Sword25GameDescription *)desc;
-	if (gd) {
-		*engine = new Sword25::Sword25Engine(syst, gd);
+	if (desc) {
+		*engine = new Sword25::Sword25Engine(syst, desc);
 	}
-	return gd != 0;
+	return desc != 0;
 }
 
 #if PLUGIN_ENABLED_DYNAMIC(SWORD25)

Modified: scummvm/trunk/engines/sword25/package/scummvmpackagemanager.cpp
===================================================================
--- scummvm/trunk/engines/sword25/package/scummvmpackagemanager.cpp	2010-10-12 22:48:22 UTC (rev 53250)
+++ scummvm/trunk/engines/sword25/package/scummvmpackagemanager.cpp	2010-10-12 22:48:45 UTC (rev 53251)
@@ -120,6 +120,11 @@
 	} else {
 		BS_LOGLN("Directory '%s' mounted as '%s'.", directoryName.c_str(), mountPosition.c_str());
 		_archiveList.push_front(new ArchiveEntry(folderArchive, mountPosition));
+
+		Common::ArchiveMemberList files;
+		folderArchive->listMembers(files);
+		debug(0, "Capacity %d", files.size());
+
 		return true;
 	}
 }

Modified: scummvm/trunk/engines/sword25/sword25.cpp
===================================================================
--- scummvm/trunk/engines/sword25/sword25.cpp	2010-10-12 22:48:22 UTC (rev 53250)
+++ scummvm/trunk/engines/sword25/sword25.cpp	2010-10-12 22:48:45 UTC (rev 53251)
@@ -47,14 +47,12 @@
 
 const char *const PACKAGE_MANAGER = "archiveFS";
 const char *const DEFAULT_SCRIPT_FILE = "/system/boot.lua";
-const char *const MOUNT_DIR_PARAMETER = "-mount-dir";
 
-
 void LogToStdout(const char *Message) {
 	debugN(0, Message);
 }
 
-Sword25Engine::Sword25Engine(OSystem *syst, const Sword25GameDescription *gameDesc):
+Sword25Engine::Sword25Engine(OSystem *syst, const ADGameDescription *gameDesc):
 	Engine(syst),
 	_gameDescription(gameDesc) {
 }
@@ -104,8 +102,8 @@
 	}
 
 	// Packages laden oder das aktuelle Verzeichnis mounten, wenn das \xFCber Kommandozeile angefordert wurde.
-	if (find(CommandParameters.begin(), CommandParameters.end(), MOUNT_DIR_PARAMETER) != CommandParameters.end()) {
-		if (!PackageManagerPtr->LoadDirectoryAsPackage(".", "/"))
+	if (getGameFlags() & GF_EXTRACTED) {
+		if (!PackageManagerPtr->LoadDirectoryAsPackage(ConfMan.get("path"), "/"))
 			return Common::kUnknownError;
 	} else {
 		if (!LoadPackages())

Modified: scummvm/trunk/engines/sword25/sword25.h
===================================================================
--- scummvm/trunk/engines/sword25/sword25.h	2010-10-12 22:48:22 UTC (rev 53250)
+++ scummvm/trunk/engines/sword25/sword25.h	2010-10-12 22:48:45 UTC (rev 53251)
@@ -33,6 +33,8 @@
 
 #include "sword25/kernel/log.h"
 
+struct ADGameDescription;
+
 namespace Sword25 {
 
 enum {
@@ -43,12 +45,14 @@
 	kDebugScript = 1 << 0
 };
 
+enum GameFlags {
+	GF_EXTRACTED = 1 << 0
+};
+
 #define MESSAGE_BASIC 1
 #define MESSAGE_INTERMEDIATE 2
 #define MESSAGE_DETAILED 3
 
-struct Sword25GameDescription;
-
 class Sword25Engine : public Engine {
 private:
 	Common::Error AppStart(const Common::StringArray &CommandParameters);
@@ -61,15 +65,12 @@
 	void shutdown();
 
 public:
-	Sword25Engine(OSystem *syst, const Sword25GameDescription *gameDesc);
+	Sword25Engine(OSystem *syst, const ADGameDescription *gameDesc);
 	virtual ~Sword25Engine();
 
-	int getGameType() const;
-	uint32 getFeatures() const;
-	Common::Language getLanguage() const;
-	Common::Platform getPlatform() const;
+	uint32 getGameFlags() const;
 
-	const Sword25GameDescription *_gameDescription;
+	const ADGameDescription *_gameDescription;
 };
 
 } // End of namespace Sword25


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