Mercurial > hg > dmlib
changeset 2187:ec47c60d26e2
Improve Crest Super Hires FLI probing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 12 Jun 2019 21:47:29 +0300 |
parents | dc8a443accdf |
children | 9b7d5e219d4b |
files | tools/lib64fmts.c |
diffstat | 1 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64fmts.c Wed Jun 12 21:30:58 2019 +0300 +++ b/tools/lib64fmts.c Wed Jun 12 21:47:29 2019 +0300 @@ -1222,21 +1222,35 @@ } -static const Uint8 fmtCrestSHFLI_MagicID_1[] = +#define DM_CREST_SHFLI_BANKS 8 +#define DM_CREST_SHFLI_PTRS 8 +static const Uint8 fmtCrestSHFLI_Sprite_pointers[DM_CREST_SHFLI_BANKS][DM_CREST_SHFLI_PTRS] = { - 0x80, 0x84, 0x85, 0x89, 0x8A, 0x8E, 0x8F, 0x93 + { 0x80, 0x84, 0x85, 0x89, 0x8A, 0x8E, 0x8F, 0x93 }, + { 0x94, 0x98, 0x99, 0x9D, 0x9E, 0xA2, 0xA3, 0xA7 }, + { 0xA8, 0xAC, 0xAD, 0xB1, 0xB2, 0xB6, 0xB7, 0xBB }, + { 0xBC, 0xC0, 0xC1, 0xC5, 0xC6, 0xCA, 0xCB, 0xCF }, + { 0xD0, 0xD4, 0xD5, 0xD9, 0xDA, 0xDE, 0xDF, 0xE3 }, + { 0xE4, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE }, + { 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6 }, + { 0xF7, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E }, }; static int fmtProbeCrestSHFLI(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { + // Unpacked variant if (buf->len == fmt->size && dmCompareAddr16(buf, 0, fmt->addr)) { - if (DM_MEMCMP_SIZE(buf->data + 0x03f8 + 2, fmtCrestSHFLI_MagicID_1) == 0) - return DM_PROBE_SCORE_MAX; - else - return DM_PROBE_SCORE_MAYBE; + int score = DM_PROBE_SCORE_MAYBE; + for (int nbank = 0; nbank < DM_CREST_SHFLI_BANKS; nbank++) + { + if (memcmp(buf->data + 2 + (nbank * 0x0400) + 0x03f8, + fmtCrestSHFLI_Sprite_pointers[nbank], DM_CREST_SHFLI_PTRS) == 0) + score += DM_PROBE_SCORE_GOOD; + } + return score; } return DM_PROBE_SCORE_FALSE;