changeset 2167:9d362ea1a606

Add probe function for Crest Super Hires FLI Editor v1.0 (unpacked).
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Jun 2019 05:45:13 +0300
parents 4c3fdc9c0056
children b4f4251eaaae
files tools/lib64fmts.c
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Tue Jun 11 05:44:22 2019 +0300
+++ b/tools/lib64fmts.c	Tue Jun 11 05:45:13 2019 +0300
@@ -1244,6 +1244,27 @@
 }
 
 
+static const Uint8 fmtCrestSHFLI_MagicID_1[] =
+{
+    0x80, 0x84, 0x85, 0x89, 0x8A, 0x8E, 0x8F, 0x93
+};
+
+
+static int fmtProbeCrestSHFLI(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    if (buf->len == fmt->size &&
+        dmCompareAddr16(buf, 0, fmt->addr))
+    {
+        if (DM_MEMCMP_SIZE(buf->data + 0x03f8 + 2, fmtCrestSHFLI_MagicID_1) == 0)
+            return DM_PROBE_SCORE_MAX;
+        else
+            return DM_PROBE_SCORE_MAYBE;
+    }
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
 static int fmtGetSpritePixelCrestSHFLI(Uint8 *col,
     const DMC64Image *img, const int sindex, const int cindex,
     const int spr_xd, const int spr_yd, const int mask)
@@ -2339,7 +2360,7 @@
 
     {
         "cshf", "Crest Super Hires FLI Editor v1.0 (unpacked)", 0x4000, 15874, DM_FMT_RD,
-        NULL,
+        fmtProbeCrestSHFLI,
         NULL, NULL,
         {
             D64_FMT_HIRES | D64_FMT_FLI,