Convert Genesis tools to use EmulatorServices

This commit is contained in:
adelikat 2014-12-14 00:12:44 +00:00
parent 29d6859167
commit 5d59e00c20
2 changed files with 17 additions and 12 deletions
BizHawk.Client.EmuHawk/tools/Genesis

View File

@ -12,8 +12,13 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
[RequiredServices(typeof(IEmulator))]
public partial class GenGameGenie : Form, IToolForm
{
public IDictionary<Type, object> EmulatorServices { private get; set; }
private IEmulator Emulator { get { return (IEmulator)EmulatorServices[typeof(IEmulator)]; } }
private MemoryDomainList MemoryDomains { get { return (EmulatorServices[typeof(IMemoryDomains)] as IMemoryDomains).MemoryDomains; } }
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
{
{ 'A', 0 },
@ -50,8 +55,6 @@ namespace BizHawk.Client.EmuHawk
{ '9', 31 }
};
public IDictionary<Type, object> EmulatorServices { private get; set; }
private bool _processing;
private void GenGameGenie_Load(object sender, EventArgs e)
@ -70,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
if (Global.Emulator.SystemId != "GEN")
if (Emulator.SystemId != "GEN")
{
Close();
}
@ -78,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues()
{
if (Global.Emulator.SystemId != "GEN")
if (Emulator.SystemId != "GEN")
{
Close();
}
@ -360,7 +363,7 @@ namespace BizHawk.Client.EmuHawk
}
var watch = Watch.GenerateWatch(
Global.Emulator.AsMemoryDomains().MemoryDomains["MD CART"],
MemoryDomains["MD CART"],
address,
Watch.WatchSize.Word,
Watch.DisplayType.Hex,

View File

@ -12,20 +12,24 @@ using System.Drawing.Imaging;
namespace BizHawk.Client.EmuHawk
{
[RequiredServices(typeof(GPGX))]
public partial class GenVDPViewer : Form, IToolForm
{
public IDictionary<Type, object> EmulatorServices { private get; set; }
private GPGX Emu { get { return (GPGX)EmulatorServices[typeof(GPGX)]; } }
private LibGPGX.VDPView View = new LibGPGX.VDPView();
private GPGX Emu;
int palindex = 0;
public IDictionary<Type, object> EmulatorServices { private get; set; }
public GenVDPViewer()
{
InitializeComponent();
bmpViewTiles.ChangeBitmapSize(512, 256);
bmpViewPal.ChangeBitmapSize(16, 4);
Restart();
TopMost = Global.Config.GenVdpSettings.TopMost;
}
unsafe static void DrawTile(int* dest, int pitch, byte* src, int* pal)
@ -141,9 +145,6 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
Emu = Global.Emulator as GPGX;
if (Emu == null)
Close();
UpdateValues();
}
@ -259,11 +260,12 @@ namespace BizHawk.Client.EmuHawk
private void GenVDPViewer_Load(object sender, EventArgs e)
{
TopMost = Global.Config.GenVdpSettings.TopMost;
if (Global.Config.GenVdpSettings.UseWindowPosition)
{
Location = Global.Config.GenVdpSettings.WindowPosition;
}
Restart();
}
}
}