From 03bdbe08fb3518048d081085e725d5797e28753c Mon Sep 17 00:00:00 2001 From: qwertymodo Date: Thu, 17 Aug 2017 14:37:59 -0700 Subject: [PATCH] Adjust MSU-1 data ROM detection inside .msu1 packs --- msu1.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/msu1.cpp b/msu1.cpp index 51e15dd3..802d9697 100644 --- a/msu1.cpp +++ b/msu1.cpp @@ -191,6 +191,7 @@ ***********************************************************************************/ #include "snes9x.h" +#include "memmap.h" #include "display.h" #include "msu1.h" #include "apu/bapu/dsp/blargg_endian.h" @@ -380,21 +381,29 @@ void S9xMSU1Init(void) bool S9xMSU1ROMExists(void) { - struct stat buf; STREAM s = S9xMSU1OpenFile(".msu"); if (s) { CLOSE_STREAM(s); return true; } +#ifdef UNZIP_SUPPORT + char ext[_MAX_EXT + 1]; + _splitpath(Memory.ROMFilename, nullptr, nullptr, nullptr, ext); + if (!strcasecmp(ext, ".msu1")) + return true; - s = S9xMSU1OpenFile("msu1.rom"); - if (s) + unzFile unzFile = unzOpen(S9xGetFilename(".msu1", ROMFILENAME_DIR)); + + if(!unzFile) + unzFile = unzOpen(S9xGetFilename(".msu1", IPS_DIR)); + + if (unzFile) { - CLOSE_STREAM(s); + unzCloseCurrentFile(unzFile); return true; } - +#endif return false; }