Convert TraceLogger to EmulatorServices

This commit is contained in:
adelikat 2014-12-14 01:45:24 +00:00
parent 24526669fe
commit e6ea5bdf70
1 changed files with 7 additions and 24 deletions

View File

@ -14,9 +14,12 @@ using BizHawk.Client.EmuHawk.WinFormExtensions;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[RequiredServices(typeof(IDebuggable))]
public partial class TraceLogger : Form, IToolForm public partial class TraceLogger : Form, IToolForm
{ {
private readonly ITracer Tracer; public IDictionary<Type, object> EmulatorServices { private get; set; }
private ITracer Tracer { get { return (EmulatorServices[typeof(IDebuggable)] as IDebuggable).Tracer; } }
// Refresh rate slider // Refresh rate slider
// Make faster, such as not saving to disk until the logging is stopped, dont' add to Instructions list every frame, etc // Make faster, such as not saving to disk until the logging is stopped, dont' add to Instructions list every frame, etc
@ -26,8 +29,6 @@ namespace BizHawk.Client.EmuHawk
private int _defaultWidth; private int _defaultWidth;
private int _defaultHeight; private int _defaultHeight;
public IDictionary<Type, object> EmulatorServices { private get; set; }
public TraceLogger() public TraceLogger()
{ {
InitializeComponent(); InitializeComponent();
@ -37,15 +38,6 @@ namespace BizHawk.Client.EmuHawk
TopMost = Global.Config.TraceLoggerSettings.TopMost; TopMost = Global.Config.TraceLoggerSettings.TopMost;
Closing += (o, e) => SaveConfigSettings(); Closing += (o, e) => SaveConfigSettings();
if (Global.Emulator.CpuTraceAvailable())
{
Tracer = Global.Emulator.AsDebuggable().Tracer;
}
else
{
Close();
}
} }
public bool UpdateBefore public bool UpdateBefore
@ -123,18 +115,9 @@ namespace BizHawk.Client.EmuHawk
{ {
return; return;
} }
else
{ ClearList();
if (Global.Emulator.CpuTraceAvailable()) TraceView.Columns[0].Text = Tracer.Header;
{
ClearList();
TraceView.Columns[0].Text = Tracer.Header;
}
else
{
Close();
}
}
} }
private void ClearList() private void ClearList()