ZXHawk: do not fire tape/disk inserted OSD messages on LoadState - closes #1250

This commit is contained in:
Asnivor 2018-08-06 13:00:57 +01:00
parent 084baf39ad
commit 92c3264ff7
2 changed files with 20 additions and 2 deletions

View File

@ -25,6 +25,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// </summary>
public List<byte[]> diskImages { get; set; }
/// <summary>
/// Set when a savestate is loaded
/// (Used to cancel any tape/disk load messages after a loadstate)
/// </summary>
public bool IsLoadState;
/// <summary>
/// The index of the currently 'loaded' tape image
/// </summary>
@ -57,7 +63,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// load the media into the tape device
tapeMediaIndex = result;
// fire osd message
Spectrum.OSD_TapeInserted();
if (!IsLoadState)
Spectrum.OSD_TapeInserted();
LoadTapeMedia();
}
}
@ -95,7 +103,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
diskMediaIndex = result;
// fire osd message
Spectrum.OSD_DiskInserted();
if (!IsLoadState)
Spectrum.OSD_DiskInserted();
LoadDiskMedia();
}

View File

@ -369,13 +369,22 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
ser.Sync("tapeMediaIndex", ref tapeMediaIndex);
if (ser.IsReader)
{
IsLoadState = true;
TapeMediaIndex = tapeMediaIndex;
IsLoadState = false;
}
TapeDevice.SyncState(ser);
ser.Sync("diskMediaIndex", ref diskMediaIndex);
if (ser.IsReader)
{
IsLoadState = true;
DiskMediaIndex = diskMediaIndex;
IsLoadState = false;
}
if (UPDDiskDevice != null)
{