Coleco - some minor refactoring

This commit is contained in:
adelikat 2012-11-24 14:17:56 +00:00
parent 4ffce9e5f9
commit f7032a1c33
2 changed files with 19 additions and 11 deletions

View File

@ -73,12 +73,12 @@ namespace BizHawk.Emulation.Consoles.Coleco
public void FrameAdvance(bool render, bool renderSound) public void FrameAdvance(bool render, bool renderSound)
{ {
Frame++; Frame++;
IsLagFrame = true; islag = true;
PSG.BeginFrame(Cpu.TotalExecutedCycles); PSG.BeginFrame(Cpu.TotalExecutedCycles);
VDP.ExecuteFrame(); VDP.ExecuteFrame();
PSG.EndFrame(Cpu.TotalExecutedCycles); PSG.EndFrame(Cpu.TotalExecutedCycles);
if (IsLagFrame) if (islag)
LagCount++; LagCount++;
} }
@ -165,7 +165,7 @@ namespace BizHawk.Emulation.Consoles.Coleco
writer.WriteLine("Frame {0}", Frame); writer.WriteLine("Frame {0}", Frame);
writer.WriteLine("Lag {0}", _lagcount); writer.WriteLine("Lag {0}", _lagcount);
writer.WriteLine("IsLagFrame {0}", IsLagFrame); writer.WriteLine("islag {0}", islag);
writer.Write("RAM "); writer.Write("RAM ");
Ram.SaveAsHex(writer); Ram.SaveAsHex(writer);
writer.WriteLine("[/Coleco]"); writer.WriteLine("[/Coleco]");
@ -183,8 +183,8 @@ namespace BizHawk.Emulation.Consoles.Coleco
Frame = int.Parse(args[1]); Frame = int.Parse(args[1]);
else if (args[0] == "Lag") else if (args[0] == "Lag")
_lagcount = int.Parse(args[1]); _lagcount = int.Parse(args[1]);
else if (args[0] == "IsLagFrame") else if (args[0] == "islag")
IsLagFrame = bool.Parse(args[1]); islag = bool.Parse(args[1]);
else if (args[0] == "RAM") else if (args[0] == "RAM")
Ram.ReadFromHex(args[1]); Ram.ReadFromHex(args[1]);
else if (args[0] == "[Z80]") else if (args[0] == "[Z80]")
@ -216,7 +216,7 @@ namespace BizHawk.Emulation.Consoles.Coleco
writer.Write(Frame); writer.Write(Frame);
writer.Write(_lagcount); writer.Write(_lagcount);
writer.Write(IsLagFrame); writer.Write(islag);
writer.Write(Ram); writer.Write(Ram);
} }
@ -228,7 +228,7 @@ namespace BizHawk.Emulation.Consoles.Coleco
Frame = reader.ReadInt32(); Frame = reader.ReadInt32();
_lagcount = reader.ReadInt32(); _lagcount = reader.ReadInt32();
IsLagFrame = reader.ReadBoolean(); islag = reader.ReadBoolean();
Ram = reader.ReadBytes(Ram.Length); Ram = reader.ReadBytes(Ram.Length);
} }

View File

@ -27,7 +27,7 @@
byte ReadController1() byte ReadController1()
{ {
IsLagFrame = false; islag = false;
if (InputPortSelection == InputPortMode.Left) if (InputPortSelection == InputPortMode.Left)
{ {
@ -71,7 +71,7 @@
byte ReadController2() byte ReadController2()
{ {
IsLagFrame = false; islag = false;
if (InputPortSelection == InputPortMode.Left) if (InputPortSelection == InputPortMode.Left)
{ {
@ -114,7 +114,15 @@
public int Frame { get; set; } public int Frame { get; set; }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } } public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get; private set; } public bool IsLagFrame
private int _lagcount = 0; {
get
{
return islag;
}
}
private int _lagcount = 0;
private bool islag = true;
} }
} }