diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index 6396d53efb..f81a1379f5 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -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 { } } diff --git a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs index 00e929ba92..85bf7dc035 100644 --- a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs +++ b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs @@ -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 { diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index d94ade818a..0ac0f96c3e 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -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) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 45da116251..9ddb13639c 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -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 { } } diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs index cbd3688661..d88e91f634 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs @@ -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 diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs index 0c597f0d44..e4f6fe7684 100644 --- a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs @@ -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"; } } diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs index 749fba2a27..cceeb0d371 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs @@ -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) diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs index 379bf58904..151f7cc3b5 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs @@ -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; } diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index af18988737..f1f0f1e9e9 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -20,6 +20,7 @@ namespace BizHawk int Frame { get; } int LagCount { get; set; } + bool IsLagFrame { get; } string SystemId { get; } bool DeterministicEmulation { get; set; } diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index c48c519f67..8467243c5f 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -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() diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index 00c653ce1a..d8a81f2ff8 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -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)); + } + } }