From: kub Date: Sun, 28 May 2023 13:56:55 +0000 (+0000) Subject: platform, basic msu-md support X-Git-Tag: v2.00~223 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02f3222feb0610b5ffd33f4139967dce829c8555;p=picodrive.git platform, basic msu-md support loading a .cue file will look for a cartridge image with the same basename and an extension of "gen", "smd", "md", "32x". --- diff --git a/platform/common/emu.c b/platform/common/emu.c index d75d6e44..0f4ae169 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -182,6 +182,21 @@ static const char *find_bios(int *region, const char *cd_fname) (*region == 8 ? "EU" : "JAP") : "USA"); } + // look for MSU.MD rom file. XXX another extension list? ugh... + static const char *md_exts[] = { "gen", "smd", "md", "32x" }; + char *ext = strrchr(cd_fname, '.'); + int extpos = ext ? ext-cd_fname : strlen(cd_fname); + strcpy(static_buff, cd_fname); + static_buff[extpos++] = '.'; + for (i = 0; i < ARRAY_SIZE(md_exts); i++) { + strcpy(static_buff+extpos, md_exts[i]); + if (access(static_buff, R_OK) == 0) { + printf("found MSU rom: %s\n",static_buff); + return static_buff; + } + } + + // locate BIOS file if (*region == 4) { // US files = biosfiles_us; count = sizeof(biosfiles_us) / sizeof(char *); diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index abbe3128..2504cf90 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -1274,6 +1274,22 @@ static const char *find_bios(int *region, const char *cd_fname) int i, count; FILE *f = NULL; + // look for MSU.MD rom file. XXX another extension list? ugh... + static const char *md_exts[] = { "gen", "smd", "md", "32x" }; + char *ext = strrchr(cd_fname, '.'); + int extpos = ext ? ext-cd_fname : strlen(cd_fname); + strcpy(path, cd_fname); + path[extpos++] = '.'; + for (i = 0; i < ARRAY_SIZE(md_exts); i++) { + strcpy(path+extpos, md_exts[i]); + f = fopen(path, "rb"); + if (f != NULL) { + log_cb(RETRO_LOG_INFO, "found MSU rom: %s\n", path); + fclose(f); + return path; + } + } + if (*region == 4) { // US files = biosfiles_us; count = sizeof(biosfiles_us) / sizeof(char *);