diff tools/lib64fmts.c @ 2265:48b48251610a

Refactor how the image "mode/type" is handled. It is still not perfect for our purposes, but better now.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 17 Jun 2019 02:03:35 +0300
parents 5db6e0b63b35
children 631bbd451d08
line wrap: on
line diff
--- a/tools/lib64fmts.c	Mon Jun 17 01:44:54 2019 +0300
+++ b/tools/lib64fmts.c	Mon Jun 17 02:03:35 2019 +0300
@@ -104,7 +104,7 @@
             return DMERR_INVALID_DATA;
     }
 
-    img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES;
+    img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR;
     img->extraInfo[D64_EI_CHAR_CUSTOM] = 0;
 
     return DMERR_OK;
@@ -148,13 +148,13 @@
     switch (data[0x0028 - 2])
     {
         case 0x00:
-            img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES;
+            img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR;
             img->d020    = data[0x001e - 2];
             img->bgcolor = data[0x0023 - 2];
             break;
 
         case 0xd8:
-            img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_MC;
+            img->extraInfo[D64_EI_MODE] = D64_FMT_MC | D64_FMT_CHAR;
             img->d020    = data[0x001e - 2];
             img->bgcolor = data[0x0023 - 2];
             img->d022    = data[0x002d - 2];
@@ -162,7 +162,7 @@
             break;
 
         case 0x01:
-            img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_ECM;
+            img->extraInfo[D64_EI_MODE] = D64_FMT_ECM | D64_FMT_CHAR;
             img->d020    = data[0x001e - 2];
             img->bgcolor = data[0x0023 - 2];
             img->d022    = data[0x0028 - 2];
@@ -192,7 +192,7 @@
     (void) buf;
     (void) fmt;
 
-    img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES;
+    img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR;
     img->extraInfo[D64_EI_CHAR_CUSTOM] = 0;
 
     return DMERR_OK;
@@ -347,7 +347,7 @@
     int res;
     DMGrowBuf tmp;
     DMCompParams cfg;
-    const char *magicID = (fmt->format->type & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0";
+    const char *magicID = (fmt->format->mode & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0";
 
     // Encode the data to temp buffer
     if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK)