aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2007-09-23 22:15:22 +0000
committerPaul Gilbert2007-09-23 22:15:22 +0000
commitffa264b9f747a539c898d38a8b944326291b255a (patch)
treef5686649ee9b2bfbd859049b4fc36693a6849a77 /engines
parent01bfaaa76544856f476c928f11448831de43f6d0 (diff)
downloadscummvm-rg350-ffa264b9f747a539c898d38a8b944326291b255a.tar.gz
scummvm-rg350-ffa264b9f747a539c898d38a8b944326291b255a.tar.bz2
scummvm-rg350-ffa264b9f747a539c898d38a8b944326291b255a.zip
Added support for the lure.dat file now containing multiple language versions
svn-id: r29071
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/disk.cpp34
-rw-r--r--engines/lure/disk.h2
2 files changed, 34 insertions, 2 deletions
diff --git a/engines/lure/disk.cpp b/engines/lure/disk.cpp
index d1a7239c4c..db0db77ba9 100644
--- a/engines/lure/disk.cpp
+++ b/engines/lure/disk.cpp
@@ -30,6 +30,7 @@
#include "common/scummsys.h"
#include "lure/disk.h"
+#include "lure/lure.h"
#include "lure/luredefs.h"
#include "lure/res.h"
@@ -97,10 +98,39 @@ void Disk::openFile(uint8 fileNum) {
if (!_fileHandle->isOpen())
error("Could not open %s", sFilename);
- // Validate the header
char buffer[7];
uint32 bytesRead;
+ // If it's the support file, then move to the correct language area
+
+ _dataOffset = 0;
+ if (_fileNum == 0) {
+ // Validate overall header
+ _fileHandle->read(buffer, 6);
+ buffer[4] = '\0';
+
+ if (strcmp(buffer, SUPPORT_IDENT_STRING) != 0)
+ error("The file %s is not a valid Lure support file", sFilename);
+
+ // Scan for the correct language block
+ Common::Language language = LureEngine::getReference().getLanguage();
+ bool foundFlag = false;
+
+ while (!foundFlag) {
+ _fileHandle->read(buffer, 5);
+ if ((byte)buffer[0] == 0xff)
+ error("Could not find language data in support file");
+
+ if ((language == (Common::Language)buffer[0]) || (language == UNK_LANG)) {
+ foundFlag = true;
+ _dataOffset = READ_LE_UINT32(&buffer[1]);
+ _fileHandle->seek(_dataOffset);
+ }
+ }
+ }
+
+ // Validate the header
+
bytesRead = _fileHandle->read(buffer, 6);
buffer[6] = '\0';
if (strcmp(buffer, HEADER_IDENT_STRING) != 0)
@@ -159,7 +189,7 @@ MemoryBlock *Disk::getEntry(uint16 id) {
// Calculate the offset and size of the entry
uint32 size = (uint32) _entries[index].size;
if (_entries[index].sizeExtension) size += 0x10000;
- uint32 offset = (uint32) _entries[index].offset * 0x20;
+ uint32 offset = (uint32) _entries[index].offset * 0x20 + _dataOffset;
MemoryBlock *result = Memory::allocate(size);
_fileHandle->seek(offset, SEEK_SET);
diff --git a/engines/lure/disk.h b/engines/lure/disk.h
index 5e5717112c..afa999d319 100644
--- a/engines/lure/disk.h
+++ b/engines/lure/disk.h
@@ -40,11 +40,13 @@ namespace Lure {
#define NUM_ENTRIES_IN_HEADER 0xBF
#define HEADER_IDENT_STRING "heywow"
+#define SUPPORT_IDENT_STRING "lure"
#define HEADER_ENTRY_UNUSED_ID 0xffff
class Disk {
private:
uint8 _fileNum;
+ uint32 _dataOffset;
Common::File *_fileHandle;
FileEntry _entries[NUM_ENTRIES_IN_HEADER];