aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-16 15:16:36 +0000
committerEugene Sandulenko2010-10-12 22:48:45 +0000
commita21b148a9b0f6b6d26a7cec996163515efcb7ec3 (patch)
treeb4b283c2ca7b42d36550d5164b85dcb6030c8c8b
parenta87dbb4c609780030f2d330bcf1d9937c1440bd6 (diff)
downloadscummvm-rg350-a21b148a9b0f6b6d26a7cec996163515efcb7ec3.tar.gz
scummvm-rg350-a21b148a9b0f6b6d26a7cec996163515efcb7ec3.tar.bz2
scummvm-rg350-a21b148a9b0f6b6d26a7cec996163515efcb7ec3.zip
SWORD25: Added possibility to run from extracted game.
Still doesn't start though svn-id: r53251
-rw-r--r--engines/sword25/detection.cpp63
-rw-r--r--engines/sword25/package/scummvmpackagemanager.cpp5
-rw-r--r--engines/sword25/sword25.cpp8
-rw-r--r--engines/sword25/sword25.h17
4 files changed, 50 insertions, 43 deletions
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index 0cad18d4d7..e210f4d27c 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -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 @@ namespace Sword25 {
// 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 @@ static const ADParams detectionParams = {
// 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 @@ public:
};
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)
diff --git a/engines/sword25/package/scummvmpackagemanager.cpp b/engines/sword25/package/scummvmpackagemanager.cpp
index 6d96709264..ffd833e9b9 100644
--- a/engines/sword25/package/scummvmpackagemanager.cpp
+++ b/engines/sword25/package/scummvmpackagemanager.cpp
@@ -120,6 +120,11 @@ bool BS_ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &dire
} 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;
}
}
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index 5853cae77d..74b12d6108 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -47,14 +47,12 @@ namespace Sword25 {
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 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete
}
// Packages laden oder das aktuelle Verzeichnis mounten, wenn das über 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())
diff --git a/engines/sword25/sword25.h b/engines/sword25/sword25.h
index f4dc9f829f..30d9cc2c12 100644
--- a/engines/sword25/sword25.h
+++ b/engines/sword25/sword25.h
@@ -33,6 +33,8 @@
#include "sword25/kernel/log.h"
+struct ADGameDescription;
+
namespace Sword25 {
enum {
@@ -43,12 +45,14 @@ enum {
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 @@ protected:
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