[Scummvm-cvs-logs] scummvm master -> f1b25497d185ff63205f07b6fbec0da4b83a009e

sev- sev at scummvm.org
Sun Aug 21 11:24:25 CEST 2016


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9f05f7821e DIRECTOR: Lingo: Fix crash at the quit
fdd2c5fb60 DIRECTOR: Added image dumping at debug
79995f6222 DIRECTOR: Stub for 1bpp bitmap decoder
f1b25497d1 DIRECTOR: Naive implementation for 1bpp image decoder. Not yet working


Commit: 9f05f7821e1fe5131ee3df191a8c44269d162790
    https://github.com/scummvm/scummvm/commit/9f05f7821e1fe5131ee3df191a8c44269d162790
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-21T11:24:11+02:00

Commit Message:
DIRECTOR: Lingo: Fix crash at the quit

Changed paths:
    engines/director/resource.cpp



diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index fdb0712..aef7d39 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -59,7 +59,11 @@ bool Archive::openFile(const Common::String &fileName) {
 
 void Archive::close() {
 	_types.clear();
-	delete _stream; _stream = 0;
+
+	if (_stream)
+		delete _stream;
+
+	_stream = 0;
 }
 
 bool Archive::hasResource(uint32 tag, uint16 id) const {


Commit: fdd2c5fb609585eb1eb7fb56f678693c4cac1a30
    https://github.com/scummvm/scummvm/commit/fdd2c5fb609585eb1eb7fb56f678693c4cac1a30
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-21T11:24:11+02:00

Commit Message:
DIRECTOR: Added image dumping at debug

Changed paths:
    engines/director/director.cpp
    engines/director/director.h
    engines/director/lingo/lingo.h
    engines/director/score.cpp



diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index ddc5adc..4898994 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -52,6 +52,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
 		_rnd("director") {
 	DebugMan.addDebugChannel(kDebugLingoExec, "lingoexec", "Lingo Execution");
 	DebugMan.addDebugChannel(kDebugLingoCompile, "lingocompile", "Lingo Compilation");
+	DebugMan.addDebugChannel(kDebugLoading, "loading", "Loading");
 
 	if (!_mixer->isReady())
 		error("Sound initialization failed");
diff --git a/engines/director/director.h b/engines/director/director.h
index 6208df2..cccae8f 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -53,6 +53,13 @@ class Lingo;
 class Score;
 struct Cast;
 
+enum {
+	kDebugLingoExec		= 1 << 0,
+	kDebugLingoCompile	= 1 << 1,
+	kDebugLoading		= 1 << 2
+};
+
+
 class DirectorEngine : public ::Engine {
 public:
 	DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 2cc1a09..5f4eb78 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -35,11 +35,6 @@
 
 namespace Director {
 
-enum {
-	kDebugLingoExec		= 1 << 0,
-	kDebugLingoCompile	= 1 << 1
-};
-
 enum LEvent {
 	kEventPrepareMovie,
 	kEventStartMovie,
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 2cdff84..231cb41 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1340,6 +1340,14 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 
 	if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
 		img = new Image::BitmapDecoder();
+
+		if (debugChannelSet(8, kDebugLoading)) {
+			Common::SeekableReadStream *s = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
+			byte buf[1024];
+			int n = s->read(buf, 1024);
+			Common::hexdump(buf, n);
+		}
+
 		img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId));
 		return img;
 	}


Commit: 79995f6222530c49d6bc5b46a3b5939af6ae093a
    https://github.com/scummvm/scummvm/commit/79995f6222530c49d6bc5b46a3b5939af6ae093a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-21T11:24:11+02:00

Commit Message:
DIRECTOR: Stub for 1bpp bitmap decoder

Changed paths:
  A engines/director/images.cpp
  A engines/director/images.h
  R engines/director/dib.cpp
  R engines/director/dib.h
    engines/director/director.cpp
    engines/director/module.mk
    engines/director/score.cpp



diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
deleted file mode 100644
index 04665e7..0000000
--- a/engines/director/dib.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "director/dib.h"
-
-#include "common/stream.h"
-#include "common/substream.h"
-#include "common/textconsole.h"
-#include "graphics/pixelformat.h"
-#include "graphics/surface.h"
-#include "graphics/palette.h"
-#include "image/codecs/codec.h"
-#include "common/util.h"
-#include "common/debug.h"
-#include "image/codecs/bmp_raw.h"
-#include "common/system.h"
-
-namespace Director {
-
-DIBDecoder::DIBDecoder() {
-	_surface = 0;
-	_palette = 0;
-	_paletteColorCount = 0;
-	_codec = 0;
-}
-
-DIBDecoder::~DIBDecoder() {
-	destroy();
-}
-
-void DIBDecoder::destroy() {
-	_surface = 0;
-
-	delete[] _palette;
-	_palette = 0;
-	_paletteColorCount = 0;
-
-	delete _codec;
-	_codec = 0;
-}
-
-void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
-	uint16 steps = stream.size() / 6;
-	uint16 index = (steps * 3) - 1;
-	_paletteColorCount = steps;
-	_palette = new byte[index + 1];
-
-	for (uint8 i = 0; i < steps; i++) {
-		_palette[index - 2] = stream.readByte();
-		stream.readByte();
-
-		_palette[index - 1] = stream.readByte();
-		stream.readByte();
-
-		_palette[index] = stream.readByte();
-		stream.readByte();
-		index -= 3;
-	}
-}
-
-bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
-	uint32 headerSize = stream.readUint32LE();
-	if (headerSize != 40)
-		return false;
-
-	uint32 width = stream.readUint32LE();
-	uint32 height = stream.readUint32LE();
-	stream.readUint16LE(); // planes
-	uint16 bitsPerPixel = stream.readUint16LE();
-	uint32 compression = stream.readUint32BE();
-	uint32 imageSize = stream.readUint32LE();
-	/* uint32 pixelsPerMeterX = */ stream.readUint32LE();
-	/* uint32 pixelsPerMeterY = */ stream.readUint32LE();
-	_paletteColorCount = stream.readUint32LE();
-	/* uint32 colorsImportant = */ stream.readUint32LE();
-
-	_paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
-
-	uint16 imageRawSize = stream.size() - 40;
-	Common::SeekableSubReadStream subStream(&stream, 40, stream.size());
-
-	_codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);
-
-	if (!_codec)
-		return false;
-
-	_surface = _codec->decodeFrame(subStream);
-
-	return true;
-}
-
-} // End of namespace Director
diff --git a/engines/director/dib.h b/engines/director/dib.h
deleted file mode 100644
index e3763be..0000000
--- a/engines/director/dib.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef DIRECTOR_DIB_H
-#define DIRECTOR_DIB_H
-
-#include "common/scummsys.h"
-#include "common/str.h"
-#include "image/image_decoder.h"
-#include "image/codecs/bmp_raw.h"
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace Graphics {
-struct Surface;
-}
-
-namespace Image {
-class Codec;
-}
-
-namespace Director {
-
-class DIBDecoder : public Image::ImageDecoder {
-public:
-	DIBDecoder();
-	virtual ~DIBDecoder();
-
-	// ImageDecoder API
-	void destroy();
-	virtual bool loadStream(Common::SeekableReadStream &stream);
-	virtual const Graphics::Surface *getSurface() const { return _surface; }
-	const byte *getPalette() const { return _palette; }
-	void loadPalette(Common::SeekableReadStream &stream);
-	uint16 getPaletteColorCount() const { return _paletteColorCount; }
-
-private:
-	Image::Codec *_codec;
-	const Graphics::Surface *_surface;
-	byte *_palette;
-	uint8 _paletteColorCount;
-};
-
-} // End of namespace Director
-
-#endif
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 4898994..01b5085 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -40,7 +40,7 @@
 #include "graphics/macgui/macwindowmanager.h"
 
 #include "director/director.h"
