From c7e1c39b28cb5c6d7baf6337dd8ead096f6253a4 Mon Sep 17 00:00:00 2001 From: kub Date: Sun, 26 Mar 2023 10:35:39 +0000 Subject: [PATCH] core, make system detection by extension case insensitive --- pico/media.c | 8 ++++---- pico/state.c | 2 +- platform/common/emu.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pico/media.c b/pico/media.c index ce0c24e8..fd33f476 100644 --- a/pico/media.c +++ b/pico/media.c @@ -51,7 +51,7 @@ static int detect_media(const char *fname, const unsigned char *rom, unsigned in } // detect wrong extensions - if (!strcmp(ext, "srm") || !strcmp(ext, "gz")) // s.gz ~ .mds.gz + if (!strcasecmp(ext, "srm") || !strcasecmp(ext, "gz")) // s.gz ~ .mds.gz return PM_BAD_DETECT; /* don't believe in extensions, except .cue and .chd */ @@ -356,13 +356,13 @@ enum media_type_e PicoLoadMedia(const char *filename, ext = NULL; } } - if (ext && !strcmp(ext,"gg") && !PicoIn.hwSelect) { + if (ext && !strcasecmp(ext,"gg") && !PicoIn.hwSelect) { PicoIn.AHW |= PAHW_GG; lprintf("detected GG ROM\n"); - } else if (ext && !strcmp(ext,"sg")) { + } else if (ext && !strcasecmp(ext,"sg")) { PicoIn.AHW |= PAHW_SG; lprintf("detected SG-1000 ROM\n"); - } else if (ext && !strcmp(ext,"sc")) { + } else if (ext && !strcasecmp(ext,"sc")) { PicoIn.AHW |= PAHW_SC; lprintf("detected SC-3000 ROM\n"); } else diff --git a/pico/state.c b/pico/state.c index 63d2b377..07c4ff4a 100644 --- a/pico/state.c +++ b/pico/state.c @@ -61,7 +61,7 @@ static void *open_save_file(const char *fname, int is_save) int len = strlen(fname); void *afile = NULL; - if (len > 3 && strcmp(fname + len - 3, ".gz") == 0) + if (len > 3 && strcasecmp(fname + len - 3, ".gz") == 0) { if ( (afile = gzopen(fname, is_save ? "wb" : "rb")) ) { set_cbs(1); diff --git a/platform/common/emu.c b/platform/common/emu.c index e0803cee..281fb0f8 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -399,7 +399,7 @@ int emu_reload_rom(const char *rom_fname_in) movie_data = 0; } - if (!strcmp(ext, ".gmv")) + if (!strcasecmp(ext, ".gmv")) { // check for both gmv and rom int dummy; @@ -436,7 +436,7 @@ int emu_reload_rom(const char *rom_fname_in) get_ext(rom_fname, ext); lprintf("gmv loaded for %s\n", rom_fname); } - else if (!strcmp(ext, ".pat")) + else if (!strcasecmp(ext, ".pat")) { int dummy; PicoPatchLoad(rom_fname); -- 2.39.5