changeset 2546:b76ac594cf33

Change DEF_REPEAT_BLOCK*() macro to have operator argument.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 18 Oct 2021 15:42:14 +0300
parents e028058648ea
children 71f04d8e791e
files tools/lib64fmts.c
diffstat 1 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Mon Oct 18 07:38:23 2021 +0300
+++ b/tools/lib64fmts.c	Mon Oct 18 15:42:14 2021 +0300
@@ -2125,18 +2125,18 @@
 // Helper macros for defining screen memory layouts
 // common for several FLI type image formats
 //
-#define DEF_REPEAT_BLOCK(dtype, start, oindex, bindex, osize, bsize, oflags) \
-    { DO_COPY, (dtype), (start) + ((osize) * (oindex)), (bindex), (bsize), 0, NULL, NULL, (oflags) }
-
-#define DEF_REPEAT_BLOCK_8(dtype, start, sindex, osize, bsize, oflags) \
-    DEF_REPEAT_BLOCK((dtype), (start), 0, ((sindex) + 0), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 1, ((sindex) + 1), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 2, ((sindex) + 2), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 3, ((sindex) + 3), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 4, ((sindex) + 4), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 5, ((sindex) + 5), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 6, ((sindex) + 6), (osize), (bsize), (oflags)), \
-    DEF_REPEAT_BLOCK((dtype), (start), 7, ((sindex) + 7), (osize), (bsize), (oflags))
+#define DEF_REPEAT_BLOCK(dop, dtype, start, oindex, bindex, osize, bsize, oflags) \
+    { (dop), (dtype), (start) + ((osize) * (oindex)), (bindex), (bsize), 0, NULL, NULL, (oflags) }
+
+#define DEF_REPEAT_BLOCK_8(dop, dtype, start, sindex, osize, bsize, oflags) \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 0, ((sindex) + 0), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 1, ((sindex) + 1), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 2, ((sindex) + 2), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 3, ((sindex) + 3), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 4, ((sindex) + 4), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 5, ((sindex) + 5), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 6, ((sindex) + 6), (osize), (bsize), (oflags)), \
+    DEF_REPEAT_BLOCK((dop), (dtype), (start), 7, ((sindex) + 7), (osize), (bsize), (oflags))
 
 
 //
