# HG changeset patch # User Matti Hamalainen # Date 1526269138 -10800 # Node ID afb49736615accb4c6561f6827666d4239599216 # Parent a77876a07425586712785235f4c4774b83539abb Implement packed Koala Painter probing. diff -r a77876a07425 -r afb49736615a tools/lib64fmts.c --- a/tools/lib64fmts.c Mon May 14 06:37:29 2018 +0300 +++ b/tools/lib64fmts.c Mon May 14 06:38:58 2018 +0300 @@ -32,6 +32,19 @@ +static int fmtProbeKoalaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) +{ + // Attempt to prevent misprobes of unpacked Koala and Run Paint + if (len > 30 && + len != 10006 && + len != fmt->size && + dmCompareAddr16(buf, 0, fmt->addr)) + return DM_PROBE_SCORE_MAX; + + return DM_PROBE_SCORE_FALSE; +} + + static int fmtDecodeKoalaPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { int res; @@ -715,7 +728,7 @@ D64_FMT_MC, "klp", "Koala Paint (packed)", 0x6000, 0, DM_FMT_RDWR, C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, - NULL, + fmtProbeKoalaPaintPacked, fmtDecodeKoalaPaintPacked, fmtEncodeKoalaPaintPacked, NULL, NULL, NULL,