Remove .msu.zip extension support in favor of .msu1

This commit is contained in:
qwertymodo 2017-09-03 14:54:01 -07:00
parent b230e50ec5
commit 698bf1a4b2
2 changed files with 36 additions and 40 deletions

View File

@ -4257,38 +4257,6 @@ void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &r
} }
#ifdef UNZIP_SUPPORT #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")) if (!strcasecmp(ext, "zip") || !strcasecmp(ext, ".zip"))
{ {
unzFile file = unzOpen(rom_filename); unzFile file = unzOpen(rom_filename);
@ -4783,4 +4751,38 @@ void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &r
if (flag) if (flag)
return; 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
} }

View File

@ -248,18 +248,12 @@ STREAM S9xMSU1OpenFile(char *msu_ext)
printf("Using msu file %s.\n", filename); printf("Using msu file %s.\n", filename);
#ifdef UNZIP_SUPPORT #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) if (!file)
{ {
const char *zip_filename = S9xGetFilename(".msu.zip", ROMFILENAME_DIR); const char *zip_filename = S9xGetFilename(".msu1", ROMFILENAME_DIR);
unzFile unzFile = unzOpen(zip_filename); unzFile unzFile = unzOpen(zip_filename);
if (!unzFile)
{
zip_filename = S9xGetFilename(".msu1", ROMFILENAME_DIR);
unzFile = unzOpen(zip_filename);
}
if (!unzFile) if (!unzFile)
{ {
zip_filename = S9xGetFilename(".msu1", IPS_DIR); zip_filename = S9xGetFilename(".msu1", IPS_DIR);