[Scummvm-cvs-logs] SF.net SVN: scummvm: [29071] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Mon Sep 24 00:15:22 CEST 2007
Revision: 29071
http://scummvm.svn.sourceforge.net/scummvm/?rev=29071&view=rev
Author: dreammaster
Date: 2007-09-23 15:15:22 -0700 (Sun, 23 Sep 2007)
Log Message:
-----------
Added support for the lure.dat file now containing multiple language versions
Modified Paths:
--------------
scummvm/trunk/engines/lure/disk.cpp
scummvm/trunk/engines/lure/disk.h
Modified: scummvm/trunk/engines/lure/disk.cpp
===================================================================
--- scummvm/trunk/engines/lure/disk.cpp 2007-09-23 22:14:45 UTC (rev 29070)
+++ scummvm/trunk/engines/lure/disk.cpp 2007-09-23 22:15:22 UTC (rev 29071)
@@ -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 @@
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 @@
// 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);
Modified: scummvm/trunk/engines/lure/disk.h
===================================================================
--- scummvm/trunk/engines/lure/disk.h 2007-09-23 22:14:45 UTC (rev 29070)
+++ scummvm/trunk/engines/lure/disk.h 2007-09-23 22:15:22 UTC (rev 29071)
@@ -40,11 +40,13 @@
#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];
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