[Scummvm-git-logs] scummvm master -> 17c4d6f191a433a84cdbf955b1c88644aff4437f

bluegr bluegr at gmail.com
Sun Jan 19 20:16:42 UTC 2020


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

Summary:
17c4d6f191 SCI: Fix compilation with non-C++11 compilers


Commit: 17c4d6f191a433a84cdbf955b1c88644aff4437f
    https://github.com/scummvm/scummvm/commit/17c4d6f191a433a84cdbf955b1c88644aff4437f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-01-19T22:16:27+02:00

Commit Message:
SCI: Fix compilation with non-C++11 compilers

Changed paths:
    engines/sci/resource_patcher.cpp


diff --git a/engines/sci/resource_patcher.cpp b/engines/sci/resource_patcher.cpp
index 2745fc1..84d2c60 100644
--- a/engines/sci/resource_patcher.cpp
+++ b/engines/sci/resource_patcher.cpp
@@ -30,14 +30,16 @@ namespace Sci {
 
 // Start of internal resource patcher macros. Please do not use these directly
 // in resource patches.
-using int_c_array = int[];
-#define _NUMARGS(...) (sizeof(int_c_array{__VA_ARGS__})/sizeof(int))
+// NOTE: The following breaks in non-C++11 compilers. It can be used to simplify the
+// _BYTEOP(), and consequently the REPLACE() and INSERT() macros below.
+//using int_c_array = int[];
+//#define _NUMARGS(...) (sizeof(int_c_array{ __VA_ARGS__ }) / sizeof(int))
 #ifdef SCUMM_LITTLE_ENDIAN
 #define _PACKINT32(n) (((uint32)n) & 0xFF), (((uint32)n) >> 8 & 0xFF), (((uint32)n) >> 16 & 0xFF), (((uint32)n) >> 24 & 0xFF)
 #else
 #define _PACKINT32(n) (((uint32)n) >> 24 & 0xFF), (((uint32)n) >> 16 & 0xFF), (((uint32)n) >> 8 & 0xFF), (((uint32)n) & 0xFF)
 #endif
-#define _BYTEOP(op, ...) op, _PACKINT32(_NUMARGS(__VA_ARGS__)), __VA_ARGS__
+#define _BYTEOP(op, numBytes, ...) op, _PACKINT32(numBytes), __VA_ARGS__
 #define _NUMBEROP(op, type, value) op, sizeof(type), _PACKINT32(value)
 #define _FILLOP(op, numBytes, value) op, _PACKINT32(numBytes), value
 // End of internal resource patcher macros
@@ -50,12 +52,12 @@ using int_c_array = int[];
 /**
  * Replaces data at the current position.
  */
-#define REPLACE(...) _BYTEOP(kReplaceBytes, __VA_ARGS__)
+#define REPLACE(numBytes, ...) _BYTEOP(kReplaceBytes, numBytes, __VA_ARGS__)
 
 /**
  * Inserts new data at the current position.
  */
-#define INSERT(...) _BYTEOP(kInsertBytes, __VA_ARGS__)
+#define INSERT(numBytes, ...) _BYTEOP(kInsertBytes, numBytes, __VA_ARGS__)
 
 /**
  * Replaces a number of the given type at the current position with the given
@@ -114,7 +116,7 @@ static const byte phant1View64001Palette[] = {
 static const byte pq4EnhancedAudioToggleView[] = {
 	INSERT_NUMBER(uint16,  16), // header size
 	INSERT_NUMBER(uint8,    1), // loop count
-	INSERT(0x00, 0x01),         // unused
+	INSERT(2, 0x00, 0x01),      // unused
 	INSERT_NUMBER(uint8,    0), // resolution flag
 	INSERT_NUMBER(uint16,   0), // unused
 	INSERT_NUMBER(uint32,  70), // palette offset
@@ -156,7 +158,7 @@ static const byte pq4EnhancedAudioToggleView[] = {
 	INSERT_NUMBER(uint8,    1), // used
 	INSERT_NUMBER(uint8,    0), // shared used
 	INSERT_NUMBER(uint32,   0), // version
-	INSERT(                     // color data
+	INSERT(152,                 // color data
 	0x01, 0x00, 0x00, 0x00, 0x01, 0x1B, 0x1B, 0x1B, 0x01, 0x2B,
 	0x2F, 0x2B, 0x01, 0x33, 0x33, 0x33, 0x01, 0x37, 0x3B, 0x37,
 	0x01, 0x47, 0x47, 0x47, 0x01, 0x4B, 0x4B, 0x4B, 0x01, 0x53,
@@ -177,7 +179,7 @@ static const byte pq4EnhancedAudioToggleView[] = {
 	INSERT_FILL(0x00, 872),     // unused color entries
 
 	// pixel data
-	INSERT(
+	INSERT(1955,
 	0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
 	0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
 	0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,




More information about the Scummvm-git-logs mailing list