From 698bf1a4b2470a2aa0e98bd4fc282542b982d711 Mon Sep 17 00:00:00 2001 From: qwertymodo Date: Sun, 3 Sep 2017 14:54:01 -0700 Subject: [PATCH] Remove .msu.zip extension support in favor of .msu1 --- memmap.cpp | 66 ++++++++++++++++++++++++++++-------------------------- msu1.cpp | 10 ++------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/memmap.cpp b/memmap.cpp index 6e2534ee..c9927c43 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -4257,38 +4257,6 @@ void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &r } #ifdef UNZIP_SUPPORT - // Mercurial Magic (MSU-1 distribution pack) - if (strcasecmp(ext, "msu1") && strcasecmp(ext, ".msu1")) - { - _makepath(fname, drive, dir, name, "msu1"); - unzFile msu1file = unzOpen(fname); - - if (!msu1file) - { - _snprintf(fname, sizeof(fname), "%s" SLASH_STR "%s%s", - S9xGetDirectory(IPS_DIR), name, ".msu1"); - msu1file = unzOpen(fname); - } - - if (msu1file) - { - int port = unzFindExtension(msu1file, "bps"); - if (port == UNZ_OK) - { - printf(" in %s", fname); - - Stream *s = new unzStream(msu1file); - ret = ReadBPSPatch(s, offset, rom_size); - s->closeStream(); - - if (ret) - printf("!\n"); - else - printf(" failed!\n"); - } - } - } - if (!strcasecmp(ext, "zip") || !strcasecmp(ext, ".zip")) { unzFile file = unzOpen(rom_filename); @@ -4783,4 +4751,38 @@ void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &r if (flag) return; } + +#ifdef UNZIP_SUPPORT + // Mercurial Magic (MSU-1 distribution pack) + if (strcasecmp(ext, "msu1") && strcasecmp(ext, ".msu1")) + { + _makepath(fname, drive, dir, name, "msu1"); + unzFile msu1file = unzOpen(fname); + + if (!msu1file) + { + _snprintf(fname, sizeof(fname), "%s" SLASH_STR "%s%s", + S9xGetDirectory(IPS_DIR), name, ".msu1"); + msu1file = unzOpen(fname); + } + + if (msu1file) + { + int port = unzFindExtension(msu1file, "bps"); + if (port == UNZ_OK) + { + printf(" in %s", fname); + + Stream *s = new unzStream(msu1file); + ret = ReadBPSPatch(s, offset, rom_size); + s->closeStream(); + + if (ret) + printf("!\n"); + else + printf(" failed!\n"); + } + } + } +#endif } diff --git a/msu1.cpp b/msu1.cpp index 802d9697..9e8c8901 100644 --- a/msu1.cpp +++ b/msu1.cpp @@ -248,18 +248,12 @@ STREAM S9xMSU1OpenFile(char *msu_ext) printf("Using msu file %s.\n", filename); #ifdef UNZIP_SUPPORT - // look for msu file in .msu1 (Mercurial Magic pack) or .msu.zip if not found in rom dir + // look for msu1 pack file in the rom or patch dir if msu data file not found in rom dir if (!file) { - const char *zip_filename = S9xGetFilename(".msu.zip", ROMFILENAME_DIR); + const char *zip_filename = S9xGetFilename(".msu1", ROMFILENAME_DIR); unzFile unzFile = unzOpen(zip_filename); - if (!unzFile) - { - zip_filename = S9xGetFilename(".msu1", ROMFILENAME_DIR); - unzFile = unzOpen(zip_filename); - } - if (!unzFile) { zip_filename = S9xGetFilename(".msu1", IPS_DIR);