changeset 1983:214c7bd8692f

Rename "MIL" to "Micro Illustrator" and improve probing of that format, at least based on the few samples I have.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 01 Jul 2018 06:18:55 +0300
parents 6af47b1009ba
children e7f2ddaf94a6
files tools/lib64fmts.c
diffstat 1 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Sun Jul 01 06:17:34 2018 +0300
+++ b/tools/lib64fmts.c	Sun Jul 01 06:18:55 2018 +0300
@@ -19,6 +19,32 @@
 }
 
 
+// XXX TODO: Research what these values actually mean. It would seem probable
+// that these may not be static values at all, as there are 8 more that change
+// before actual image data, but do not seem to be used in the image itself.
+static const Uint8 fmtMicroIllustratorMagicID_1[] =
+{
+    0xff, 0x80, 0x69, 0x67, 0x14, 0x00,
+};
+
+static const Uint8 fmtMicroIllustratorMagicID_2[] =
+{
+    0xe8, 0x03, 0xe8, 0x03, 0x40, 0x1f,
+};
+
+static int fmtProbeMicroIllustrator(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    if (buf->len == fmt->size &&
+        memcmp(buf->data + 2, fmtMicroIllustratorMagicID_1, sizeof(fmtMicroIllustratorMagicID_1)) == 0
+        &&
+        memcmp(buf->data + 9, fmtMicroIllustratorMagicID_2, sizeof(fmtMicroIllustratorMagicID_2)) == 0
+        )
+        return DM_PROBE_SCORE_MAX;
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
 static int fmtProbeKoalaPainterPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
 {
     // Attempt to prevent misprobes of unpacked Koala and Run Paint
@@ -1374,8 +1400,8 @@
     },
 
     {
-        "mil", "MIL (unpacked)", 0x18dc, 10022, DM_FMT_RDWR | DM_FMT_BROKEN,
-        NULL,
+        "mil", "Micro Illustrator (unpacked)", 0x18dc, 10022, DM_FMT_RDWR,
+        fmtProbeMicroIllustrator,
         NULL, NULL,
         {
             D64_FMT_MC,
@@ -1384,13 +1410,13 @@
             NULL, NULL,
             NULL,
             {
-                { DO_COPY       , DS_SCREEN_RAM  , 20 + 0   , 0,  0,   0, NULL, NULL },
-                { DO_COPY       , DS_COLOR_RAM   , 20 + 1000, 0,  0,   0, NULL, NULL },
-                { DO_COPY       , DS_BITMAP_RAM  , 20 + 2000, 0,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_SCREEN_RAM  , 20 + 0     , 0,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_COLOR_RAM   , 20 + 1000  , 0,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_BITMAP_RAM  , 20 + 2000  , 0,  0,   0, NULL, NULL },
                 // XXX TODO: Unknown where the background color is set, so default to 0x01
-                //{ DO_SET_MEM    , DS_BGCOL       , 0x23ff, 0,  0,   0, NULL, NULL },
-                { DO_SET_OP     , DS_BGCOL       , 0x01  , 0,  0,   0, NULL, NULL },
-                { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL },
+                //{ DO_SET_MEM_LO , DS_BGCOL       , 20 + 0x3e8 , 0,  0,   0, NULL, NULL },
+                { DO_SET_OP     , DS_BGCOL       , 0x01       , 0,  0,   0, NULL, NULL },
+                { DO_LAST       , 0              , 0          , 0,  0,   0, NULL, NULL },
             }
         },
         NULL