convert some nes tools to EmulatorServices, currently they simply require a NES instance, eventually need to use an actual service, that all nes cores could implement
This commit is contained in:
parent
a8fd9c1fdf
commit
c1767a6fe7
|
@ -9,9 +9,12 @@ using BizHawk.Client.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
[RequiredServices(typeof(IEmulator), typeof(IMemoryDomains))]
|
||||||
public partial class NESGameGenie : Form, IToolForm
|
public partial class NESGameGenie : Form, IToolForm
|
||||||
{
|
{
|
||||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
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>
|
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
|
||||||
{
|
{
|
||||||
|
@ -45,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public bool UpdateBefore { get { return false; } }
|
public bool UpdateBefore { get { return false; } }
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (Global.Emulator.SystemId != "NES")
|
if (Emulator.SystemId != "NES")
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +56,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
if (Global.Emulator.SystemId != "NES")
|
if (Emulator.SystemId != "NES")
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -234,7 +237,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (!string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text))
|
if (!string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text))
|
||||||
{
|
{
|
||||||
var watch = Watch.GenerateWatch(
|
var watch = Watch.GenerateWatch(
|
||||||
Global.Emulator.AsMemoryDomains().MemoryDomains["System Bus"],
|
MemoryDomains["System Bus"],
|
||||||
AddressBox.ToRawInt().Value,
|
AddressBox.ToRawInt().Value,
|
||||||
Watch.WatchSize.Byte,
|
Watch.WatchSize.Byte,
|
||||||
Watch.DisplayType.Hex,
|
Watch.DisplayType.Hex,
|
||||||
|
|
|
@ -8,14 +8,15 @@ using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
[RequiredServices(typeof(NES))]
|
||||||
public partial class NESNameTableViewer : Form, IToolForm
|
public partial class NESNameTableViewer : Form, IToolForm
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
// Show Scroll Lines + UI Toggle
|
// Show Scroll Lines + UI Toggle
|
||||||
private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback();
|
|
||||||
private NES _nes;
|
|
||||||
|
|
||||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||||
|
private NES _nes { get { return (NES)EmulatorServices[typeof(NES)]; } }
|
||||||
|
|
||||||
|
private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback();
|
||||||
|
|
||||||
public NESNameTableViewer()
|
public NESNameTableViewer()
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Location = Global.Config.NesNameTableSettings.WindowPosition;
|
Location = Global.Config.NesNameTableSettings.WindowPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
_nes = Global.Emulator as NES;
|
|
||||||
RefreshRate.Value = Global.Config.NESNameTableRefreshRate;
|
RefreshRate.Value = Global.Config.NESNameTableRefreshRate;
|
||||||
Generate(true);
|
Generate(true);
|
||||||
}
|
}
|
||||||
|
@ -49,27 +49,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
Generate(true);
|
||||||
{
|
|
||||||
_nes = Global.Emulator as NES;
|
|
||||||
Generate(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
_nes.ppu.NTViewCallback = _callback;
|
||||||
{
|
|
||||||
(Global.Emulator as NES).ppu.NTViewCallback = _callback;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FastUpdate()
|
public void FastUpdate()
|
||||||
|
@ -179,12 +164,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_nes == null)
|
if (now == false && _nes.Frame % RefreshRate.Value != 0)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (now == false && Global.Emulator.Frame % RefreshRate.Value != 0)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
[RequiredServices(typeof(NES))]
|
||||||
public partial class NesPPU : Form, IToolForm
|
public partial class NesPPU : Form, IToolForm
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
|
@ -24,10 +25,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback();
|
private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback();
|
||||||
|
|
||||||
private Bitmap _zoomBoxDefaultImage = new Bitmap(64, 64);
|
private Bitmap _zoomBoxDefaultImage = new Bitmap(64, 64);
|
||||||
private NES _nes;
|
|
||||||
private bool _forceChange;
|
private bool _forceChange;
|
||||||
|
|
||||||
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
public IDictionary<Type, object> EmulatorServices { private get; set; }
|
||||||
|
private NES _nes { get { return (NES)EmulatorServices[typeof(NES)]; } }
|
||||||
|
|
||||||
public NesPPU()
|
public NesPPU()
|
||||||
{
|
{
|
||||||
|
@ -46,7 +47,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void NesPPU_Load(object sender, EventArgs e)
|
private void NesPPU_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadConfigSettings();
|
LoadConfigSettings();
|
||||||
_nes = Global.Emulator as NES;
|
|
||||||
ClearDetails();
|
ClearDetails();
|
||||||
RefreshRate.Value = Global.Config.NESPPURefreshRate;
|
RefreshRate.Value = Global.Config.NESPPURefreshRate;
|
||||||
Generate(true);
|
Generate(true);
|
||||||
|
@ -60,14 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
_nes.ppu.PPUViewCallback = _callback;
|
||||||
{
|
|
||||||
_nes.ppu.PPUViewCallback = _callback;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FastUpdate()
|
public void FastUpdate()
|
||||||
|
@ -77,16 +70,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
Generate(true);
|
||||||
{
|
CHRROMViewReload();
|
||||||
_nes = Global.Emulator as NES;
|
|
||||||
Generate(true);
|
|
||||||
CHRROMViewReload();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -186,7 +171,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Emulator.Frame % RefreshRate.Value == 0 || now)
|
if (_nes.Frame % RefreshRate.Value == 0 || now)
|
||||||
{
|
{
|
||||||
int b0;
|
int b0;
|
||||||
int b1;
|
int b1;
|
||||||
|
|
Loading…
Reference in New Issue