Convert more tools to EmulatorServices
This commit is contained in:
parent
c1767a6fe7
commit
b12f4c36b1
|
@ -8,12 +8,13 @@ using BizHawk.Emulation.Cores.PCEngine;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[RequiredServices(typeof(PCEngine))]
|
||||
public partial class PceBgViewer : Form, IToolForm
|
||||
{
|
||||
private PCEngine _pce;
|
||||
private int _vdcType;
|
||||
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
private PCEngine _pce { get { return (PCEngine)EmulatorServices[typeof(PCEngine)]; } }
|
||||
|
||||
private int _vdcType;
|
||||
|
||||
public PceBgViewer()
|
||||
{
|
||||
|
@ -30,8 +31,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PceBgViewer_Load(object sender, EventArgs e)
|
||||
{
|
||||
_pce = Global.Emulator as PCEngine;
|
||||
|
||||
if (Global.Config.PceBgViewerSettings.UseWindowPosition)
|
||||
{
|
||||
Location = Global.Config.PceBgViewerSettings.WindowPosition;
|
||||
|
@ -59,7 +58,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public unsafe void Generate()
|
||||
{
|
||||
if (Global.Emulator.Frame % RefreshRate.Value != 0)
|
||||
if (_pce.Frame % RefreshRate.Value != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -105,26 +104,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Restart()
|
||||
{
|
||||
if (Global.Emulator is PCEngine)
|
||||
{
|
||||
_pce = Global.Emulator as PCEngine;
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
if (Global.Emulator is PCEngine)
|
||||
{
|
||||
Generate();
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
Generate();
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
|
|
|
@ -14,18 +14,24 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[RequiredServices(typeof(PCEngine), typeof(IMemoryDomains))]
|
||||
public partial class PCECDL : Form, IToolForm
|
||||
{
|
||||
// TODO
|
||||
private PCEngine _emu;
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
|
||||
// TODO: you shouldn't require this
|
||||
private PCEngine _emu { get { return (PCEngine)EmulatorServices[typeof(PCEngine)]; } }
|
||||
|
||||
// TODO: make this an emulator service
|
||||
private CodeDataLog _cdl;
|
||||
|
||||
private MemoryDomainList MemoryDomains { get { return (EmulatorServices[typeof(IMemoryDomains)] as IMemoryDomains).MemoryDomains; } }
|
||||
|
||||
private string _currentFileName = string.Empty;
|
||||
|
||||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
|
||||
public PCECDL()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -59,19 +65,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Restart()
|
||||
{
|
||||
if (Global.Emulator is PCEngine)
|
||||
{
|
||||
_emu = (PCEngine)Global.Emulator;
|
||||
LoggingActiveCheckbox.Checked = _emu.Cpu.CDLLoggingActive;
|
||||
_cdl = _emu.Cpu.CDL;
|
||||
_emu.InitCDLMappings();
|
||||
UpdateDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
_emu = null;
|
||||
Close();
|
||||
}
|
||||
LoggingActiveCheckbox.Checked = _emu.Cpu.CDLLoggingActive;
|
||||
_cdl = _emu.Cpu.CDL;
|
||||
_emu.InitCDLMappings();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
private void UpdateDisplay()
|
||||
|
@ -307,7 +304,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using (var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
_cdl.Disassemble(fs, Global.Emulator.AsMemoryDomains().MemoryDomains);
|
||||
_cdl.Disassemble(fs, MemoryDomains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,11 @@ using ICSharpCode.SharpZipLib.Zip;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[RequiredServices(typeof(PCEngine))]
|
||||
public partial class PCESoundDebugger : Form, IToolForm
|
||||
{
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
private PCEngine _pce { get { return (PCEngine)EmulatorServices[typeof(PCEngine)]; } }
|
||||
|
||||
public PCESoundDebugger()
|
||||
{
|
||||
|
@ -44,10 +46,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void UpdateValues()
|
||||
{
|
||||
var pce = Global.Emulator as PCEngine;
|
||||
if (pce == null)
|
||||
return;
|
||||
|
||||
foreach(var entry in PSGEntries)
|
||||
{
|
||||
entry.wasactive = entry.active;
|
||||
|
@ -60,7 +58,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
for(int i=0;i<6;i++)
|
||||
{
|
||||
var ch = pce.PSG.Channels[i];
|
||||
var ch = _pce.PSG.Channels[i];
|
||||
|
||||
//these conditions mean a sample isnt playing
|
||||
if (!ch.Enabled)
|
||||
|
@ -281,11 +279,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void lvChEn_ItemChecked(object sender, ItemCheckedEventArgs e)
|
||||
{
|
||||
var pce = Global.Emulator as PCEngine;
|
||||
if (pce == null)
|
||||
return;
|
||||
for (int i = 0; i < 6; i++)
|
||||
pce.PSG.UserMute[i] = !lvChEn.Items[i].Checked;
|
||||
_pce.PSG.UserMute[i] = !lvChEn.Items[i].Checked;
|
||||
}
|
||||
|
||||
private void PCESoundDebugger_Load(object sender, EventArgs e)
|
||||
|
|
|
@ -13,17 +13,18 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[RequiredServices(typeof(PCEngine))]
|
||||
public partial class PCETileViewer : Form, IToolForm
|
||||
{
|
||||
private PCEngine emu;
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
private PCEngine emu { get { return (PCEngine)EmulatorServices[typeof(PCEngine)]; } }
|
||||
|
||||
private VDC vdc;
|
||||
private VCE vce;
|
||||
|
||||
private int bgpalnum;
|
||||
private int sppalnum;
|
||||
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
|
||||
public PCETileViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -31,8 +32,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
bmpViewSP.ChangeBitmapSize(512, 256);
|
||||
bmpViewBGPal.ChangeBitmapSize(256, 256);
|
||||
bmpViewSPPal.ChangeBitmapSize(256, 256);
|
||||
|
||||
Restart();
|
||||
}
|
||||
|
||||
#region IToolForm
|
||||
|
@ -149,13 +148,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator is PCEngine))
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
emu = (PCEngine)Global.Emulator;
|
||||
|
||||
vce = emu.VCE;
|
||||
|
||||
if (emu.SystemId == "SGX")
|
||||
|
@ -272,11 +264,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PCETileViewer_Load(object sender, EventArgs e)
|
||||
{
|
||||
vce = emu.VCE;
|
||||
TopMost = Global.Config.PceVdpSettings.TopMost;
|
||||
if (Global.Config.PceVdpSettings.UseWindowPosition)
|
||||
{
|
||||
Location = Global.Config.PceVdpSettings.WindowPosition;
|
||||
}
|
||||
|
||||
Restart();
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
|
|
|
@ -6,6 +6,7 @@ using BizHawk.Emulation.Cores.Calculators;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[RequiredServices(typeof(TI83))]
|
||||
public partial class TI83KeyPad : Form, IToolForm
|
||||
{
|
||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||
|
@ -41,10 +42,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void UpdateValues()
|
||||
{
|
||||
if (!(Global.Emulator is TI83))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void FastUpdate()
|
||||
|
@ -54,10 +52,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator is TI83))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in New Issue