fix some PCE savestate desyncs

This commit is contained in:
beirich 2012-03-12 00:14:44 +00:00
parent 79d8f3d920
commit ca47082737
5 changed files with 100 additions and 40 deletions

View File

@ -75,6 +75,7 @@ namespace BizHawk.Emulation.CPUs.H6280
writer.WriteLine("S {0:X2}", S);
writer.Write("MPR ");
MPR.SaveAsHex(writer);
writer.WriteLine("LagIFlag {0}", LagIFlag);
writer.WriteLine("IRQ1Assert {0}", IRQ1Assert);
writer.WriteLine("IRQ2Assert {0}", IRQ2Assert);
writer.WriteLine("TimerAssert {0}", TimerAssert);
@ -116,6 +117,8 @@ namespace BizHawk.Emulation.CPUs.H6280
S = byte.Parse(args[1], NumberStyles.HexNumber);
else if (args[0] == "MPR")
MPR.ReadFromHex(args[1]);
else if (args[0] == "LagIFlag")
LagIFlag = bool.Parse(args[1]);
else if (args[0] == "IRQ1Assert")
IRQ1Assert = bool.Parse(args[1]);
else if (args[0] == "IRQ2Assert")
@ -164,6 +167,7 @@ namespace BizHawk.Emulation.CPUs.H6280
writer.Write(PC);
writer.Write(S);
writer.Write(MPR);
writer.Write(LagIFlag);
writer.Write(IRQ1Assert);
writer.Write(IRQ2Assert);
writer.Write(TimerAssert);
@ -194,6 +198,7 @@ namespace BizHawk.Emulation.CPUs.H6280
PC = reader.ReadUInt16();
S = reader.ReadByte();
MPR = reader.ReadBytes(8);
LagIFlag = reader.ReadBoolean();
IRQ1Assert = reader.ReadBoolean();
IRQ2Assert = reader.ReadBoolean();
TimerAssert = reader.ReadBoolean();

View File

