comparison tools/lib64fmts.c @ 1594:afb49736615a

Implement packed Koala Painter probing.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 May 2018 06:38:58 +0300
parents a77876a07425
children b5e0f28f1842
comparison
equal deleted inserted replaced
1593:a77876a07425 1594:afb49736615a
30 { 0x95, 0x95, 0x95, 0xff }, 30 { 0x95, 0x95, 0x95, 0xff },
31 }; 31 };
32 32
33 33
34 34
35 static int fmtProbeKoalaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
36 {
37 // Attempt to prevent misprobes of unpacked Koala and Run Paint
38 if (len > 30 &&
39 len != 10006 &&
40 len != fmt->size &&
41 dmCompareAddr16(buf, 0, fmt->addr))
42 return DM_PROBE_SCORE_MAX;
43
44 return DM_PROBE_SCORE_FALSE;
45 }
46
47
35 static int fmtDecodeKoalaPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 48 static int fmtDecodeKoalaPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
36 { 49 {
37 int res; 50 int res;
38 DMGrowBuf mem; 51 DMGrowBuf mem;
39 DMCompParams cfg; 52 DMCompParams cfg;
713 726
714 { 727 {
715 D64_FMT_MC, "klp", "Koala Paint (packed)", 0x6000, 0, DM_FMT_RDWR, 728 D64_FMT_MC, "klp", "Koala Paint (packed)", 0x6000, 0, DM_FMT_RDWR,
716 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, 729 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
717 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, 730 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
718 NULL, 731 fmtProbeKoalaPaintPacked,
719 fmtDecodeKoalaPaintPacked, fmtEncodeKoalaPaintPacked, 732 fmtDecodeKoalaPaintPacked, fmtEncodeKoalaPaintPacked,
720 NULL, NULL, 733 NULL, NULL,
721 NULL, 734 NULL,
722 { }, &dmC64CommonFormatOps[0] 735 { }, &dmC64CommonFormatOps[0]
723 }, 736 },