Mercurial > hg > dmlib
diff tools/lib64fmts.c @ 1840:8d6bb48f2806
Implement support for packed variant of Doodle format.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Jun 2018 19:02:49 +0300 |
parents | 666b27999570 |
children | fc4841460fad |
line wrap: on
line diff
--- a/tools/lib64fmts.c Fri Jun 22 19:01:23 2018 +0300 +++ b/tools/lib64fmts.c Fri Jun 22 19:02:49 2018 +0300 @@ -23,6 +23,24 @@ } +static int fmtProbeDoodle(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) +{ + if (buf->len > 32 && + (dmCompareAddr16(buf, 0, 0x1c00) || dmCompareAddr16(buf, 0, 0x5c00))) + { + // Packed variant + if (fmt->size == 0xfe && buf->len != fmt->size) + return DM_PROBE_SCORE_MAX; + + // Unpacked variant + if (fmt->size != 0xfe && buf->len == fmt->size) + return DM_PROBE_SCORE_MAX; + } + + return DM_PROBE_SCORE_FALSE; +} + + static int fmtDecodeStaticRLEMarkerMode2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { int res; @@ -1150,6 +1168,19 @@ { DO_LAST , 0 , 0 , 0, 0, NULL, NULL }, } }, + + { // #10: Doodle + D64_FMT_HIRES, + C64_SCR_WIDTH , C64_SCR_HEIGHT, + C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, + NULL, NULL, + NULL, + { + { DO_COPY , DS_SCREEN_RAM , 0x0000, 0, 0, NULL, NULL }, + { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, NULL, NULL }, + { DO_LAST , 0 , 0 , 0, 0, NULL, NULL }, + } + }, }; @@ -1497,21 +1528,16 @@ { "dd", "Doodle (unpacked)", 0x1c00, 9218, DM_FMT_RDWR, - NULL, + fmtProbeDoodle, NULL, NULL, - { - D64_FMT_HIRES, - C64_SCR_WIDTH , C64_SCR_HEIGHT, - C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT, - NULL, NULL, - NULL, - { - { DO_COPY , DS_SCREEN_RAM , 0x0000, 0, 0, NULL, NULL }, - { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, NULL, NULL }, - { DO_LAST , 0 , 0 , 0, 0, NULL, NULL }, - } - }, - NULL + { }, &dmC64CommonFormats[10] + }, + + { + "jj", "Doodle (packed)", 0x5c00, 0xfe, DM_FMT_RDWR, // size is abused for RLE marker byte + fmtProbeDoodle, + fmtDecodeStaticRLEMarkerMode2, fmtEncodeStaticRLEMarkerMode2, + { }, &dmC64CommonFormats[10] }, {