# HG changeset patch # User Matti Hamalainen # Date 1528485253 -10800 # Node ID 183d503b17a7f58e9ce2e43375098d89ea840849 # Parent 59c2b08a80a6b43c4528b3a42c6e785b14c495e7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format. diff -r 59c2b08a80a6 -r 183d503b17a7 tools/lib64fmts.c --- 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,