[Scummvm-git-logs] scummvm master -> 847b67b4553452a82e61f9460451d1e13e87e11a

somaen einarjohants at gmail.com
Fri Feb 5 23:32:23 UTC 2021


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

Summary:
6e3daad277 TINSEL: Modify handle to read flags correctly for Noir.
0f78bfeeae TINSEL: Adjust LoadFile for Noir, stubbing out compression for now.
847b67b455 TINSEL: Unblock Noir in TinselEngine::run(), and use DW2's graphics-config for now.


Commit: 6e3daad277cfaae77ca84b11bb44991934c0c13b
    https://github.com/scummvm/scummvm/commit/6e3daad277cfaae77ca84b11bb44991934c0c13b
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2021-02-06T00:29:27+01:00

Commit Message:
TINSEL: Modify handle to read flags correctly for Noir.

Contains fixes from Kerbox' repos.

Changed paths:
    engines/tinsel/handle.cpp


diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index 77ce4e0cf5..b7581d8b40 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -56,7 +56,9 @@ enum {
 	fCompressed	= 0x10000000L,	///< compressed data
 	fLoaded		= 0x20000000L	///< set when file data has been loaded
 };
-#define	FSIZE_MASK	0x00FFFFFFL	///< mask to isolate the filesize
+#define FSIZE_MASK	(TinselV3 ? 0xFFFFFFFFL : 0x00FFFFFFL)	//!< mask to isolate the filesize
+#define MEMFLAGS(x) (TinselV3 ? x->flags2 : x->filesize)
+#define MEMFLAGSET(x, mask) (TinselV3 ? x->flags2 |= mask : x->filesize |= mask)
 
 Handle::Handle() : _handleTable(0), _numHandles(0), _cdPlayHandle((uint32)-1), _cdBaseHandle(0), _cdTopHandle(0), _cdGraphStream(nullptr) {
 }
