From bfe516c3a94ab9cc604c73771ea5d8908522d0dd Mon Sep 17 00:00:00 2001 From: kub Date: Wed, 21 Feb 2024 19:12:10 +0100 Subject: [PATCH] core, system detection by extension in zip files --- pico/media.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pico/media.c b/pico/media.c index 7c147b2f..63d3d997 100644 --- a/pico/media.c +++ b/pico/media.c @@ -138,16 +138,18 @@ static int detect_media(const char *fname, const unsigned char *rom, unsigned in extension_check: /* probably some headerless thing. Maybe check the extension after all. */ + ext_ptr = pmf && *pmf->ext ? pmf->ext : ext; + for (i = 0; i < ARRAY_SIZE(md_exts); i++) - if (strcasecmp(ext, md_exts[i]) == 0) + if (strcasecmp(ext_ptr, md_exts[i]) == 0) goto looks_like_md; for (i = 0; i < ARRAY_SIZE(sms_exts); i++) - if (strcasecmp(ext, sms_exts[i]) == 0) + if (strcasecmp(ext_ptr, sms_exts[i]) == 0) goto looks_like_sms; for (i = 0; i < ARRAY_SIZE(pico_exts); i++) - if (strcasecmp(ext, pico_exts[i]) == 0) + if (strcasecmp(ext_ptr, pico_exts[i]) == 0) goto looks_like_pico; /* If everything else fails, make a guess on the reset vector */ -- 2.39.5