SMS/Coleco, refactor to remove PostLoadState() calls

This commit is contained in:
beirich 2014-04-07 03:09:44 +00:00
parent ac27f4451c
commit 6ca5768a31
6 changed files with 23 additions and 43 deletions

View File

@ -216,12 +216,12 @@ namespace BizHawk.Emulation.Common.Components
ser.Sync("PsgLatch", ref PsgLatch);
ser.Sync("Panning", ref stereoPanning);
ser.EndSection();
}
public void PostLoadState()
{
StereoPanning = stereoPanning;
UpdateNoiseType(Channels[3].NoiseType);
if (ser.IsReader)
{
StereoPanning = stereoPanning;
UpdateNoiseType(Channels[3].NoiseType);
}
}
public int MaxVolume { get; set; }

View File

@ -42,12 +42,10 @@ namespace BizHawk.Emulation.Common.Components
ser.Sync("RegisterLatch", ref RegisterLatch);
ser.Sync("Registers", ref opll.reg, false);
ser.EndSection();
}
public void PostLoadState()
{
for (byte i = 0; i < opll.reg.Length; i++)
Write(i, opll.reg[i]);
if (ser.IsReader)
for (byte i = 0; i < opll.reg.Length; i++)
Write(i, opll.reg[i]);
}
public void Reset()

View File

@ -170,9 +170,9 @@ namespace BizHawk.Emulation.Cores.ColecoVision
public bool BinarySaveStatesPreferred { get { return false; } }
public void SaveStateBinary(BinaryWriter bw) { SyncState(Serializer.CreateBinaryWriter(bw)); }
public void LoadStateBinary(BinaryReader br) { SyncState(Serializer.CreateBinaryReader(br)); PostLoadState(); }
public void LoadStateBinary(BinaryReader br) { SyncState(Serializer.CreateBinaryReader(br)); }
public void SaveStateText(TextWriter tw) { SyncState(Serializer.CreateTextWriter(tw)); }
public void LoadStateText(TextReader tr) { SyncState(Serializer.CreateTextReader(tr)); PostLoadState(); }
public void LoadStateText(TextReader tr) { SyncState(Serializer.CreateTextReader(tr)); }
void SyncState(Serializer ser)
{
@ -187,12 +187,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
ser.EndSection();
}
void PostLoadState()
{
VDP.PostLoadState();
PSG.PostLoadState();
}
byte[] stateBuffer;
public byte[] SaveStateBinary()
{

View File

@ -481,12 +481,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
ser.Sync("Registers", ref Registers, false);
ser.Sync("VRAM", ref VRAM, false);
ser.EndSection();
}
public void PostLoadState()
{
for (int i = 0; i < Registers.Length; i++)
WriteRegister(i, Registers[i]);
if (ser.IsReader)
for (int i = 0; i < Registers.Length; i++)
WriteRegister(i, Registers[i]);
}
}
}

View File

@ -332,9 +332,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
public bool BinarySaveStatesPreferred { get { return false; } }
public void SaveStateBinary(BinaryWriter bw) { SyncState(Serializer.CreateBinaryWriter(bw)); }
public void LoadStateBinary(BinaryReader br) { SyncState(Serializer.CreateBinaryReader(br)); PostLoadState(); }
public void LoadStateBinary(BinaryReader br) { SyncState(Serializer.CreateBinaryReader(br)); }
public void SaveStateText(TextWriter tw) { SyncState(Serializer.CreateTextWriter(tw)); }
public void LoadStateText(TextReader tr) { SyncState(Serializer.CreateTextReader(tr)); PostLoadState(); }
public void LoadStateText(TextReader tr) { SyncState(Serializer.CreateTextReader(tr)); }
void SyncState(Serializer ser)
{
@ -369,14 +369,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
ser.EndSection();
}
void PostLoadState()
{
Vdp.PostLoadState();
PSG.PostLoadState();
if (HasYM2413)
YM2413.PostLoadState();
}
byte[] stateBuffer;
public byte[] SaveStateBinary()
{

View File

@ -416,17 +416,15 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
ser.Sync("CRAM", ref CRAM, false);
ser.Sync("VRAM", ref VRAM, false);
ser.EndSection();
}
public void PostLoadState()
{
for (int i = 0; i < Registers.Length; i++)
WriteRegister(i, Registers[i]);
for (ushort i = 0; i < VRAM.Length; i++)
UpdatePatternBuffer(i, VRAM[i]);
UpdatePrecomputedPalette();
if (ser.IsReader)
{
for (int i = 0; i < Registers.Length; i++)
WriteRegister(i, Registers[i]);
for (ushort i = 0; i < VRAM.Length; i++)
UpdatePatternBuffer(i, VRAM[i]);
UpdatePrecomputedPalette();
}
}
public int[] GetVideoBuffer()