diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 64477023..5f92766a 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1376,7 +1376,7 @@ static void MB_DSUninit() //============================================================================= -void MB_InitSoundcardType(void) // GH#609 +static void InitSoundcardType(void) { g_SoundcardType = CT_Empty; // Use CT_Empty to mean: no soundcard g_bPhasorEnable = false; @@ -1384,7 +1384,7 @@ void MB_InitSoundcardType(void) // GH#609 void MB_Initialize() { - MB_InitSoundcardType(); + InitSoundcardType(); LogFileOutput("MB_Initialize: g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard); if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard) @@ -1418,6 +1418,12 @@ void MB_Initialize() g_bCritSectionValid = true; } +void MB_InitializeForLoadingSnapshot() // GH#609 +{ + MB_Reset(); + InitSoundcardType(); +} + //----------------------------------------------------------------------------- // NB. Called when /g_fCurrentCLK6502/ changes @@ -1460,15 +1466,16 @@ static void ResetState() g_bMB_RegAccessedFlag = false; g_bMB_Active = false; - //g_bMBAvailable = false; - -// g_SoundcardType = CT_Empty; // Don't uncomment, else _ASSERT will fire in MB_Read() after an F2->MB_Reset() -// g_bPhasorEnable = false; g_nPhasorMode = 0; g_PhasorClockScaleFactor = 1; + + // Not these, as they don't change on a CTRL+RESET or power-cycle: +// g_bMBAvailable = false; +// g_SoundcardType = CT_Empty; // Don't uncomment, else _ASSERT will fire in MB_Read() after an F2->MB_Reset() +// g_bPhasorEnable = false; } -void MB_Reset() +void MB_Reset() // CTRL+RESET or power-cycle { if(!g_bDSAvailable) return; diff --git a/source/Mockingboard.h b/source/Mockingboard.h index 028dbbb1..1486adc1 100644 --- a/source/Mockingboard.h +++ b/source/Mockingboard.h @@ -4,7 +4,7 @@ void MB_Initialize(); void MB_Reinitialize(); void MB_Destroy(); void MB_Reset(); -void MB_InitSoundcardType(void); +void MB_InitializeForLoadingSnapshot(void); void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5); void MB_Mute(); void MB_Demute(); diff --git a/source/SaveState.cpp b/source/SaveState.cpp index 707059dc..f566a9dd 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -391,8 +391,7 @@ static void Snapshot_LoadState_v2(void) HD_Reset(); KeybReset(); VideoResetState(); - MB_Reset(); - MB_InitSoundcardType(); // GH#609 + MB_InitializeForLoadingSnapshot(); // GH#609 sg_SSC.CommReset(); #ifdef USE_SPEECH_API g_Speech.Reset();