Add IsLagFrame bool to IEmulator and implement in all platforms. Make an alert font in Render panel and make input display use it when a frame is a lag frame

This commit is contained in:
andres.delikat 2011-05-01 16:04:53 +00:00
parent b70e0eff76
commit f440f843dd
11 changed files with 50 additions and 3 deletions

View File

@ -640,7 +640,12 @@ namespace BizHawk.Emulation.Consoles.Calculator
}
Controller.UpdateControls(Frame++);
if (lagged)
{
_lagcount++;
islag = true;
}
else
islag = false;
}
public void HardReset()
@ -667,8 +672,10 @@ namespace BizHawk.Emulation.Consoles.Calculator
private int _lagcount = 0;
private bool lagged = true;
private bool islag = false;
public int Frame {get; set;}
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } }
public bool DeterministicEmulation { get { return true; } set { } }

View File

@ -653,6 +653,7 @@ namespace BizHawk.Emulation.Consoles.Gameboy
}
public int LagCount { get { return -1; } set { return; } } //TODO: implement
public bool IsLagFrame { get { return false; } } //TODO: implement
public byte[] SaveRam
{

View File

@ -79,7 +79,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo
resetSignal = Controller["Reset"];
ppu.FrameAdvance();
if (lagged)
{
_lagcount++;
islag = true;
}
else
islag = false;
}
protected void RunCpu(int ppu_cycles)

View File

@ -216,8 +216,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int _frame;
int _lagcount;
bool lagged = true;
bool islag = false;
public int Frame { get { return _frame; } set { _frame = value; } }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } }
public bool DeterministicEmulation { get { return true; } set { } }

View File

@ -97,8 +97,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
private int _lagcount = 0;
private bool lagged = true;
private bool islag = false;
public int Frame { get; set; }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } } //TODO: Implement this
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } }
public void FrameAdvance(bool render)
{
@ -114,7 +116,12 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
PSG.EndFrame(Cpu.TotalExecutedCycles);
if (lagged)
{
_lagcount++;
islag = true;
}
else
islag = false;
}
public IVideoProvider VideoProvider

View File

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

View File

@ -46,8 +46,10 @@ namespace BizHawk.Emulation.Consoles.Sega
private int _lagcount = 0;
private bool lagged = true;
private bool islag = false;
public int Frame { get; set; }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } } //TODO: implement this
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } }
private byte Port01 = 0xFF;
private byte Port02 = 0xFF;
private byte Port3E = 0xAF;
@ -179,7 +181,12 @@ namespace BizHawk.Emulation.Consoles.Sega
Vdp.ExecFrame(render);
PSG.EndFrame(Cpu.TotalExecutedCycles);
if (lagged)
{
_lagcount++;
islag = true;
}
else
islag = false;
}
public void SaveStateText(TextWriter writer)

View File

@ -34,6 +34,7 @@ namespace BizHawk
public int Frame { get; set; }
public int LagCount { get { return 0; } set { return; } }
public bool IsLagFrame { get { return false; } }
public byte[] SaveRam { get { return new byte[0]; } }
public bool DeterministicEmulation { get; set; }

View File

@ -20,6 +20,7 @@ namespace BizHawk
int Frame { get; }
int LagCount { get; set; }
bool IsLagFrame { get; }
string SystemId { get; }
bool DeterministicEmulation { get; set; }

View File

@ -1514,6 +1514,7 @@ namespace BizHawk.MultiClient
{
//Hide platform specific menus until an appropriate ROM is loaded
NESToolStripMenuItem.Visible = false;
tI83ToolStripMenuItem.Visible = false;
}
private void OpenROM()

View File

@ -153,6 +153,7 @@ namespace BizHawk.MultiClient
public ImageTexture Texture;
private Sprite Sprite;
private Font MessageFont;
private Font AlertFont;
public Direct3DRenderPanel(Direct3D direct3D, Control control)
{
@ -199,6 +200,9 @@ namespace BizHawk.MultiClient
Sprite = new Sprite(Device);
Texture = new ImageTexture(Device);
MessageFont = new Font(Device, 16, 0, FontWeight.Bold, 1, false, CharacterSet.Default, Precision.Default, FontQuality.Default, PitchAndFamily.Default | PitchAndFamily.DontCare, "Arial");
AlertFont = new Font(Device, 20, 0, FontWeight.ExtraBold, 1, true, CharacterSet.Default, Precision.Default, FontQuality.Default, PitchAndFamily.Default | PitchAndFamily.DontCare, "Arial");
}
public void Render()
@ -283,8 +287,18 @@ namespace BizHawk.MultiClient
//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,
if (Global.Emulator.IsLagFrame)
{
AlertFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx,
Global.Config.DispLagy, Color.Red);
}
else
{
MessageFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx,
Global.Config.DispLagy, Color.FromArgb(Global.Config.MessagesColor));
}
}
}