diff --git a/cpu.cpp b/cpu.cpp index 154b1b34..474fba8a 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -295,6 +295,7 @@ void S9xReset (void) S9xResetPPU(); S9xResetDMA(); S9xResetAPU(); + S9xResetMSU(); if (Settings.DSP) S9xResetDSP(); @@ -331,6 +332,7 @@ void S9xSoftReset (void) S9xSoftResetPPU(); S9xResetDMA(); S9xSoftResetAPU(); + S9xResetMSU(); if (Settings.DSP) S9xResetDSP(); diff --git a/memmap.cpp b/memmap.cpp index fd8f5ac1..c964c465 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -1275,12 +1275,6 @@ static bool8 is_GNEXT_Add_On (const uint8 *data, uint32 size) return (FALSE); } -static bool8 MsuRomExists (void) -{ - struct stat buf; - return (stat(S9xGetFilename(".msu", ROMFILENAME_DIR), &buf) == 0); -} - int CMemory::ScoreHiROM (bool8 skip_header, int32 romoff) { uint8 *buf = ROM + 0xff00 + romoff + (skip_header ? 0x200 : 0); @@ -2547,7 +2541,7 @@ void CMemory::InitROM (void) } // MSU1 - Settings.MSU1 = MsuRomExists(); + Settings.MSU1 = S9xMSU1ROMExists(); //// Map memory and calculate checksum diff --git a/msu1.cpp b/msu1.cpp index 6b75bfb2..daa69897 100644 --- a/msu1.cpp +++ b/msu1.cpp @@ -251,7 +251,7 @@ bool DataOpen() return dataFile.is_open(); } -void S9xMSU1Init(void) +void S9xResetMSU(void) { MSU1.MSU1_STATUS = 0; MSU1.MSU1_DATA_SEEK = 0; @@ -277,9 +277,21 @@ void S9xMSU1Init(void) if (audioFile.is_open()) audioFile.close(); + Settings.MSU1 = S9xMSU1ROMExists(); +} + +void S9xMSU1Init(void) +{ + S9xResetMSU(); DataOpen(); } +bool S9xMSU1ROMExists(void) +{ + struct stat buf; + return (stat(S9xGetFilename(".msu", ROMFILENAME_DIR), &buf) == 0); +} + void S9xMSU1Generate(int sample_count) { partial_samples += 441000 * sample_count; diff --git a/msu1.h b/msu1.h index 6192a783..04a22941 100644 --- a/msu1.h +++ b/msu1.h @@ -226,7 +226,9 @@ enum SMSU1_CMD { extern struct SMSU1 MSU1; +void S9xResetMSU(void); void S9xMSU1Init(void); +bool S9xMSU1ROMExists(void); void S9xMSU1Generate(int sample_count); uint8 S9xMSU1ReadPort(int port); void S9xMSU1WritePort(int port, uint8 byte);