@@ -131,7 +133,7 @@ void Handle::SetupHandleTable() {
 
 	// allocate memory nodes and load all permanent graphics
 	for (i = 0, pH = _handleTable; i < _numHandles; i++, pH++) {
-		if (pH->filesize & fPreload) {
+		if (MEMFLAGS(pH) & fPreload) {
 			// allocate a fixed memory node for permanent files
 			pH->_node = MemoryAllocFixed((pH->filesize & FSIZE_MASK));
 
@@ -178,7 +180,7 @@ void Handle::LoadCDGraphData(MEMHANDLE *pH) {
 	assert(!(pH->filesize & fCompressed));
 
 	// Can't be preloaded
-	assert(!(pH->filesize & fPreload));
+	assert(!(MEMFLAGS(pH) & fPreload));
 
 	// discardable - lock the memory
 	addr = (byte *)MemoryLock(pH->_node);
@@ -202,7 +204,7 @@ void Handle::LoadCDGraphData(MEMHANDLE *pH) {
 	MemoryUnlock(pH->_node);
 
 	// set the loaded flag
-	pH->filesize |= fLoaded;
+	MEMFLAGSET(pH, fLoaded);
 
 	// clear the loading flag
 //	pH->filesize &= ~fLoading;
@@ -276,7 +278,7 @@ void Handle::LoadFile(MEMHANDLE *pH) {
 		MemoryUnlock(pH->_node);
 
 		// set the loaded flag
-		pH->filesize |= fLoaded;
+		MEMFLAGSET(pH, fLoaded);
 
 		if (bytes == (pH->filesize & FSIZE_MASK)) {
 			return;
@@ -304,7 +306,7 @@ byte *Handle::LockMem(SCNHANDLE offset) {
 
 	pH = _handleTable + handle;
 
-	if (pH->filesize & fPreload) {
+	if (MEMFLAGS(pH) & fPreload) {
 		// permanent files are already loaded, nothing to be done
 	} else if (handle == _cdPlayHandle) {
 		// Must be in currently loaded/loadable range
@@ -323,7 +325,7 @@ byte *Handle::LockMem(SCNHANDLE offset) {
 		}
 
 		// make sure address is valid
-		assert(pH->filesize & fLoaded);
+		assert(MEMFLAGS(pH) & fLoaded);
 
 		offset -= _cdBaseHandle;
 	} else {
@@ -339,7 +341,7 @@ byte *Handle::LockMem(SCNHANDLE offset) {
 		}
 
 		// make sure address is valid
-		assert(pH->filesize & fLoaded);
+		assert(MEMFLAGS(pH) & fLoaded);
 	}
 
 	return MemoryDeref(pH->_node) + (offset & OFFSETMASK);
@@ -359,7 +361,7 @@ void Handle::LockScene(SCNHANDLE offset) {
 
 	pH = _handleTable + handle;
 
-	if ((pH->filesize & fPreload) == 0) {
+	if ((MEMFLAGS(pH) & fPreload) == 0) {
 		// Ensure the scene handle is allocated.
 		MemoryReAlloc(pH->_node, pH->filesize & FSIZE_MASK);
 
@@ -382,7 +384,7 @@ void Handle::UnlockScene(SCNHANDLE offset) {
 
 	pH = _handleTable + handle;
 
-	if ((pH->filesize & fPreload) == 0) {
+	if ((MEMFLAGS(pH) & fPreload) == 0) {
 		// unlock the scene data
 		MemoryUnlock(pH->_node);
 	}


Commit: 0f78bfeeae5ca5fdde5f809ef07a043b5d1277ae
    https://github.com/scummvm/scummvm/commit/0f78bfeeae5ca5fdde5f809ef07a043b5d1277ae
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2021-02-06T00:29:47+01:00

Commit Message:
TINSEL: Adjust LoadFile for Noir, stubbing out compression for now.

Changed paths:
  A engines/tinsel/noir/lzss.cpp
  A engines/tinsel/noir/lzss.h
    engines/tinsel/handle.cpp
    engines/tinsel/module.mk


diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index b7581d8b40..24e3875f3c 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -34,6 +34,7 @@
 #include "tinsel/timers.h"	// for DwGetCurrentTime()
 #include "tinsel/tinsel.h"
 #include "tinsel/scene.h"
+#include "tinsel/noir/lzss.h"
 
 namespace Tinsel {
 
@@ -254,7 +255,7 @@ void Handle::LoadFile(MEMHANDLE *pH) {
 	memcpy(szFilename, pH->szName, sizeof(pH->szName));
 	szFilename[sizeof(pH->szName)] = 0;
 
-	if (pH->filesize & fCompressed) {
+	if (!TinselV3 && MEMFLAGS(pH) & fCompressed) {
 		error("Compression handling has been removed - %s", szFilename);
 	}
 
@@ -269,7 +270,11 @@ void Handle::LoadFile(MEMHANDLE *pH) {
 		// make sure address is valid
 		assert(addr);
 
-		bytes = f.read(addr, pH->filesize & FSIZE_MASK);
+		if (TinselV3 && MEMFLAGS(pH) & fCompressed) {
+			bytes = decompressLZSS(f, addr);
+		} else {
+			bytes = f.read(addr, pH->filesize & FSIZE_MASK);
+		}
 
 		// close the file
 		f.close();
diff --git a/engines/tinsel/module.mk b/engines/tinsel/module.mk
index 1a76fd192d..b2cafcf7e5 100644
--- a/engines/tinsel/module.mk
+++ b/engines/tinsel/module.mk
@@ -1,6 +1,7 @@
 MODULE := engines/tinsel
 
 MODULE_OBJS := \
+    noir/lzss.o \
 	actors.o \
 	adpcm.o \
 	anim.o \
diff --git a/engines/tinsel/noir/lzss.cpp b/engines/tinsel/noir/lzss.cpp
new file mode 100644
index 0000000000..adb37cd4b2
--- /dev/null
+++ b/engines/tinsel/noir/lzss.cpp
@@ -0,0 +1,35 @@
+/* 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.
+ *
+ * Prototypes of actor functions
+ */
+
+#include "common/textconsole.h"
+#include "tinsel/noir/lzss.h"
+
+namespace Tinsel {
+
+int decompressLZSS(Common::ReadStream &input, byte *output) {
+	error("TODO: Implement decompression");
+	return 0;
+}
+
+}
+
diff --git a/engines/tinsel/noir/lzss.h b/engines/tinsel/noir/lzss.h
new file mode 100644
index 0000000000..d311601cd6
--- /dev/null
+++ b/engines/tinsel/noir/lzss.h
@@ -0,0 +1,35 @@
+/* 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.
+ *
+ * Prototypes of actor functions
+ */
+
+#ifndef TINSEL_NOIR_LZSS_H
+#define TINSEL_NOIR_LZSS_H
+
+#include "common/stream.h"
+
+namespace Tinsel {
+
+int decompressLZSS(Common::ReadStream &input, byte *output);
+
+}
+
+#endif


Commit: 847b67b4553452a82e61f9460451d1e13e87e11a
    https://github.com/scummvm/scummvm/commit/847b67b4553452a82e61f9460451d1e13e87e11a
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2021-02-06T00:29:54+01:00

Commit Message:
TINSEL: Unblock Noir in TinselEngine::run(), and use DW2's graphics-config for now.

Changed paths:
    engines/tinsel/tinsel.cpp


diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 901d3fd6f3..ed4a231a38 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -971,7 +971,9 @@ Common::Error TinselEngine::run() {
 
 	// Initialize backend
 	if (getGameID() == GID_NOIR) {
-		error("Discworld Noir is not yet supported");
+		initGraphics(640, 480);
+
+		_screenSurface.create(640, 432, Graphics::PixelFormat::createFormatCLUT8());
 	} else if (getGameID() == GID_DW2) {
 #ifndef DW2_EXACT_SIZE
 		initGraphics(640, 480);




More information about the Scummvm-git-logs mailing list