changeset 1734:183d503b17a7

Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 08 Jun 2018 22:14:13 +0300
parents 59c2b08a80a6
children eeb6a82b4654
files tools/lib64fmts.c
diffstat 1 files changed, 54 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Fri Jun 08 22:09:24 2018 +0300
+++ b/tools/lib64fmts.c	Fri Jun 08 22:14:13 2018 +0300
@@ -736,6 +736,40 @@
 }
 
 
+static BOOL fmtECIGetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
+    const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    (void) op;
+    (void) buf;
+    (void) fmt;
+    img->laceType = D64_ILACE_COLOR;
+    return TRUE;
+}
+
+
+static Uint8 fmtGetPixelECI(
+    const DMC64Image *img, const int bmoffs, const int scroffs,
+    const int shift, const int bitmap, const int raster)
+{
+    const int vbank = raster & 7;
+    Uint8
+        c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank    , 0, 0),
+        c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0);
+
+    (void) bitmap;
+    return (c1 * C64_NCOLORS) + c2;
+}
+
+
+static int fmtECIConvertBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt)
+{
+    if (!dmSetMixedColorC64Palette(dst))
+        return DMERR_MALLOC;
+
+    return dmC64ConvertGenericBMP2Image(dst, src, fmt);
+}
+
+
 //
 // Helper macros for defining screen ram layouts
 // common for FLI type foramts
@@ -1143,6 +1177,26 @@
     },
 
     {
+        D64_FMT_HIRES | D64_FMT_FLI,
+        "eci", "ECI Graphic Editor 1.0 (unpacked)", 0x4000, 32770, DM_FMT_RD,
+        C64_SCR_WIDTH, C64_SCR_HEIGHT,
+        C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
+        NULL,
+        NULL, NULL,
+        fmtECIConvertBMP2Image, NULL,
+        fmtGetPixelECI,
+        {
+            { DO_COPY     , DS_BITMAP_RAM  , 0x0000, 0,  0, NULL, NULL },
+            DEF_SCREEN_RAMS_8(0x2000, 0, 0x400),
+            { DO_COPY     , DS_BITMAP_RAM  , 0x4000, 1,  0, NULL, NULL },
+            DEF_SCREEN_RAMS_8(0x6000, 8, 0x400),
+            { DO_DEC_FUNC , 0              , 0     , 0,  0, fmtECIGetLaceType, NULL },
+            { DO_LAST     , 0              , 0     , 0,  0, NULL, NULL },
+        },
+        NULL
+    },
+
+    {
         D64_FMT_MC, "xx1", "Unknown $2000 format (unpacked)", 0x2000, 10242, DM_FMT_RDWR,
         C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,