# HG changeset patch # User Matti Hamalainen # Date 1528816800 -10800 # Node ID a7f9e12bcd9bf04e1da80387fc298847517b70d3 # Parent aa427e68e1149c0ee27c46235c547da35dff8eb8 Improve probing of FunPaint 2 packed vs. unpacked format variants. diff -r aa427e68e114 -r a7f9e12bcd9b tools/lib64fmts.c --- a/tools/lib64fmts.c Tue Jun 12 17:56:35 2018 +0300 +++ b/tools/lib64fmts.c Tue Jun 12 18:20:00 2018 +0300 @@ -576,9 +576,17 @@ if (len > 30 && dmCompareAddr16(buf, 0, fmt->addr) && memcmp(buf + 2, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0) - return DM_PROBE_SCORE_MAX; - else - return DM_PROBE_SCORE_FALSE; + { + // Unpacked variant + if (fmt->size != 0 && buf[14 + 2] == 0) + return DM_PROBE_SCORE_MAX; + + // Packed variant + if (fmt->size == 0 && buf[14 + 2] != 0) + return DM_PROBE_SCORE_MAX; + } + + return DM_PROBE_SCORE_FALSE; } @@ -1510,7 +1518,7 @@ { "fp2p", "FunPaint II (packed)", 0x3ff0, 0, DM_FMT_RDWR, - NULL, + fmtProbeFunPaint2, fmtDecodeFunPaint2, fmtEncodeFunPaint2Packed, { }, &dmC64CommonFormats[3] },