@@ -2172,7 +2172,7 @@
         {
             { DO_COPY       , DS_EXTRA_DATA  , 0x0000, 0,  200  , 0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_COLOR_RAM   , 0x0100, 0,  0    , 0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0500, 0,  0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x0500, 0,  0x400, 0, DF_NORMAL),
             { DO_COPY       , DS_BITMAP_RAM  , 0x2500, 0,  0    , 0, NULL, NULL, DF_NORMAL },
 
             { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8,  0    , 0, D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
@@ -2202,11 +2202,11 @@
         NULL, NULL,
         fmtGetPixelFunPaint2,
         {
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0000, 0,  0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x0000, 0,  0x400, 0, DF_NORMAL),
             { DO_COPY       , DS_BITMAP_RAM  , 0x2000, 0,  0    , 0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_EXTRA_DATA  , 0x3f48, 0,  100  , 0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_COLOR_RAM   , 0x4000, 0,  0    , 0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x43e8, 8,  0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x43e8, 8,  0x400, 0, DF_NORMAL),
             { DO_COPY       , DS_BITMAP_RAM  , 0x63e8, 1,  0    , 0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_EXTRA_DATA  , 0x8328, 0,  100  , 100, NULL, NULL, DF_NORMAL },
             { DO_SET_OP     , DS_EXTRA_INFO  , D64_ILACE_RES, 0 , 0  , D64_EI_ILACE_TYPE, NULL, NULL, DF_DECODE },
@@ -2277,9 +2277,9 @@
         fmtGetPixelECI,
         {
             { DO_COPY       , DS_BITMAP_RAM  , 0x0000, 0,  0,   0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0, 0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x2000, 0, 0x400, 0, DF_NORMAL),
             { DO_COPY       , DS_BITMAP_RAM  , 0x4000, 1,  0,   0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x6000, 8, 0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x6000, 8, 0x400, 0, DF_NORMAL),
             { DO_SET_OP     , DS_EXTRA_INFO  , D64_ILACE_COLOR, 0 , 0  , D64_EI_ILACE_TYPE, NULL, NULL, DF_DECODE },
             { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8,  0,   0, D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
             { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL, DF_NORMAL },
@@ -2295,7 +2295,7 @@
         fmtGetPixelCrestHIFLIorCDHM,
         {
             { DO_COPY       , DS_BITMAP_RAM  , 0x0000, 0,  0,   0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0,  0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x2000, 0,  0x400, 0, DF_NORMAL),
             { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8,  0,   0, D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
             { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL, DF_NORMAL },
         }
@@ -2310,7 +2310,7 @@
         fmtGetPixelFLIDesigner,
         {
             { DO_COPY      , DS_COLOR_RAM   , 0x0000, 0,  0,   0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM, 0x0400, 0, 0x400, 0, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM, 0x0400, 0, 0x400, 0, DF_NORMAL),
             { DO_COPY      , DS_BITMAP_RAM  , 0x2400, 0,  0,   0, NULL, NULL, DF_NORMAL },
             { DO_SET_OP    , DS_EXTRA_INFO  , D64_FLI_8,  0,   0, D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
             { DO_LAST      , 0              , 0     , 0,  0,   0, NULL, NULL, DF_NORMAL },
@@ -2339,8 +2339,8 @@
         NULL, NULL,
         fmtGetPixelCrestSHFLI,
         {
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM,  0x0000, 0  , 0x0400,   0x0400, DF_NORMAL),
-            DEF_REPEAT_BLOCK_8(DS_EXTRA_DATA,  0x03f8, 0  , 0x0400,   8, DF_DECODE), // Sprite pointers for each bank
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM,  0x0000, 0  , 0x0400,   0x0400, DF_NORMAL),
+            DEF_REPEAT_BLOCK_8(DO_COPY, DS_EXTRA_DATA,  0x03f8, 0  , 0x0400,   8, DF_DECODE), // Sprite pointers for each bank
             { DO_COPY       , DS_EXTRA_DATA  , 0x03e8, 15 , 2     ,   0, NULL, NULL, DF_DECODE },  // 2 sprite colors
             { DO_COPY       , DS_EXTRA_DATA  , 0x0000, 14 , 0x3e00,   0, NULL, NULL, DF_DECODE },  // Lazily copy whole data for sprite data
             { DO_COPY       , DS_BITMAP_RAM  , 0x2000, 0  , 0     ,   0, NULL, NULL, DF_NORMAL },
@@ -2816,9 +2816,9 @@
             fmtGetPixelBFLI,
             {
                 { DO_COPY       , DS_COLOR_RAM   , 0x0001, 0,  0x400 ,   0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0401, 0,  0x400 ,   0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x0401, 0,  0x400 ,   0, DF_NORMAL),
                 { DO_COPY       , DS_BITMAP_RAM  , 0x2401, 0,  0x2000,   0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x4401, 8,  0x400 , 0x400, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x4401, 8,  0x400 , 0x400, DF_NORMAL),
                 { DO_COPY       , DS_BITMAP_RAM  , 0x6401, 1,  0x2000,   0, NULL, NULL, DF_NORMAL },
                 { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8,  0,   0, D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
                 { DO_LAST       , 0              , 0     , 0,  0     ,   0, NULL, NULL, DF_NORMAL },
@@ -2878,10 +2878,10 @@
                 { DO_COPY       , DS_COLOR_RAM   , 0x0000         , 1,  0    ,   0, NULL, NULL, DF_NORMAL },
 
                 { DO_COPY       , DS_BITMAP_RAM  , 0x4000 - 0x284e, 0,  0    ,   0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x6000 - 0x284e, 0,  0x400,   0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x6000 - 0x284e, 0,  0x400,   0, DF_NORMAL),
 
                 { DO_COPY       , DS_BITMAP_RAM  , 0x8000 - 0x284e, 1,  0    ,   0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0xA000 - 0x284e, 8,  0x400,   0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0xA000 - 0x284e, 8,  0x400,   0, DF_NORMAL),
 
                 { DO_SET_OP     , DS_EXTRA_INFO  , D64_ILACE_COLOR, 0 , 0    ,   D64_EI_ILACE_TYPE, NULL, NULL, DF_DECODE },
                 { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8      , 0,  0    ,   D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
@@ -3045,11 +3045,11 @@
             NULL, NULL,
             fmtGetPixelFunPaint2, // The format is essentially same as FP2
             {
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0000, 0, 0x400, 0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x0000, 0, 0x400, 0, DF_NORMAL),
                 { DO_COPY       , DS_BITMAP_RAM  , 0x2000, 0,  0  , 0, NULL, NULL, DF_NORMAL },
                 { DO_COPY       , DS_EXTRA_DATA  , 0x3f4f, 0,  177, 0, NULL, NULL, DF_NORMAL },
                 { DO_COPY       , DS_COLOR_RAM   , 0x4000, 0,  0  , 0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x4400, 8, 0x400, 0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x4400, 8, 0x400, 0, DF_NORMAL),
                 { DO_COPY       , DS_BITMAP_RAM  , 0x6400, 1,  0  , 0, NULL, NULL, DF_NORMAL },
                 // GunPaint does not store the last 3 d021 values .. so set them to black
                 // XXX TODO: According to some, the last 4 should be same ..
@@ -3126,7 +3126,7 @@
             fmtGetPixelCrestHIFLIorCDHM,
             {
                 { DO_COPY       , DS_BITMAP_RAM  , 0x0000, 0,  0    ,  0, NULL, NULL, DF_NORMAL },
-                DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0,  0x400,  0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x2000, 0,  0x400,  0, DF_NORMAL),
                 { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8, 0,  0  , D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
                 { DO_LAST       , 0              , 0     , 0,  0    ,  0, NULL, NULL, DF_NORMAL },
             }