aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2013-05-22 14:00:47 +1000
committerPaul Gilbert2013-05-22 14:00:47 +1000
commit7c85f94a57e74cdac6193db043fc9233f3fa6905 (patch)
tree8b42d839c06da0bfdf96274bba3b8337e8583e53
parentca0eb9bd758e35b52f64eb84d225c2b0ffe3f921 (diff)
downloadscummvm-rg350-7c85f94a57e74cdac6193db043fc9233f3fa6905.tar.gz
scummvm-rg350-7c85f94a57e74cdac6193db043fc9233f3fa6905.tar.bz2
scummvm-rg350-7c85f94a57e74cdac6193db043fc9233f3fa6905.zip
VOYEUR: First group's members are now successfully decompressed
-rw-r--r--engines/voyeur/files.cpp18
-rw-r--r--engines/voyeur/files.h1
2 files changed, 10 insertions, 9 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 472d69062c..7d6a11e2d3 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -56,7 +56,6 @@ int BoltFile::_bufferEnd = 0;
int BoltFile::_bufferBegin = 0;
int BoltFile::_bytesLeft = 0;
int BoltFile::_bufSize = 0;
-byte *BoltFile::_bufP = NULL;
byte *BoltFile::_bufStart = NULL;
byte *BoltFile::_bufPos = NULL;
byte BoltFile::_decompressBuf[DECOMPRESS_SIZE];
@@ -165,14 +164,13 @@ byte *BoltFile::getBoltMember(uint32 id) {
_bufSize = ((_bufPos - _bufStart) << 16) >> 16; // TODO: Validate this
_bytesLeft = _bufSize;
}
-
- _decompState = 0;
- _historyIndex = 0;
- initType();
}
- //TODO
- return NULL;
+ _decompState = 0;
+ _historyIndex = 0;
+ initType();
+
+ return _curMemberPtr->_data;
}
void BoltFile::initType() {
@@ -182,7 +180,7 @@ void BoltFile::initType() {
#define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
byte *BoltFile::decompress(byte *buf, int size, int mode) {
- if (buf)
+ if (!buf)
buf = new byte[size];
byte *bufP = buf;
@@ -246,6 +244,9 @@ byte *BoltFile::decompress(byte *buf, int size, int mode) {
_runOffset += len;
}
+ // Reduce the remaining size
+ size -= len;
+
// Handle the run lengths
switch (_runType) {
case 0:
@@ -265,6 +266,7 @@ byte *BoltFile::decompress(byte *buf, int size, int mode) {
default:
while (len-- > 0) {
_historyBuffer[_historyIndex] = _runValue;
+ *bufP++ = _runValue;
_historyIndex = (_historyIndex + 1) & 0x1ff;
}
break;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index b481a08a06..ed20528a5f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -49,7 +49,6 @@ private:
static int _bufferBegin;
static int _bytesLeft;
static int _bufSize;
- static byte *_bufP;
static byte *_bufStart;
static byte *_bufPos;
static byte _decompressBuf[DECOMPRESS_SIZE];