@ -237,9 +237,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public void FrameAdvance(bool render)
{
lagged = true;
lagged = true;
Controller.UpdateControls(Frame++);
PSG.BeginFrame(Cpu.TotalExecutedCycles);
if (SuperGrafx)
@ -295,12 +294,18 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
writer.Write("PopulousRAM ");
PopulousRAM.SaveAsHex(writer);
}
if (BRAM != null)
{
writer.Write("BRAM ");
BRAM.SaveAsHex(writer);
}
writer.WriteLine("Frame {0}", Frame);
writer.WriteLine("Lag {0}", _lagcount);
if (Cpu.ReadMemory21 == ReadMemorySF2)
writer.WriteLine("SF2MapperLatch " + SF2MapperLatch);
writer.WriteLine("IOBuffer {0:X2}", IOBuffer);
writer.Write("CdIoPorts "); CdIoPorts.SaveAsHex(writer);
writer.WriteLine("BramLocked {0}", BramLocked);
writer.WriteLine();
if (SuperGrafx)
@ -352,38 +357,42 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
SF2MapperLatch = byte.Parse(args[1]);
else if (args[0] == "IOBuffer")
IOBuffer = byte.Parse(args[1], NumberStyles.HexNumber);
else if (args[0] == "CdIoPorts")
CdIoPorts.ReadFromHex(args[1]);
else if (args[0] == "RAM")
Ram.ReadFromHex(args[1]);
else if (args[0] == "CDRAM")
CDRam.ReadFromHex(args[1]);
else if (args[0] == "SuperRAM")
SuperRam.ReadFromHex(args[1]);
else if (args[0] == "PopulousRAM" && PopulousRAM != null)
PopulousRAM.ReadFromHex(args[1]);
else if (args[0] == "[HuC6280]")
Cpu.LoadStateText(reader);
else if (args[0] == "[PSG]")
PSG.LoadStateText(reader);
else if (args[0] == "[VCE]")
VCE.LoadStateText(reader);
else if (args[0] == "[VPC]")
VPC.LoadStateText(reader);
else if (args[0] == "[VDC1]")
VDC1.LoadStateText(reader, 1);
else if (args[0] == "[VDC2]")
VDC2.LoadStateText(reader, 2);
else if (args[0] == "[SCSI]")
SCSI.LoadStateText(reader);
else if (args[0] == "[CDAudio]")
CDAudio.LoadStateText(reader);
else if (args[0] == "[ADPCM]")
ADPCM.LoadStateText(reader);
else if (args[0] == "[ArcadeCard]")
LoadArcadeCardText(reader);
else
Console.WriteLine("Skipping unrecognized identifier " + args[0]);
else if (args[0] == "CdIoPorts")
{ CdIoPorts.ReadFromHex(args[1]); RefreshIRQ2(); }
else if (args[0] == "BramLocked")
BramLocked = bool.Parse(args[1]);
else if (args[0] == "RAM")
Ram.ReadFromHex(args[1]);
else if (args[0] == "BRAM")
BRAM.ReadFromHex(args[1]);
else if (args[0] == "CDRAM")
CDRam.ReadFromHex(args[1]);
else if (args[0] == "SuperRAM")
SuperRam.ReadFromHex(args[1]);
else if (args[0] == "PopulousRAM" && PopulousRAM != null)
PopulousRAM.ReadFromHex(args[1]);
else if (args[0] == "[HuC6280]")
Cpu.LoadStateText(reader);
else if (args[0] == "[PSG]")
PSG.LoadStateText(reader);
else if (args[0] == "[VCE]")
VCE.LoadStateText(reader);
else if (args[0] == "[VPC]")
VPC.LoadStateText(reader);
else if (args[0] == "[VDC1]")
VDC1.LoadStateText(reader, 1);
else if (args[0] == "[VDC2]")
VDC2.LoadStateText(reader, 2);
else if (args[0] == "[SCSI]")
SCSI.LoadStateText(reader);
else if (args[0] == "[CDAudio]")
CDAudio.LoadStateText(reader);
else if (args[0] == "[ADPCM]")
ADPCM.LoadStateText(reader);
else if (args[0] == "[ArcadeCard]")
LoadArcadeCardText(reader);
else
Console.WriteLine("Skipping unrecognized identifier " + args[0]);
}
}
@ -393,7 +402,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
{
writer.Write(Ram);
writer.Write(CdIoPorts);
RefreshIRQ2();
writer.Write(BramLocked);
if (BRAM != null)
writer.Write(BRAM);
if (PopulousRAM != null)
@ -438,7 +447,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
if (SuperGrafx == false)
{
Ram = reader.ReadBytes(0x2000);
CdIoPorts = reader.ReadBytes(16);
CdIoPorts = reader.ReadBytes(16); RefreshIRQ2();
BramLocked = reader.ReadBoolean();
if (BRAM != null)
BRAM = reader.ReadBytes(0x800);
if (PopulousRAM != null)
@ -480,8 +490,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public byte[] SaveStateBinary()
{
int buflen = 75887;
if (SuperGrafx) buflen += 90698;
int buflen = 75908;
if (SuperGrafx) buflen += 90700;
if (BramEnabled) buflen += 2048;
if (PopulousRAM != null) buflen += 0x8000;
if (SuperRam != null) buflen += 0x30000;

View File

@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
{
writer.WriteLine("[VCE]");
writer.WriteLine("VceAddress {0:X4}", VceAddress);
writer.WriteLine("CR {0}", DotClock);
writer.WriteLine("CR {0}", CR);
writer.Write("VceData ");
VceData.SaveAsHex(writer);
writer.WriteLine("[/VCE]\n");

View File

@ -309,6 +309,16 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
writer.WriteLine("RegisterLatch {0:X2}", RegisterLatch);
writer.WriteLine("ReadBuffer {0:X4}", ReadBuffer);
writer.WriteLine("StatusByte {0:X2}", StatusByte);
writer.WriteLine("DmaRequested {0}", DmaRequested);
writer.WriteLine("SatDmaRequested {0}", SatDmaRequested);
writer.WriteLine("SatDmaPerformed {0}", SatDmaPerformed);
writer.WriteLine("ScanLine {0}", ScanLine);
writer.WriteLine("BackgroundY {0}", BackgroundY);
writer.WriteLine("RCRCounter {0}", RCRCounter);
writer.WriteLine("ActiveLine {0}", ActiveLine);
writer.WriteLine("[/VDC"+vdcNo+"]\n");
}
@ -331,6 +341,23 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
ReadBuffer = ushort.Parse(args[1], NumberStyles.HexNumber);
else if (args[0] == "StatusByte")
StatusByte = byte.Parse(args[1], NumberStyles.HexNumber);
else if (args[0] == "DmaRequested")
DmaRequested = bool.Parse(args[1]);
else if (args[0] == "SatDmaRequested")
SatDmaRequested = bool.Parse(args[1]);
else if (args[0] == "SatDmaPerformed")
SatDmaPerformed = bool.Parse(args[1]);
else if (args[0] == "ScanLine")
ScanLine = int.Parse(args[1]);
else if (args[0] == "BackgroundY")
BackgroundY = int.Parse(args[1]);
else if (args[0] == "RCRCounter")
RCRCounter = int.Parse(args[1]);
else if (args[0] == "ActiveLine")
ActiveLine = int.Parse(args[1]);
else
Console.WriteLine("Skipping unrecognized identifier " + args[0]);
}
@ -356,6 +383,15 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
writer.Write(RegisterLatch);
writer.Write(ReadBuffer);
writer.Write(StatusByte);
writer.Write(DmaRequested);
writer.Write(SatDmaRequested);
writer.Write(SatDmaPerformed);
writer.Write(ScanLine);
writer.Write(BackgroundY);
writer.Write(RCRCounter);
writer.Write(ActiveLine);
}
public void LoadStateBinary(BinaryReader reader)
@ -374,6 +410,15 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
ReadBuffer = reader.ReadUInt16();
StatusByte = reader.ReadByte();
DmaRequested = reader.ReadBoolean();
SatDmaRequested = reader.ReadBoolean();
SatDmaPerformed = reader.ReadBoolean();
ScanLine = reader.ReadInt32();
BackgroundY = reader.ReadInt32();
RCRCounter = reader.ReadInt32();
ActiveLine = reader.ReadInt32();
CompleteMSBWrite(HDR);
CompleteMSBWrite(VDW);
}

View File

@ -1536,7 +1536,7 @@ C174B51C0CDAC640DBDB5280B16FDA4A D Zelda V1.0 - New Graphics by Gravis Zero (PD)
47699B03B7BA85CAE89EBD62E1CDAD79 D Zero Wing Intro V1.0 by Skaka (PD) PCE
EC58EA2CE8075C5725957DA099AC42F2 D Crash PCE
BFD494E0FC3A07D842A3F5717DD360D5 D Screen Dimension Test PCE
15107F07C3B7A65A7E784ADD44349961 D Tongueman's Logic (Final 1.0) PCE BRAM
15107F07C3B7A65A7E784ADD44349961 D Tongueman's Logic (Final 1.0) PCE BRAM
; ************ PCE/SGX hybrid ************