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> /// </summary>
public List<byte[]> diskImages { get; set; } 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> /// <summary>
/// The index of the currently 'loaded' tape image /// The index of the currently 'loaded' tape image
/// </summary> /// </summary>
@ -57,7 +63,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// load the media into the tape device // load the media into the tape device
tapeMediaIndex = result; tapeMediaIndex = result;
// fire osd message // fire osd message
Spectrum.OSD_TapeInserted(); if (!IsLoadState)
Spectrum.OSD_TapeInserted();
LoadTapeMedia(); LoadTapeMedia();
} }
} }
@ -95,7 +103,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
diskMediaIndex = result; diskMediaIndex = result;
// fire osd message // fire osd message
Spectrum.OSD_DiskInserted(); if (!IsLoadState)
Spectrum.OSD_DiskInserted();
LoadDiskMedia(); LoadDiskMedia();
} }

View File

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