aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/detection.cpp28
-rw-r--r--engines/kyra/lol.cpp7
-rw-r--r--engines/kyra/resource.cpp64
3 files changed, 80 insertions, 19 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index f8aa44be63..160a60d6f4 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",
@@ -696,7 +702,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 +845,24 @@ 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
+ },
+
+ /* disable these targets until they get supported
+ {
{
"lol",
0,
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index a3ad01ce50..6624dd91ea 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -259,11 +259,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..d3b66ba6c6 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;
}
@@ -1257,10 +1260,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 +1279,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 +1319,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 +1335,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 +1381,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 +1393,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 +1416,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 +1450,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 +1466,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 +1494,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 +1533,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 {