[Scummvm-git-logs] scummvm master -> ceea9b9061fffbca540891f5f3dc2817cf161d65

bluegr noreply at scummvm.org
Thu Mar 19 16:42:31 UTC 2026


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

Summary:
ceea9b9061 TINSEL: Fix DW1 Sega Saturn graphics


Commit: ceea9b9061fffbca540891f5f3dc2817cf161d65
    https://github.com/scummvm/scummvm/commit/ceea9b9061fffbca540891f5f3dc2817cf161d65
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2026-03-19T18:42:26+02:00

Commit Message:
TINSEL: Fix DW1 Sega Saturn graphics

Changed paths:
    engines/tinsel/graphics.cpp
    engines/tinsel/tinsel.h


diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 9a97b2d866f..c3858033bb2 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -51,7 +51,9 @@ static inline uint16 t3getColor(uint8 r, uint8 g, uint8 b) {
 /**
  * PSX/Saturn Block list unwinder.
  * Chunk type 0x0003 (CHUNK_CHARPTR) in PSX version of DW 1 & 2 is compressed (original code
- * calls the compression PJCRLE), thus we need to decompress it before passing data to drawing functions
+ * calls the compression PJCRLE), thus we need to decompress it before passing data to drawing functions.
+ * Note that while the compression format itself is always little endian, even on Saturn, the endianness
+ * of the output indexes is platform specific.
  */
 uint8* psxSaturnPJCRLEUnwinder(uint16 imageWidth, uint16 imageHeight, uint8 *srcIdx) {
 	uint32 remainingBlocks = 0;
@@ -118,7 +120,7 @@ uint8* psxSaturnPJCRLEUnwinder(uint16 imageWidth, uint16 imageHeight, uint8 *src
 		switch (compressionType) {
 			case 0: // No compression, plain copy of indexes
 				while (decremTiles) {
-					WRITE_LE_UINT16(dstIdx, READ_LE_UINT16(srcIdx));
+					WRITE_16(dstIdx, READ_LE_UINT16(srcIdx));
 					srcIdx += 2;
 					dstIdx += 2;
 					decremTiles--;
@@ -126,14 +128,14 @@ uint8* psxSaturnPJCRLEUnwinder(uint16 imageWidth, uint16 imageHeight, uint8 *src
 				break;
 			case 1: // Compression type 1, repeat a base index
 				while (decremTiles) {
-					WRITE_LE_UINT16(dstIdx, baseIndex);
+					WRITE_16(dstIdx, baseIndex);
 					dstIdx += 2;
 					decremTiles--;
 				}
 				break;
 			case 2: // Compression type 2, increment a base index
 				while (decremTiles) {
-					WRITE_LE_UINT16(dstIdx, baseIndex);
+					WRITE_16(dstIdx, baseIndex);
 					baseIndex++;
 					dstIdx += 2;
 					decremTiles--;
@@ -354,7 +356,7 @@ static void psxSaturnDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool
 			assert(boxBounds.bottom >= boxBounds.top);
 			assert(boxBounds.right >= boxBounds.left);
 
-			int16 indexVal = READ_LE_UINT16(srcP);
+			int16 indexVal = READ_16(srcP);
 			srcP += sizeof(uint16);
 
 			// Draw a 4x4 block based on the opcode as in index into the block list
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index a3d79cb6930..85aacbf8338 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -135,6 +135,7 @@ typedef bool (*KEYFPTR)(const Common::KeyState &, const Common::CustomEventType
 
 #define READ_16(v) (TinselV1Mac || TinselV1Saturn ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
 #define READ_32(v) (TinselV1Mac || TinselV1Saturn ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
+#define WRITE_16(p, v) (TinselV1Mac || TinselV1Saturn ? WRITE_BE_UINT16(p, v) : WRITE_LE_UINT16(p, v))
 #define WRITE_32(p, v) (TinselV1Mac || TinselV1Saturn ? WRITE_BE_UINT32(p, v) : WRITE_LE_UINT32(p, v))
 #define FROM_16(v) (TinselV1Mac || TinselV1Saturn ? FROM_BE_16(v) : FROM_LE_16(v))
 #define FROM_32(v) (TinselV1Mac || TinselV1Saturn ? FROM_BE_32(v) : FROM_LE_32(v))




More information about the Scummvm-git-logs mailing list