changeset 1392:aad9d9e7e1d3

Cleanups, support another variant of FLI Designer format.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Sep 2017 22:55:17 +0300
parents f3c5f80511ae
children b5fc5a05033d
files tools/lib64gfx.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Sun Sep 24 22:26:22 2017 +0300
+++ b/tools/lib64gfx.c	Sun Sep 24 22:55:17 2017 +0300
@@ -347,11 +347,10 @@
 }
 
 
-#define AMICA_DM_PROBE_SIZE 2048
 static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
     size_t i, n;
-    if (len < AMICA_DM_PROBE_SIZE || !dmCompareAddr16(buf, 0, fmt->addr))
+    if (len < 2048 || !dmCompareAddr16(buf, 0, fmt->addr))
         return DM_PROBE_SCORE_FALSE;
 
     // Interpaint Hi-Res gives a false positive
@@ -389,6 +388,16 @@
 }
 
 
+static int fmtProbeFLIDesigner(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
+{
+    if (len == fmt->size &&
+        (dmCompareAddr16(buf, 0, 0x3c00) || dmCompareAddr16(buf, 0, 0x3ff0)))
+        return DM_PROBE_SCORE_MAX;
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
 static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len)
 {
     (void) op;
@@ -440,7 +449,6 @@
 }
 
 
-
 #define FUNPAINT2_HEADER_SIZE (0x10)
 
 static BOOL fmtProbeFunPaint2Header(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
@@ -799,10 +807,10 @@
     },
 
     {
-        D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer 1 (unpacked)", 0x3c00, 17409,
+        D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer (unpacked)", 0, 17409,
         C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
-        NULL, NULL,
+        fmtProbeFLIDesigner, NULL,
         NULL, NULL, NULL, fmtGetPixelFLIDesigner,
         {
             { DT_COLOR_RAM,    0x0000, 0,  0, NULL, NULL },