Add LagCounter int to IEmulator, returns 0 on every emulator at the moment. Hook up RenderPanel's LagCounter display

This commit is contained in:
andres.delikat 2011-05-01 00:20:39 +00:00
parent a4f4c59e9c
commit 2fa3561c45
9 changed files with 23 additions and 0 deletions

View File

@ -663,6 +663,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
}
public int Frame {get; set;}
public int LagCount { get { return 0; } }
public bool DeterministicEmulation { get { return true; } set { } }

View File

@ -652,6 +652,8 @@ namespace BizHawk.Emulation.Consoles.Gameboy
get { throw new NotImplementedException(); }
}
public int LagCount { get { return 0; } } //TODO: implement
public byte[] SaveRam
{
get { throw new NotImplementedException(); }

View File

@ -215,6 +215,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int _frame;
public int Frame { get { return _frame; } set { _frame = value; } }
public int LagCount { get { return 0; } } //TODO: implement this
public bool DeterministicEmulation { get { return true; } set { } }

View File

@ -96,6 +96,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
}
public int Frame { get; set; }
public int LagCount { get { return 0; } } //TODO: Implement this
public void FrameAdvance(bool render)
{

View File

@ -140,6 +140,7 @@ namespace BizHawk.Emulation.Consoles.Sega
}
public int Frame { get; set; }
public int LagCount { get { return 0; } } //TODO: Implement
public bool DeterministicEmulation { get; set; }
public string SystemId { get { return "GEN"; } }

View File

@ -45,6 +45,7 @@ namespace BizHawk.Emulation.Consoles.Sega
public bool HasYM2413 = false;
public int Frame { get; set; }
public int LagCount { get { return 0; } } //TODO: implement this
private byte Port01 = 0xFF;
private byte Port02 = 0xFF;
private byte Port3E = 0xAF;

View File

@ -33,6 +33,7 @@ namespace BizHawk
public void SetControllersAsMnemonic(string mnemonic) { return; }
public int Frame { get; set; }
public int LagCount { get { return 0; } }
public byte[] SaveRam { get { return new byte[0]; } }
public bool DeterministicEmulation { get; set; }
public bool SaveRamModified { get; set; }

View File

@ -19,6 +19,7 @@ namespace BizHawk
void FrameAdvance(bool render);
int Frame { get; }
int LagCount { get; }
string SystemId { get; }
bool DeterministicEmulation { get; set; }

View File

@ -277,6 +277,15 @@ namespace BizHawk.MultiClient
MessageFont.DrawString(null, FPS.ToString() + " fps", Global.Config.DispFPSx,
Global.Config.DispFPSy, Color.FromArgb(Global.Config.MessagesColor));
}
if (Global.Config.DisplayLagCounter)
{
//TODO: lag counter should do something on a lag frame, turn red (or another color if messages color = red?), and perhaps a larger font
MessageFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx + 1,
Global.Config.DispLagy + 1, new Color4(Color.Black));
MessageFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx,
Global.Config.DispLagy, Color.FromArgb(Global.Config.MessagesColor));
}
}
private string MakeFrameCounter()
@ -292,6 +301,11 @@ namespace BizHawk.MultiClient
}
}
private string MakeLagCounter()
{
return Global.Emulator.LagCount.ToString();
}
private List<UIMessage> messages = new List<UIMessage>(5);
public void AddMessage(string message)