Save-state: Explicitly init MB SoundcardType when loading state. (Fixes #609)

This commit is contained in:
tomcw 2019-02-23 10:22:52 +00:00
parent 11137cbc44
commit f998c7ddb2
4 changed files with 16 additions and 10 deletions

View File

@ -1663,9 +1663,10 @@ void MemInitializeIO(void)
{
ConfigureSoftcard(pCxRomPeripheral, 5); // $C500 : Z80 card
}
else
if (g_Slot5 == CT_SAM)
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
else if (g_Slot5 == CT_SAM)
{
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
}
DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w

View File

@ -1376,13 +1376,20 @@ static void MB_DSUninit()
//=============================================================================
void MB_InitSoundcardType(void) // GH#609
{
g_SoundcardType = CT_Empty; // Use CT_Empty to mean: no soundcard
g_bPhasorEnable = false;
}
void MB_Initialize()
{
MB_InitSoundcardType();
LogFileOutput("MB_Initialize: g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
{
MockingboardVoice.bMute = true;
g_SoundcardType = CT_Empty;
}
else
{
@ -2108,9 +2115,7 @@ bool MB_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
AY8910_InitClock((int)CLK_6502);
// Setup in MB_InitializeIO() -> MB_SetSoundcardType()
g_SoundcardType = CT_Empty;
g_bPhasorEnable = false;
// NB. g_SoundcardType & g_bPhasorEnable setup in MB_InitializeIO() -> MB_SetSoundcardType()
return true;
}
@ -2233,9 +2238,7 @@ bool Phasor_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version
AY8910_InitClock((int)(CLK_6502 * g_PhasorClockScaleFactor));
// Setup in MB_InitializeIO() -> MB_SetSoundcardType()
g_SoundcardType = CT_Empty;
g_bPhasorEnable = false;
// NB. g_SoundcardType & g_bPhasorEnable setup in MB_InitializeIO() -> MB_SetSoundcardType()
return true;
}

View File

@ -4,6 +4,7 @@ void MB_Initialize();
void MB_Reinitialize();
void MB_Destroy();
void MB_Reset();
void MB_InitSoundcardType(void);
void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5);
void MB_Mute();
void MB_Demute();

View File

@ -405,6 +405,7 @@ static void Snapshot_LoadState_v2(void)
KeybReset();
VideoResetState();
MB_Reset();
MB_InitSoundcardType(); // GH#609
sg_SSC.CommReset();
#ifdef USE_SPEECH_API
g_Speech.Reset();