# HG changeset patch # User Matti Hamalainen # Date 1530415135 -10800 # Node ID 214c7bd8692f3453841e7bde02e2d987c2d92f44 # Parent 6af47b1009bad01d70ce423454ddc93ad90c4b5a Rename "MIL" to "Micro Illustrator" and improve probing of that format, at least based on the few samples I have. diff -r 6af47b1009ba -r 214c7bd8692f tools/lib64fmts.c --- 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