comparison tools/lib64fmts.c @ 2112:9dc2976e9fa3

Improve probing of packed and unpacked Koala files. Many converters and tools produce differently sized variants that were previously being mis-detected.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 25 May 2019 18:57:37 +0300
parents 7e4087e2740d
children 3fcf1c3a3287
comparison
equal deleted inserted replaced
2111:2d0db1e6b4a7 2112:9dc2976e9fa3
63 63
64 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 64 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
65 { 65 {
66 int score = DM_PROBE_SCORE_FALSE; 66 int score = DM_PROBE_SCORE_FALSE;
67 67
68 if (buf->len == 10003) 68 if (buf->len == 10003 ||
69 buf->len == 10004)
69 score += DM_PROBE_SCORE_MAYBE; 70 score += DM_PROBE_SCORE_MAYBE;
70 71
71 if (dmCompareAddr16(buf, 0, fmt->addr)) 72 if (dmCompareAddr16(buf, 0, fmt->addr))
72 score += DM_PROBE_SCORE_MAYBE; 73 score += DM_PROBE_SCORE_MAYBE;
73 74
77 78
78 static int fmtProbeKoalaPainterPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 79 static int fmtProbeKoalaPainterPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
79 { 80 {
80 // Attempt to prevent misprobes of unpacked Koala and Run Paint 81 // Attempt to prevent misprobes of unpacked Koala and Run Paint
81 if (buf->len > 30 && 82 if (buf->len > 30 &&
82 buf->len != 10006 && 83 buf->len < 10002 &&
83 buf->len != 10003 &&
84 dmCompareAddr16(buf, 0, fmt->addr)) 84 dmCompareAddr16(buf, 0, fmt->addr))
85 return DM_PROBE_SCORE_GOOD; 85 return DM_PROBE_SCORE_GOOD;
86 86
87 return DM_PROBE_SCORE_FALSE; 87 return DM_PROBE_SCORE_FALSE;
88 } 88 }