aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorChristopher Page2008-08-16 04:30:01 +0000
committerChristopher Page2008-08-16 04:30:01 +0000
commit909b66ef54f8d6d6dfeb0fdee2aa018f2065b6c9 (patch)
treec2f2668391fa3026a6a79b38ebfad797ce1b376c /engines/kyra
parentc22f9b23588121d41fe0a12ce44926d683d7a18d (diff)
parentf2111eeb45dc8c41afb3e63bf3b86a09bf9a3532 (diff)
downloadscummvm-rg350-909b66ef54f8d6d6dfeb0fdee2aa018f2065b6c9.tar.gz
scummvm-rg350-909b66ef54f8d6d6dfeb0fdee2aa018f2065b6c9.tar.bz2
scummvm-rg350-909b66ef54f8d6d6dfeb0fdee2aa018f2065b6c9.zip
Merged revisions 33777,33781-33788,33790,33792-33793,33795,33797,33805,33807-33812,33815-33817,33819,33822,33826,33829,33837,33839,33844,33847,33858-33861,33864,33871-33873,33875,33877-33879,33886,33889-33892,33894,33896,33900,33902-33903,33919 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk svn-id: r33924
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/detection.cpp127
-rw-r--r--engines/kyra/lol.cpp7
-rw-r--r--engines/kyra/resource.cpp135
3 files changed, 216 insertions, 53 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 78b0863ac5..f5b3f582f4 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -67,11 +67,14 @@ namespace {
#define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, true, false, Kyra::GI_KYRA3)
#define LOL_CD_FLAGS FLAGS(false, false, true, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, true, Kyra::GI_LOL)
#define LOL_PC98_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL)
#define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, true, false, false, Kyra::GI_LOL)
#define LOL_DEMO_FLAGS FLAGS(true, false, false, false, false, false, Kyra::GI_KYRA2)
const KYRAGameDescription adGameDescs[] = {
+ /* disable these targets until they get supported
{
{
"kyra1",
@@ -83,6 +86,7 @@ const KYRAGameDescription adGameDescs[] = {
},
KYRA1_FLOPPY_CMP_FLAGS
},
+
{
{
"kyra1",
@@ -94,6 +98,8 @@ const KYRAGameDescription adGameDescs[] = {
},
KYRA1_FLOPPY_CMP_FLAGS
},
+ */
+
{
{
"kyra1",
@@ -460,6 +466,42 @@ const KYRAGameDescription adGameDescs[] = {
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
+ {
+ {
+ "kyra2",
+ "CD",
+ AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"),
+ Common::IT_ITA,
+ Common::kPlatformPC,
+ Common::ADGF_DROPLANGUAGE | Common::ADGF_CD
+ },
+ KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
+ },
+
+ {
+ {
+ "kyra2",
+ "CD",
+ AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"),
+ Common::DE_DEU,
+ Common::kPlatformPC,
+ Common::ADGF_DROPLANGUAGE | Common::ADGF_CD
+ },
+ KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
+ },
+
+ {
+ {
+ "kyra2",
+ "CD",
+ AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"),
+ Common::FR_FRA,
+ Common::kPlatformPC,
+ Common::ADGF_DROPLANGUAGE | Common::ADGF_CD
+ },
+ KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
+ },
+
{ // Interactive Demo
{
"kyra2",
@@ -649,6 +691,53 @@ const KYRAGameDescription adGameDescs[] = {
KYRA3_CD_INS_FLAGS
},
+ // Mac version
+ {
+ {
+ "kyra3",
+ 0,
+ {
+ { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 },
+ { "AUD.PAK", 0, 0, -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ Common::ADGF_DROPLANGUAGE
+ },
+ KYRA3_CD_INS_FLAGS
+ },
+ {
+ {
+ "kyra3",
+ 0,
+ {
+ { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 },
+ { "AUD.PAK", 0, 0, -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::DE_DEU,
+ Common::kPlatformMacintosh,
+ Common::ADGF_DROPLANGUAGE
+ },
+ KYRA3_CD_INS_FLAGS
+ },
+ {
+ {
+ "kyra3",
+ 0,
+ {
+ { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 },
+ { "AUD.PAK", 0, 0, -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::FR_FRA,
+ Common::kPlatformMacintosh,
+ Common::ADGF_DROPLANGUAGE
+ },
+ KYRA3_CD_INS_FLAGS
+ },
+
// Spanish fan translation, see fr#1994040 "KYRA3: Add support for Spanish fan translation"
{
{
@@ -696,7 +785,7 @@ const KYRAGameDescription adGameDescs[] = {
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
- // Itlian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3"
+ // Italian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3"
{
{
"kyra3",
@@ -839,8 +928,40 @@ const KYRAGameDescription adGameDescs[] = {
},
LOL_CD_FLAGS
},
-
- /*{
+
+ {
+ {
+ "lol",
+ 0,
+ {
+ { "WESTWOOD.1", 0, "3c61cb7de5b2ec452f5851f5075207ee", -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::DE_DEU,
+ Common::kPlatformPC,
+ Common::ADGF_NO_FLAGS
+ },
+ LOL_FLOPPY_CMP_FLAGS
+ },
+
+ {
+ {
+ "lol",
+ "Extracted",
+ {
+ { "GENERAL.PAK", 0, "996e66e81054d36249907a1d8158da3d", -1 },
+ { "CHAPTER7.PAK", 0, "cabee57f00d6d84b65a732b6868a4959", -1 },
+ { 0, 0, 0, 0 }
+ },
+ Common::DE_DEU,
+ Common::kPlatformPC,
+ Common::ADGF_NO_FLAGS
+ },
+ LOL_FLOPPY_FLAGS
+ },
+
+ /* disable these targets until they get supported
+ {
{
"lol",
0,
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 2011f65b3e..b9cb7bcc0b 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -255,11 +255,14 @@ void LoLEngine::setupPrologueData(bool load) {
"xxx/intro9.pak"
};
- char filename[32];
+ char filepath[32];
+ char *filename = filepath;
for (uint i = 0; i < ARRAYSIZE(fileList); ++i) {
strcpy(filename, fileList[i]);
memcpy(filename, _languageExt[_lang], 3);
-
+ if (!_flags.isTalkie)
+ filename += 4;
+
if (load) {
if (!_res->loadPakFile(filename))
error("Couldn't load file: '%s'", filename);
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 91150ad354..5da6bb3873 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -103,6 +103,9 @@ bool Resource::reset() {
return true;
} else if (_vm->game() == GI_LOL) {
+ if (_vm->gameFlags().useInstallerPackage)
+ tryLoadCompFiles();
+
return true;
}
@@ -181,8 +184,14 @@ bool Resource::loadPakFile(const Common::String &filename) {
for (ResArchiveLoader::FileList::iterator i = files.begin(); i != files.end(); ++i) {
iter = _map.find(i->filename);
if (iter == _map.end()) {
+ // We do an internal check for a file in gamepath with same filename to
+ // allow overwriting files inside archives with plain files inside the
+ // game directory
+ checkFile(i->filename);
+
// A new file entry, so we just insert it into the file map.
- _map[i->filename] = i->entry;
+ if (_map.find(i->filename) == _map.end())
+ _map[i->filename] = i->entry;
} else if (!iter->_value.parent.empty()) {
if (!iter->_value.parent.equalsIgnoreCase(filename)) {
ResFileMap::iterator oldParent = _map.find(iter->_value.parent);
@@ -350,7 +359,17 @@ bool Resource::loadFileToBuf(const char *file, void *buf, uint32 maxSize) {
Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) {
CompFileMap::iterator compEntry;
- if (Common::File::exists(file)) {
+ if ((compEntry = _compFiles.find(file)) != _compFiles.end())
+ return new Common::MemoryReadStream(compEntry->_value.data, compEntry->_value.size, false);
+
+ if (!isAccessable(file))
+ return 0;
+
+ ResFileMap::const_iterator iter = _map.find(file);
+ if (iter == _map.end())
+ return 0;
+
+ if (iter->_value.parent.empty()) {
Common::File *stream = new Common::File();
if (!stream->open(file)) {
delete stream;
@@ -358,28 +377,15 @@ Common::SeekableReadStream *Resource::getFileStream(const Common::String &file)
error("Couldn't open file '%s'", file.c_str());
}
return stream;
- } else if ((compEntry = _compFiles.find(file)) != _compFiles.end()) {
- return new Common::MemoryReadStream(compEntry->_value.data, compEntry->_value.size, false);
} else {
- if (!isAccessable(file))
- return 0;
-
- ResFileMap::const_iterator iter = _map.find(file);
- if (iter == _map.end())
- return 0;
+ Common::SeekableReadStream *parent = getFileStream(iter->_value.parent);
+ assert(parent);
- if (!iter->_value.parent.empty()) {
- Common::SeekableReadStream *parent = getFileStream(iter->_value.parent);
- assert(parent);
-
- ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent);
- const ResArchiveLoader *loader = getLoader(parentIter->_value.type);
- assert(loader);
+ ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent);
+ const ResArchiveLoader *loader = getLoader(parentIter->_value.type);
+ assert(loader);
- return loader->loadFileFromArchive(file, parent, iter->_value);
- } else {
- error("Couldn't open file '%s'", file.c_str());
- }
+ return loader->loadFileFromArchive(file, parent, iter->_value);
}
return 0;
@@ -411,7 +417,19 @@ void Resource::checkFile(const Common::String &file) {
if (_map.find(file) == _map.end()) {
CompFileMap::const_iterator iter;
- if (Common::File::exists(file)) {
+ if ((iter = _compFiles.find(file)) != _compFiles.end()) {
+ ResFileEntry entry;
+ entry.parent = "";
+ entry.size = iter->_value.size;
+ entry.mounted = false;
+ entry.preload = false;
+ entry.prot = false;
+ entry.type = ResFileEntry::kAutoDetect;
+ entry.offset = 0;
+ _map[file] = entry;
+
+ detectFileTypes();
+ } else if (Common::File::exists(file)) {
Common::File temp;
if (temp.open(file)) {
ResFileEntry entry;
@@ -427,18 +445,6 @@ void Resource::checkFile(const Common::String &file) {
detectFileTypes();
}
- } else if ((iter = _compFiles.find(file)) != _compFiles.end()) {
- ResFileEntry entry;
- entry.parent = "";
- entry.size = iter->_value.size;
- entry.mounted = false;
- entry.preload = false;
- entry.prot = false;
- entry.type = ResFileEntry::kAutoDetect;
- entry.offset = 0;
- _map[file] = entry;
-
- detectFileTypes();
}
}
}
@@ -1257,10 +1263,17 @@ uint8 FileExpander::calcCmdAndIndex(const uint8 *tbl, int16 &para) {
class CompLoaderInsHof : public CompArchiveLoader {
public:
- bool checkForFiles() const;
- bool loadFile(CompFileMap &loadTo) const;
+ CompLoaderInsHof() {
+ _fileExtP = "%03d";
+ _checkFile1 = "WESTWOOD.001";
+ _checkFile2 = "WESTWOOD.002";
+ _containerOffset = 6;
+ }
-private:
+ virtual bool checkForFiles() const;
+ virtual bool loadFile(CompFileMap &loadTo) const;
+
+protected:
struct Archive {
Common::String filename;
uint32 firstFile;
@@ -1269,10 +1282,25 @@ private:
uint32 endOffset;
uint32 totalSize;
};
+
+ const char *_fileExtP;
+ const char *_checkFile1;
+ const char *_checkFile2;
+ uint8 _containerOffset;
+};
+
+class CompLoaderInsLol : public CompLoaderInsHof {
+public:
+ CompLoaderInsLol() {
+ _fileExtP = "%d";
+ _checkFile1 = "WESTWOOD.1";
+ _checkFile2 = "WESTWOOD.2";
+ _containerOffset = 0;
+ }
};
bool CompLoaderInsHof::checkForFiles() const {
- return (Common::File::exists("WESTWOOD.001") && Common::File::exists("WESTWOOD.002"));
+ return (Common::File::exists(_checkFile1) && Common::File::exists(_checkFile2));
}
bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
@@ -1294,7 +1322,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
Common::List<Archive> archives;
for (int8 currentFile = 1; currentFile; currentFile++) {
- sprintf(filenameExt, "%03d", currentFile);
+ sprintf(filenameExt, _fileExtP, currentFile);
filenameTemp = filenameBase + Common::String(filenameExt);
if (!tmpFile.open(filenameTemp)) {
@@ -1310,9 +1338,9 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
if (startFile) {
size -= 4;
if (fileId == currentFile) {
- size -= 6;
- pos += 6;
- tmpFile.seek(6, SEEK_CUR);
+ size -= _containerOffset;
+ pos += _containerOffset;
+ tmpFile.seek(_containerOffset, SEEK_CUR);
} else {
size = size + 1 - pos;
}
@@ -1356,6 +1384,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
uint8 *outbuffer = 0;
uint32 inPart1 = 0;
uint32 inPart2 = 0;
+ uint8 compressionType = 0;
Common::String entryStr;
pos = 0;
@@ -1367,7 +1396,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
for (Common::List<Archive>::iterator a = archives.begin(); a != archives.end(); ++a) {
startFile = true;
for (uint32 i = a->firstFile; i != (a->lastFile + 1); i++) {
- sprintf(filenameExt, "%03d", i);
+ sprintf(filenameExt, _fileExtP, i);
filenameTemp = a->filename + Common::String(filenameExt);
if (!tmpFile.open(filenameTemp)) {
@@ -1390,7 +1419,12 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
tmpFile.seek(1);
tmpFile.read(inbuffer + inPart1, inPart2);
inPart2 = 0;
- exp.process(outbuffer, inbuffer, outsize, insize);
+
+ if (compressionType > 0)
+ exp.process(outbuffer, inbuffer, outsize, insize);
+ else
+ memcpy(outbuffer, inbuffer, outsize);
+
delete[] inbuffer;
inbuffer = 0;
newEntry.data = outbuffer;
@@ -1419,7 +1453,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
}
}
- sprintf(filenameExt, "%03d", i + 1);
+ sprintf(filenameExt, _fileExtP, i + 1);
filenameTemp = a->filename + Common::String(filenameExt);
Common::File tmpFile2;
@@ -1435,8 +1469,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
uint32 id = READ_LE_UINT32(hdr);
if (id == 0x04034B50) {
- if (hdr[8] != 8)
- error("compression type not implemented");
+ compressionType = hdr[8];
insize = READ_LE_UINT32(hdr + 18);
outsize = READ_LE_UINT32(hdr + 22);
@@ -1464,7 +1497,12 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
} else {
tmpFile.read(inbuffer, insize);
inPart2 = 0;
- exp.process(outbuffer, inbuffer, outsize, insize);
+
+ if (compressionType > 0)
+ exp.process(outbuffer, inbuffer, outsize, insize);
+ else
+ memcpy(outbuffer, inbuffer, outsize);
+
delete[] inbuffer;
inbuffer = 0;
newEntry.data = outbuffer;
@@ -1498,6 +1536,7 @@ void Resource::initializeLoaders() {
_loaders.push_back(LoaderList::value_type(new ResLoaderTlk()));
_compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsHof()));
+ _compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsLol()));
}
const ResArchiveLoader *Resource::getLoader(ResFileEntry::kType type) const {