From f0e6574defe1175bb0c9e4a0f84a168deaba4faa Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 4 Dec 2016 11:31:07 -0600 Subject: [PATCH] Similar property in Multihawk --- BizHawk.Client.MultiHawk/Mainform.cs | 42 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.MultiHawk/Mainform.cs b/BizHawk.Client.MultiHawk/Mainform.cs index 494562256e..a5b7ef329f 100644 --- a/BizHawk.Client.MultiHawk/Mainform.cs +++ b/BizHawk.Client.MultiHawk/Mainform.cs @@ -107,6 +107,14 @@ namespace BizHawk.Client.MultiHawk }; } + // TODO: make this an actual property, set it when loading a Rom, and pass it dialogs, etc + // This is a quick hack to reduce the dependency on Global.Emulator + public IEmulator Emulator + { + get { return Global.Emulator; } + set { Global.Emulator = value; } + } + private static bool StateErrorAskUser(string title, string message) { var result = MessageBox.Show( @@ -191,7 +199,7 @@ namespace BizHawk.Client.MultiHawk } Global.ClientControls = controls; - Global.AutofireNullControls = new AutofireController(NullEmulator.NullController, Global.Emulator); + Global.AutofireNullControls = new AutofireController(NullEmulator.NullController, Emulator); } private void OpenRomMenuItem_Click(object sender, EventArgs e) @@ -272,7 +280,7 @@ namespace BizHawk.Client.MultiHawk if (EmulatorWindows.First() == ew) { - Global.Emulator = ew.Emulator; + Emulator = ew.Emulator; } return true; @@ -363,7 +371,7 @@ namespace BizHawk.Client.MultiHawk if (EmulatorWindows.Count == 1) { - Global.Emulator = ew.Emulator; + Emulator = ew.Emulator; } _inputManager.SyncControls(); @@ -629,7 +637,7 @@ namespace BizHawk.Client.MultiHawk // TODO //Global.ActiveController.ApplyAxisConstraints( - // (Global.Emulator is N64 && Global.Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); + // (Emulator is N64 && Global.Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController); Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer); @@ -1192,7 +1200,7 @@ namespace BizHawk.Client.MultiHawk try { - Global.MovieSession.QueueNewMovie(movie, record, Global.Emulator); + Global.MovieSession.QueueNewMovie(movie, record, Emulator); } catch (MoviePlatformMismatchException ex) { @@ -1202,7 +1210,7 @@ namespace BizHawk.Client.MultiHawk RebootCoresMenuItem_Click(null, null); - Global.Emulator = EmulatorWindows.Master.Emulator; + Emulator = EmulatorWindows.Master.Emulator; if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) { @@ -1272,15 +1280,15 @@ namespace BizHawk.Client.MultiHawk EmulatorWindows.Remove(ew); WorkspacePanel.Controls.Remove(ew); - if (ew.Emulator == Global.Emulator) + if (ew.Emulator == Emulator) { if (EmulatorWindows.Any()) { - Global.Emulator = EmulatorWindows.Master.Emulator; + Emulator = EmulatorWindows.Master.Emulator; } else { - Global.Emulator = null; + Emulator = null; } } } @@ -1474,33 +1482,33 @@ namespace BizHawk.Client.MultiHawk private void ViewSubMenu_DropDownOpened(object sender, EventArgs e) { - _1xMenuItem.Checked = Global.Config.TargetZoomFactors[Global.Emulator.SystemId] == 1; - _2xMenuItem.Checked = Global.Config.TargetZoomFactors[Global.Emulator.SystemId] == 2; - _3xMenuItem.Checked = Global.Config.TargetZoomFactors[Global.Emulator.SystemId] == 3; - _4xMenuItem.Checked = Global.Config.TargetZoomFactors[Global.Emulator.SystemId] == 4; + _1xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 1; + _2xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 2; + _3xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 3; + _4xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 4; } private void _1xMenuItem_Click(object sender, EventArgs e) { - Global.Config.TargetZoomFactors[Global.Emulator.SystemId] = 1; + Global.Config.TargetZoomFactors[Emulator.SystemId] = 1; ReRenderAllWindows(); } private void _2xMenuItem_Click(object sender, EventArgs e) { - Global.Config.TargetZoomFactors[Global.Emulator.SystemId] = 2; + Global.Config.TargetZoomFactors[Emulator.SystemId] = 2; ReRenderAllWindows(); } private void _3xMenuItem_Click(object sender, EventArgs e) { - Global.Config.TargetZoomFactors[Global.Emulator.SystemId] = 3; + Global.Config.TargetZoomFactors[Emulator.SystemId] = 3; ReRenderAllWindows(); } private void _4xMenuItem_Click(object sender, EventArgs e) { - Global.Config.TargetZoomFactors[Global.Emulator.SystemId] = 4; + Global.Config.TargetZoomFactors[Emulator.SystemId] = 4; ReRenderAllWindows(); }