-#include "director/dib.h"
+#include "director/images.h"
 #include "director/resource.h"
 #include "director/score.h"
 #include "director/lingo/lingo.h"
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
new file mode 100644
index 0000000..9bfd1e5
--- /dev/null
+++ b/engines/director/images.cpp
@@ -0,0 +1,150 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/stream.h"
+#include "common/substream.h"
+#include "common/textconsole.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "graphics/palette.h"
+#include "image/codecs/codec.h"
+#include "common/util.h"
+#include "common/debug.h"
+#include "image/codecs/bmp_raw.h"
+#include "common/system.h"
+
+#include "director/images.h"
+
+namespace Director {
+
+DIBDecoder::DIBDecoder() {
+	_surface = 0;
+	_palette = 0;
+	_paletteColorCount = 0;
+	_codec = 0;
+}
+
+DIBDecoder::~DIBDecoder() {
+	destroy();
+}
+
+void DIBDecoder::destroy() {
+	_surface = 0;
+
+	delete[] _palette;
+	_palette = 0;
+	_paletteColorCount = 0;
+
+	delete _codec;
+	_codec = 0;
+}
+
+void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
+	uint16 steps = stream.size() / 6;
+	uint16 index = (steps * 3) - 1;
+	_paletteColorCount = steps;
+	_palette = new byte[index + 1];
+
+	for (uint8 i = 0; i < steps; i++) {
+		_palette[index - 2] = stream.readByte();
+		stream.readByte();
+
+		_palette[index - 1] = stream.readByte();
+		stream.readByte();
+
+		_palette[index] = stream.readByte();
+		stream.readByte();
+		index -= 3;
+	}
+}
+
+bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
+	uint32 headerSize = stream.readUint32LE();
+	if (headerSize != 40)
+		return false;
+
+	uint32 width = stream.readUint32LE();
+	uint32 height = stream.readUint32LE();
+	stream.readUint16LE(); // planes
+	uint16 bitsPerPixel = stream.readUint16LE();
+	uint32 compression = stream.readUint32BE();
+	uint32 imageSize = stream.readUint32LE();
+	/* uint32 pixelsPerMeterX = */ stream.readUint32LE();
+	/* uint32 pixelsPerMeterY = */ stream.readUint32LE();
+	_paletteColorCount = stream.readUint32LE();
+	/* uint32 colorsImportant = */ stream.readUint32LE();
+
+	_paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
+
+	uint16 imageRawSize = stream.size() - 40;
+	Common::SeekableSubReadStream subStream(&stream, 40, stream.size());
+
+	_codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);
+
+	if (!_codec)
+		return false;
+
+	_surface = _codec->decodeFrame(subStream);
+
+	return true;
+}
+
+BITDDecoder::BITDDecoder() {
+	_surface = 0;
+	_palette = 0;
+	_paletteColorCount = 0;
+	_codec = 0;
+}
+
+BITDDecoder::~BITDDecoder() {
+	destroy();
+}
+
+void BITDDecoder::destroy() {
+	_surface = 0;
+
+	delete[] _palette;
+	_palette = 0;
+	_paletteColorCount = 0;
+
+	delete _codec;
+	_codec = 0;
+}
+
+void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
+	_palette = new byte[2 * 3];
+
+	_palette[0] = _palette[1] = _palette[2] = 0;
+	_palette[3] = _palette[4] = _palette[5] = 0xff;
+}
+
+bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
+	uint32 width = 512; // Should come from the Cast
+	uint32 height = 342;
+
+	_surface = new Graphics::Surface();
+	_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+
+	return true;
+}
+
+} // End of namespace Director
diff --git a/engines/director/images.h b/engines/director/images.h
new file mode 100644
index 0000000..821b85a
--- /dev/null
+++ b/engines/director/images.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_IMAGES_H
+#define DIRECTOR_IMAGES_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "image/image_decoder.h"
+#include "image/codecs/bmp_raw.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
+namespace Image {
+class Codec;
+}
+
+namespace Director {
+
+class DIBDecoder : public Image::ImageDecoder {
+public:
+	DIBDecoder();
+	virtual ~DIBDecoder();
+
+	// ImageDecoder API
+	void destroy();
+	virtual bool loadStream(Common::SeekableReadStream &stream);
+	virtual const Graphics::Surface *getSurface() const { return _surface; }
+	const byte *getPalette() const { return _palette; }
+	void loadPalette(Common::SeekableReadStream &stream);
+	uint16 getPaletteColorCount() const { return _paletteColorCount; }
+
+private:
+	Image::Codec *_codec;
+	const Graphics::Surface *_surface;
+	byte *_palette;
+	uint8 _paletteColorCount;
+};
+
+class BITDDecoder : public Image::ImageDecoder {
+public:
+	BITDDecoder();
+	virtual ~BITDDecoder();
+
+	// ImageDecoder API
+	void destroy();
+	virtual bool loadStream(Common::SeekableReadStream &stream);
+	virtual const Graphics::Surface *getSurface() const { return _surface; }
+	const byte *getPalette() const { return _palette; }
+	void loadPalette(Common::SeekableReadStream &stream);
+	uint16 getPaletteColorCount() const { return _paletteColorCount; }
+
+private:
+	Image::Codec *_codec;
+	Graphics::Surface *_surface;
+	byte *_palette;
+	uint8 _paletteColorCount;
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 2499528..05e92b7 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -2,8 +2,8 @@ MODULE := engines/director
 
 MODULE_OBJS = \
 	detection.o \
-	dib.o \
 	director.o \
+	images.o \
 	movie.o \
 	resource.o \
 	score.o \
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 231cb41..6628208 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -20,7 +20,6 @@
  *
  */
 
-#include "director/score.h"
 #include "common/stream.h"
 #include "common/debug.h"
 #include "common/file.h"
@@ -28,12 +27,6 @@
 #include "common/config-manager.h"
 #include "common/unzip.h"
 
-#include "common/system.h"
-#include "director/dib.h"
-#include "director/resource.h"
-#include "director/lingo/lingo.h"
-#include "director/sound.h"
-
 #include "graphics/palette.h"
 #include "common/events.h"
 #include "engines/util.h"
@@ -43,6 +36,12 @@
 #include "graphics/fontman.h"
 #include "graphics/fonts/bdf.h"
 
+#include "director/score.h"
+#include "director/images.h"
+#include "director/resource.h"
+#include "director/lingo/lingo.h"
+#include "director/sound.h"
+
 namespace Director {
 
 static byte defaultPalette[768] = {
@@ -1339,7 +1338,11 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 	}
 
 	if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
-		img = new Image::BitmapDecoder();
+		if (_vm->getVersion() < 4) {
+			img = new BITDDecoder();
+		} else {
+			img = new Image::BitmapDecoder();
+		}
 
 		if (debugChannelSet(8, kDebugLoading)) {
 			Common::SeekableReadStream *s = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);


Commit: f1b25497d185ff63205f07b6fbec0da4b83a009e
    https://github.com/scummvm/scummvm/commit/f1b25497d185ff63205f07b6fbec0da4b83a009e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-21T11:24:11+02:00

Commit Message:
DIRECTOR: Naive implementation for 1bpp image decoder. Not yet working

Changed paths:
    engines/director/images.cpp



diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 9bfd1e5..8c47bbc 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -131,10 +131,12 @@ void BITDDecoder::destroy() {
 }
 
 void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
-	_palette = new byte[2 * 3];
+	_palette = new byte[255 * 3];
 
 	_palette[0] = _palette[1] = _palette[2] = 0;
-	_palette[3] = _palette[4] = _palette[5] = 0xff;
+	_palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff;
+
+	_paletteColorCount = 2;
 }
 
 bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
@@ -144,6 +146,34 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	_surface = new Graphics::Surface();
 	_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 
+	int x = 0, y = 0;
+	byte *p = (byte *)_surface->getBasePtr(x, y);
+
+	while (true) {
+		byte in = stream.readByte();
+
+		if (stream.eos())
+			break;
+
+		for (int i = 0; i < 8; i++) {
+			*p++ = (in & 0x80) ? 0xff : 0;
+			in <<= 1;
+			x++;
+
+			if (x >= width) {
+				x = 0;
+				y++;
+
+				p = (byte *)_surface->getBasePtr(x, y);
+				break;
+			}
+		}
+
+		if (y >= height) {
+			break;
+		}
+	}
+
 	return true;
 }
 






More information about the Scummvm-git-logs mailing list