From bdae0c359bd4bb588ff649e205cf0ea59270f28d Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 1 Jan 2015 19:15:32 +0000 Subject: [PATCH] VirtualPad - use an IEmulator service and remove references to Global.Emulator --- .../tools/VirtualPads/VirtualpadsTool.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs index 7bc749726b..a6b1ca534e 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs @@ -5,12 +5,22 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; +using BizHawk.Emulation.Common; using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk { public partial class VirtualpadTool : Form, IToolFormAutoConfig { + [RequiredService] + private IEmulator Emulator { get; set; } + + [ConfigPersist] + public bool StickyPads { get; set; } + + [ConfigPersist] + public bool ClearAlsoClearsAnalog { get; set; } + private bool _readOnly; private List Pads @@ -37,13 +47,6 @@ namespace BizHawk.Client.EmuHawk } } - [ConfigPersist] - public bool StickyPads { get; set; } - - [ConfigPersist] - public bool ClearAlsoClearsAnalog { get; set; } - - public VirtualpadTool() { StickyPads = true; @@ -85,14 +88,14 @@ namespace BizHawk.Client.EmuHawk .Any()) .FirstOrDefault(t => t.GetCustomAttributes(false) .OfType() - .First().SystemId == Global.Emulator.SystemId); + .First().SystemId == Emulator.SystemId); if (schemaType != null) { var padschemas = (Activator.CreateInstance(schemaType) as IVirtualPadSchema).GetPadSchemas(); if (VersionInfo.DeveloperBuild) { - CheckPads(padschemas, Global.Emulator.ControllerDefinition); + CheckPads(padschemas, Emulator.ControllerDefinition); } var pads = padschemas.Select(s => new VirtualPad(s));