diff tools/lib64gfx.h @ 2139:84780a9d8d17

Improve and fix charmap format decoding.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 29 May 2019 13:11:00 +0300
parents 6528a1398e8e
children 487157934904
line wrap: on
line diff
--- a/tools/lib64gfx.h	Wed May 29 11:31:38 2019 +0300
+++ b/tools/lib64gfx.h	Wed May 29 13:11:00 2019 +0300
@@ -28,7 +28,8 @@
 #define D64_SCR_HEIGHT         200
 #define D64_SCR_CH_WIDTH       (D64_SCR_WIDTH/8)
 #define D64_SCR_CH_HEIGHT      (D64_SCR_HEIGHT/8)
-#define D64_MAX_EXTRA_DATA     64
+#define D64_MAX_EXTRA_DATA     16
+#define D64_MAX_EXTRA_INFO     64
 
 // C64 video screen pixel aspect ratio on PAL
 #define D64_SCR_PAR_XY         (0.9365f)
@@ -87,6 +88,15 @@
 };
 
 
+// Various extra settings (see DMC64Image::extraInfo[])
+enum
+{
+    D64_EI_CHAR_CASE = 0,
+    D64_EI_CHAR_MODE,
+    D64_EI_CHAR_CUSTOM,
+};
+
+
 // Image <-> bitmap conversion dithering
 enum
 {
@@ -179,6 +189,11 @@
     // for example raster colours might be stored
     DMC64MemBlock extraData[D64_MAX_EXTRA_DATA];
 
+    // Extra information / settings used by some formats,
+    // for example some PETSCII-type formats.
+    // See D64_EI_* constants.
+    Uint8 extraInfo[D64_MAX_EXTRA_INFO];
+
     //DMC64Sprite sprites[D64_MAX_SPRITES];
 } DMC64Image;
 
@@ -474,7 +489,7 @@
             case 0: *col = bgcolor; break;
             case 1: *col = bgd022; break;
             case 2: *col = bgd023; break;
-            case 3: *col = ccol & 15;
+            case 3: *col = ccol & 7;
         }
     }
     else