From acd928afa537910370818fe40d99756f088c7dae Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 7 Jun 2020 13:13:39 -0500 Subject: [PATCH] move InputManager from Global to GlobalWin --- src/BizHawk.Client.Common/Global.cs | 2 +- src/BizHawk.Client.EmuHawk/Api/ClientApi.cs | 10 ++-- .../Api/Libraries/InputApi.cs | 2 +- .../Api/Libraries/JoypadApi.cs | 18 +++---- .../DisplayManager/OSDManager.cs | 14 ++--- src/BizHawk.Client.EmuHawk/GlobalWin.cs | 1 + src/BizHawk.Client.EmuHawk/MainForm.cs | 54 +++++++++---------- .../tools/BasicBot/BasicBot.cs | 6 +-- .../tools/TAStudio/TAStudio.ListView.cs | 4 +- .../tools/TAStudio/TAStudio.cs | 2 +- .../tools/TAStudio/TAStudioClipboard.cs | 4 +- .../tools/TI83/TI83KeyPad.cs | 2 +- .../controls/VirtualPadAnalogButton.cs | 8 +-- .../controls/VirtualPadAnalogStick.cs | 8 +-- .../VirtualPads/controls/VirtualPadButton.cs | 8 +-- .../controls/VirtualPadDiscManager.cs | 2 +- .../controls/VirtualPadTargetScreen.cs | 12 ++--- .../controls/components/AnalogStickPanel.cs | 4 +- 18 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/BizHawk.Client.Common/Global.cs b/src/BizHawk.Client.Common/Global.cs index af401c56ab..18e5a2117f 100644 --- a/src/BizHawk.Client.Common/Global.cs +++ b/src/BizHawk.Client.Common/Global.cs @@ -2,6 +2,6 @@ { public static class Global { - public static InputManager InputManager { get; } = new InputManager(); + } } diff --git a/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs b/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs index a035228895..2f99c59ee3 100644 --- a/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs @@ -243,13 +243,13 @@ namespace BizHawk.Client.EmuHawk if (joypad.Inputs == 0) { - Global.InputManager.AutofireStickyXorAdapter.ClearStickies(); + GlobalWin.InputManager.AutofireStickyXorAdapter.ClearStickies(); } else { foreach (var button in JoypadButtonsArray.Where(button => joypad.Inputs.HasFlag(button))) { - Global.InputManager.AutofireStickyXorAdapter.SetSticky( + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky( RunningSystem == SystemInfo.GB ? $"{JoypadConverter.ConvertBack(button, RunningSystem)}" : $"P{player} {JoypadConverter.ConvertBack(button, RunningSystem)}", @@ -263,8 +263,8 @@ namespace BizHawk.Client.EmuHawk { for (var i = 1; i <= RunningSystem.MaxControllers; i++) { - Global.InputManager.AutofireStickyXorAdapter.SetAxis($"P{i} X Axis", _allJoyPads[i - 1].AnalogX); - Global.InputManager.AutofireStickyXorAdapter.SetAxis($"P{i} Y Axis", _allJoyPads[i - 1].AnalogY); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetAxis($"P{i} X Axis", _allJoyPads[i - 1].AnalogX); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetAxis($"P{i} Y Axis", _allJoyPads[i - 1].AnalogY); } } #endif @@ -281,7 +281,7 @@ namespace BizHawk.Client.EmuHawk /// private static void GetAllInputs() { - var joypadAdapter = Global.InputManager.AutofireStickyXorAdapter; + var joypadAdapter = GlobalWin.InputManager.AutofireStickyXorAdapter; var pressedButtons = joypadAdapter.Definition.BoolButtons.Where(b => joypadAdapter.IsPressed(b)); diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs index 77e2a2f8c2..ace1be94bb 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk public Dictionary Get() { var buttons = new Dictionary(); - foreach (var kvp in Global.InputManager.ControllerInputCoalescer.BoolButtons().Where(kvp => kvp.Value)) buttons[kvp.Key] = true; + foreach (var kvp in GlobalWin.InputManager.ControllerInputCoalescer.BoolButtons().Where(kvp => kvp.Value)) buttons[kvp.Key] = true; return buttons; } diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/JoypadApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/JoypadApi.cs index e6c6242831..3cda297783 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/JoypadApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/JoypadApi.cs @@ -18,12 +18,12 @@ namespace BizHawk.Client.EmuHawk public IDictionary Get(int? controller = null) { - return Global.InputManager.AutofireStickyXorAdapter.ToDictionary(controller); + return GlobalWin.InputManager.AutofireStickyXorAdapter.ToDictionary(controller); } public IDictionary GetImmediate(int? controller = null) { - return Global.InputManager.ActiveController.ToDictionary(controller); + return GlobalWin.InputManager.ActiveController.ToDictionary(controller); } public void SetFromMnemonicStr(string inputLogEntry) @@ -38,15 +38,15 @@ namespace BizHawk.Client.EmuHawk LogCallback($"invalid mnemonic string: {inputLogEntry}"); return; } - foreach (var button in controller.Definition.BoolButtons) Global.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); - foreach (var axis in controller.Definition.AxisControls) Global.InputManager.ButtonOverrideAdapter.SetAxis(axis, controller.AxisValue(axis)); + foreach (var button in controller.Definition.BoolButtons) GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); + foreach (var axis in controller.Definition.AxisControls) GlobalWin.InputManager.ButtonOverrideAdapter.SetAxis(axis, controller.AxisValue(axis)); } public void Set(Dictionary buttons, int? controller = null) { // If a controller is specified, we need to iterate over unique button names. If not, we iterate over // ALL button names with P{controller} prefixes - foreach (var button in Global.InputManager.ActiveController.ToBoolButtonNameList(controller)) + foreach (var button in GlobalWin.InputManager.ActiveController.ToBoolButtonNameList(controller)) { Set(button, buttons.TryGetValue(button, out var state) ? state : (bool?) null, controller); } @@ -57,9 +57,9 @@ namespace BizHawk.Client.EmuHawk try { var buttonToSet = controller == null ? button : $"P{controller} {button}"; - if (state == null) Global.InputManager.ButtonOverrideAdapter.UnSet(buttonToSet); - else Global.InputManager.ButtonOverrideAdapter.SetButton(buttonToSet, state.Value); - Global.InputManager.ActiveController.Overrides(Global.InputManager.ButtonOverrideAdapter); + if (state == null) GlobalWin.InputManager.ButtonOverrideAdapter.UnSet(buttonToSet); + else GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(buttonToSet, state.Value); + GlobalWin.InputManager.ActiveController.Overrides(GlobalWin.InputManager.ButtonOverrideAdapter); } catch { @@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk { try { - Global.InputManager.StickyXorAdapter.SetAxis(controller == null ? control : $"P{controller} {control}", value == null ? (int?) null : (int) value.Value); // the time for changing the API will come --yoshi + GlobalWin.InputManager.StickyXorAdapter.SetAxis(controller == null ? control : $"P{controller} {control}", value == null ? (int?) null : (int) value.Value); // the time for changing the API will come --yoshi } catch { diff --git a/src/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs b/src/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs index 4f9af436e2..ad91f51c11 100644 --- a/src/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs +++ b/src/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs @@ -193,7 +193,7 @@ namespace BizHawk.Client.EmuHawk public string InputStrImmediate() { - return MakeStringFor(Global.InputManager.AutofireStickyXorAdapter); + return MakeStringFor(GlobalWin.InputManager.AutofireStickyXorAdapter); } public string InputPrevious() @@ -212,7 +212,7 @@ namespace BizHawk.Client.EmuHawk public string InputStrOrAll() { - IController m = Global.InputManager.AutofireStickyXorAdapter; + IController m = GlobalWin.InputManager.AutofireStickyXorAdapter; if (GlobalWin.MovieSession.Movie.IsPlayingOrRecording() && GlobalWin.Emulator.Frame > 0) { @@ -235,7 +235,7 @@ namespace BizHawk.Client.EmuHawk ? GlobalWin.MovieSession.Movie.GetInputState(GlobalWin.Emulator.Frame - 1) : GlobalWin.MovieSession.MovieController; - return MakeStringFor(Global.InputManager.AutofireStickyXorAdapter.And(m)); + return MakeStringFor(GlobalWin.InputManager.AutofireStickyXorAdapter.And(m)); } return ""; @@ -311,7 +311,7 @@ namespace BizHawk.Client.EmuHawk // basically we're tinting whatever is pressed because it's sticky specially // in order to achieve this we want to avoid drawing anything pink that isn't actually held down right now // so we make an AND adapter and combine it using immediate & sticky - var autoString = MakeStringFor(Global.InputManager.StickyXorAdapter.Source.Xor(Global.InputManager.AutofireStickyXorAdapter).And(Global.InputManager.AutofireStickyXorAdapter)); + var autoString = MakeStringFor(GlobalWin.InputManager.StickyXorAdapter.Source.Xor(GlobalWin.InputManager.AutofireStickyXorAdapter).And(GlobalWin.InputManager.AutofireStickyXorAdapter)); g.DrawString(autoString, MessageFont, autoColor, point.X, point.Y); //recolor everything that's changed from the previous input @@ -346,16 +346,16 @@ namespace BizHawk.Client.EmuHawk DrawOsdMessage(g, rerecordCount, FixedMessagesColor, point.X, point.Y); } - if (Global.InputManager.ClientControls["Autohold"] || Global.InputManager.ClientControls["Autofire"]) + if (GlobalWin.InputManager.ClientControls["Autohold"] || GlobalWin.InputManager.ClientControls["Autofire"]) { var sb = new StringBuilder("Held: "); - foreach (string sticky in Global.InputManager.StickyXorAdapter.CurrentStickies) + foreach (string sticky in GlobalWin.InputManager.StickyXorAdapter.CurrentStickies) { sb.Append(sticky).Append(' '); } - foreach (string autoSticky in Global.InputManager.AutofireStickyXorAdapter.CurrentStickies) + foreach (string autoSticky in GlobalWin.InputManager.AutofireStickyXorAdapter.CurrentStickies) { sb .Append("Auto-") diff --git a/src/BizHawk.Client.EmuHawk/GlobalWin.cs b/src/BizHawk.Client.EmuHawk/GlobalWin.cs index 581a287109..a5f9ae269d 100644 --- a/src/BizHawk.Client.EmuHawk/GlobalWin.cs +++ b/src/BizHawk.Client.EmuHawk/GlobalWin.cs @@ -46,5 +46,6 @@ namespace BizHawk.Client.EmuHawk public static FirmwareManager FirmwareManager { get; set; } public static GameInfo Game { get; set; } public static IMovieSession MovieSession { get; set; } + public static InputManager InputManager { get; } = new InputManager(); } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 9a771c10c2..66747d5c7b 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -278,7 +278,7 @@ namespace BizHawk.Client.EmuHawk GlobalWin.MainForm = this; Rewinder = new Rewinder(); - Global.InputManager.ControllerInputCoalescer = new ControllerInputCoalescer(); + GlobalWin.InputManager.ControllerInputCoalescer = new ControllerInputCoalescer(); GlobalWin.FirmwareManager = new FirmwareManager(); MovieSession = new MovieSession( Config.Movies, @@ -391,9 +391,9 @@ namespace BizHawk.Client.EmuHawk Input.Instance.Adapter.FirstInitAll(Handle); InitControls(); - Global.InputManager.ActiveController = new Controller(NullController.Instance.Definition); - Global.InputManager.AutoFireController = _autofireNullControls; - Global.InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff); + GlobalWin.InputManager.ActiveController = new Controller(NullController.Instance.Definition); + GlobalWin.InputManager.AutoFireController = _autofireNullControls; + GlobalWin.InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff); try { GlobalWin.Sound = new Sound(Handle); @@ -633,26 +633,26 @@ namespace BizHawk.Client.EmuHawk ProcessInput(); InputManager.ClientControls.LatchFromPhysical(_hotkeyCoalescer); - Global.InputManager.ActiveController.LatchFromPhysical(Global.InputManager.ControllerInputCoalescer); + GlobalWin.InputManager.ActiveController.LatchFromPhysical(GlobalWin.InputManager.ControllerInputCoalescer); - Global.InputManager.ActiveController.ApplyAxisConstraints( + GlobalWin.InputManager.ActiveController.ApplyAxisConstraints( (Emulator is N64 && Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); - Global.InputManager.ActiveController.OR_FromLogical(InputManager.ClickyVirtualPadController); - InputManager.AutoFireController.LatchFromPhysical(Global.InputManager.ControllerInputCoalescer); + GlobalWin.InputManager.ActiveController.OR_FromLogical(InputManager.ClickyVirtualPadController); + InputManager.AutoFireController.LatchFromPhysical(GlobalWin.InputManager.ControllerInputCoalescer); if (InputManager.ClientControls["Autohold"]) { - Global.InputManager.StickyXorAdapter.MassToggleStickyState(Global.InputManager.ActiveController.PressedButtons); - Global.InputManager.AutofireStickyXorAdapter.MassToggleStickyState(InputManager.AutoFireController.PressedButtons); + GlobalWin.InputManager.StickyXorAdapter.MassToggleStickyState(GlobalWin.InputManager.ActiveController.PressedButtons); + GlobalWin.InputManager.AutofireStickyXorAdapter.MassToggleStickyState(InputManager.AutoFireController.PressedButtons); } else if (InputManager.ClientControls["Autofire"]) { - Global.InputManager.AutofireStickyXorAdapter.MassToggleStickyState(Global.InputManager.ActiveController.PressedButtons); + GlobalWin.InputManager.AutofireStickyXorAdapter.MassToggleStickyState(GlobalWin.InputManager.ActiveController.PressedButtons); } // autohold/autofire must not be affected by the following inputs - Global.InputManager.ActiveController.Overrides(Global.InputManager.ButtonOverrideAdapter); + GlobalWin.InputManager.ActiveController.Overrides(GlobalWin.InputManager.ButtonOverrideAdapter); if (Tools.Has()) { @@ -799,8 +799,8 @@ namespace BizHawk.Client.EmuHawk public void ClearHolds() { - Global.InputManager.StickyXorAdapter.ClearStickies(); - Global.InputManager.AutofireStickyXorAdapter.ClearStickies(); + GlobalWin.InputManager.StickyXorAdapter.ClearStickies(); + GlobalWin.InputManager.AutofireStickyXorAdapter.ClearStickies(); if (Tools.Has()) { @@ -867,7 +867,7 @@ namespace BizHawk.Client.EmuHawk } } - private InputManager InputManager => Global.InputManager; + private InputManager InputManager => GlobalWin.InputManager; private IVideoProvider _currentVideoProvider = NullVideo.Instance; @@ -915,7 +915,7 @@ namespace BizHawk.Client.EmuHawk private void ProcessInput() { - var conInput = (ControllerInputCoalescer)Global.InputManager.ControllerInputCoalescer; + var conInput = (ControllerInputCoalescer)GlobalWin.InputManager.ControllerInputCoalescer; for (; ; ) { @@ -981,7 +981,7 @@ namespace BizHawk.Client.EmuHawk break; case 1: // Input overrides Hotkeys conInput.Receive(ie); - if (!Global.InputManager.ActiveController.HasBinding(ie.LogicalButton.ToString())) + if (!GlobalWin.InputManager.ActiveController.HasBinding(ie.LogicalButton.ToString())) { handled = false; if (ie.EventType == Input.InputEventType.Press) @@ -1225,7 +1225,7 @@ namespace BizHawk.Client.EmuHawk // prohibit this operation if the current controls include LMouse if (allowSuppress) { - if (Global.InputManager.ActiveController.HasBinding("WMouse L")) + if (GlobalWin.InputManager.ActiveController.HasBinding("WMouse L")) { return; } @@ -2023,7 +2023,7 @@ namespace BizHawk.Client.EmuHawk controls.BindMulti(b.DisplayName, b.Bindings); } - Global.InputManager.ClientControls = controls; + GlobalWin.InputManager.ClientControls = controls; _autofireNullControls = new AutofireController( Emulator, Config.AutofireOn, @@ -2949,7 +2949,7 @@ namespace BizHawk.Client.EmuHawk // zero 03-may-2014 - moved this before call to UpdateToolsBefore(), since it seems to clear the state which a lua event.framestart is going to want to alter InputManager.ClickyVirtualPadController.FrameTick(); - Global.InputManager.ButtonOverrideAdapter.FrameTick(); + GlobalWin.InputManager.ButtonOverrideAdapter.FrameTick(); if (IsTurboing) { @@ -3007,7 +3007,7 @@ namespace BizHawk.Client.EmuHawk } bool render = !InvisibleEmulation && (!_throttle.skipNextFrame || (_currAviWriter?.UsesVideo ?? false)); - bool newFrame = Emulator.FrameAdvance(Global.InputManager.ControllerOutput, render, renderSound); + bool newFrame = Emulator.FrameAdvance(GlobalWin.InputManager.ControllerOutput, render, renderSound); MovieSession.HandleFrameAfter(); @@ -3028,7 +3028,7 @@ namespace BizHawk.Client.EmuHawk InputManager.AutoFireController.IncrementStarts(); } - Global.InputManager.AutofireStickyXorAdapter.IncrementLoops(IsLagFrame); + GlobalWin.InputManager.AutofireStickyXorAdapter.IncrementLoops(IsLagFrame); PressFrameAdvance = false; @@ -3826,9 +3826,9 @@ namespace BizHawk.Client.EmuHawk Rewinder.Initialize(Emulator.AsStatable(), Config.Rewind); } - Global.InputManager.StickyXorAdapter.ClearStickies(); - Global.InputManager.StickyXorAdapter.ClearStickyAxes(); - Global.InputManager.AutofireStickyXorAdapter.ClearStickies(); + GlobalWin.InputManager.StickyXorAdapter.ClearStickies(); + GlobalWin.InputManager.StickyXorAdapter.ClearStickyAxes(); + GlobalWin.InputManager.AutofireStickyXorAdapter.ClearStickies(); RewireSound(); Tools.UpdateCheatRelatedTools(null, null); @@ -3950,8 +3950,8 @@ namespace BizHawk.Client.EmuHawk Emulator.Dispose(); Emulator = new NullEmulator(); ClientApi.UpdateEmulatorAndVP(Emulator); - Global.InputManager.ActiveController = new Controller(NullController.Instance.Definition); - Global.InputManager.AutoFireController = _autofireNullControls; + GlobalWin.InputManager.ActiveController = new Controller(NullController.Instance.Definition); + GlobalWin.InputManager.AutoFireController = _autofireNullControls; RewireSound(); RebootStatusBarIcon.Visible = false; GameIsClosing = false; diff --git a/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs b/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs index 8693268472..2e13bcef37 100644 --- a/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs +++ b/src/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs @@ -740,7 +740,7 @@ namespace BizHawk.Client.EmuHawk foreach (var button in controller.Definition.BoolButtons) { // TODO: make an input adapter specifically for the bot? - Global.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); + GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); } } else @@ -878,7 +878,7 @@ namespace BizHawk.Client.EmuHawk double probability = _cachedControlProbabilities[button]; bool pressed = !(rand.Next(100) < probability); - Global.InputManager.ClickyVirtualPadController.SetBool(button, pressed); + GlobalWin.InputManager.ClickyVirtualPadController.SetBool(button, pressed); } _currentBotAttempt.Log.Add(_logGenerator.GenerateLogEntry()); @@ -931,7 +931,7 @@ namespace BizHawk.Client.EmuHawk UpdateBotStatusIcon(); MessageLabel.Text = "Running..."; _cachedControlProbabilities = ControlProbabilities; - _logGenerator = MovieSession.Movie.LogGeneratorInstance(Global.InputManager.ClickyVirtualPadController); + _logGenerator = MovieSession.Movie.LogGeneratorInstance(GlobalWin.InputManager.ClickyVirtualPadController); } private string CanStart() diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 9821ad3219..9a48dcc5e3 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -460,7 +460,7 @@ namespace BizHawk.Client.EmuHawk } AutoPatternBool p = BoolPatterns[index]; - Global.InputManager.AutofireStickyXorAdapter.SetSticky(button, isOn.Value, p); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky(button, isOn.Value, p); } else { @@ -480,7 +480,7 @@ namespace BizHawk.Client.EmuHawk } AutoPatternAxis p = AxisPatterns[index]; - Global.InputManager.AutofireStickyXorAdapter.SetAxis(button, value, p); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetAxis(button, value, p); } } diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 9cc755a6f4..0e26cdc732 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -471,7 +471,7 @@ namespace BizHawk.Client.EmuHawk foreach (var column in TasView.VisibleColumns) { - if (Global.InputManager.StickyXorAdapter.IsSticky(column.Name)) + if (GlobalWin.InputManager.StickyXorAdapter.IsSticky(column.Name)) { column.Emphasis = true; } diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs index daff90498e..3c70cd21e4 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs @@ -32,12 +32,12 @@ namespace BizHawk.Client.EmuHawk foreach (var button in controller.Definition.BoolButtons) { - Global.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); + GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); } foreach (var floatButton in controller.Definition.AxisControls) { - Global.InputManager.ButtonOverrideAdapter.SetAxis(floatButton, controller.AxisValue(floatButton)); + GlobalWin.InputManager.ButtonOverrideAdapter.SetAxis(floatButton, controller.AxisValue(floatButton)); } return controller; diff --git a/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs b/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs index 20f6b7ea6b..e6c18be6ad 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TI83/TI83KeyPad.cs @@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk private void KeyClick(string name) { - Global.InputManager.ClickyVirtualPadController.Click(name); + GlobalWin.InputManager.ClickyVirtualPadController.Click(name); } public void Restart() diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs index 392c329446..16a3951c84 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs @@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk public void UpdateValues() { - if (AnalogTrackBar.Value != (int)Global.InputManager.StickyXorAdapter.AxisValue(Name)) + if (AnalogTrackBar.Value != (int)GlobalWin.InputManager.StickyXorAdapter.AxisValue(Name)) { RefreshWidgets(); } @@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk public void Clear() { - Global.InputManager.StickyXorAdapter.Unset(Name); + GlobalWin.InputManager.StickyXorAdapter.Unset(Name); IsSet = false; } @@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk if (!_programmaticallyChangingValue) { CurrentValue = AnalogTrackBar.Value; - Global.InputManager.StickyXorAdapter.SetAxis(Name, AnalogTrackBar.Value); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(Name, AnalogTrackBar.Value); } } @@ -222,7 +222,7 @@ namespace BizHawk.Client.EmuHawk if (!_isSet) { _programmaticallyChangingValue = true; - AnalogTrackBar.Value = (int)Global.InputManager.StickyXorAdapter.AxisValue(Name); + AnalogTrackBar.Value = (int)GlobalWin.InputManager.StickyXorAdapter.AxisValue(Name); ValueLabel.Text = AnalogTrackBar.Value.ToString(); _programmaticallyChangingValue = false; } diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs index d91c21365e..075716c33b 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs @@ -78,10 +78,10 @@ namespace BizHawk.Client.EmuHawk manualR.Value = 0; manualTheta.Value = 0; //see HOOMOO - Global.InputManager.AutofireStickyXorAdapter.SetSticky(AnalogStick.XName, false); - Global.InputManager.StickyXorAdapter.Unset(AnalogStick.XName); - Global.InputManager.AutofireStickyXorAdapter.SetSticky(AnalogStick.YName, false); - Global.InputManager.StickyXorAdapter.Unset(AnalogStick.YName); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky(AnalogStick.XName, false); + GlobalWin.InputManager.StickyXorAdapter.Unset(AnalogStick.XName); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky(AnalogStick.YName, false); + GlobalWin.InputManager.StickyXorAdapter.Unset(AnalogStick.YName); AnalogStick.HasValue = false; } diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs index 66b6c4731b..99fe50a098 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs @@ -30,8 +30,8 @@ namespace BizHawk.Client.EmuHawk RightClicked = false; Checked = false; //HOOMOO - Global.InputManager.AutofireStickyXorAdapter.SetSticky(Name, false); - Global.InputManager.StickyXorAdapter.SetSticky(Name, false); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky(Name, false); + GlobalWin.InputManager.StickyXorAdapter.SetSticky(Name, false); } } @@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk { if (RightClicked) { - Global.InputManager.AutofireStickyXorAdapter.SetSticky(Name, Checked); + GlobalWin.InputManager.AutofireStickyXorAdapter.SetSticky(Name, Checked); if (Checked == false) { @@ -141,7 +141,7 @@ namespace BizHawk.Client.EmuHawk } else { - Global.InputManager.StickyXorAdapter.SetSticky(Name, Checked); + GlobalWin.InputManager.StickyXorAdapter.SetSticky(Name, Checked); if (Checked == false) { diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs index 6774eea234..d89739646e 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs @@ -133,7 +133,7 @@ namespace BizHawk.Client.EmuHawk private void lvDiscs_SelectedIndexChanged(object sender, EventArgs e) { // emergency measure: if no selection, set no disc - Global.InputManager.StickyXorAdapter.SetAxis(_discSelectName, lvDiscs.SelectedIndices.Count == 0 ? 0 : lvDiscs.SelectedIndices[0]); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(_discSelectName, lvDiscs.SelectedIndices.Count == 0 ? 0 : lvDiscs.SelectedIndices[0]); } private void btnClose_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs index d632377942..c98d10a678 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs @@ -39,8 +39,8 @@ namespace BizHawk.Client.EmuHawk public void Clear() { - Global.InputManager.StickyXorAdapter.Unset(XName); - Global.InputManager.StickyXorAdapter.Unset(YName); + GlobalWin.InputManager.StickyXorAdapter.Unset(XName); + GlobalWin.InputManager.StickyXorAdapter.Unset(YName); _overrideX = null; _overrideY = null; _isSet = false; @@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk public int X { - get => _overrideX ?? (int)(Global.InputManager.StickyXorAdapter.AxisValue(XName) / MultiplierX); + get => _overrideX ?? (int)(GlobalWin.InputManager.StickyXorAdapter.AxisValue(XName) / MultiplierX); set { if (value < 0) @@ -177,13 +177,13 @@ namespace BizHawk.Client.EmuHawk XNumeric.Value = XNumeric.Maximum; } - Global.InputManager.StickyXorAdapter.SetAxis(XName, (int)((float)XNumeric.Value * MultiplierX)); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(XName, (int)((float)XNumeric.Value * MultiplierX)); _isSet = true; } } public int Y { - get => _overrideY ?? (int)(Global.InputManager.StickyXorAdapter.AxisValue(YName) / MultiplierY); + get => _overrideY ?? (int)(GlobalWin.InputManager.StickyXorAdapter.AxisValue(YName) / MultiplierY); set { if (value < 0) @@ -199,7 +199,7 @@ namespace BizHawk.Client.EmuHawk YNumeric.Value = YNumeric.Maximum; } - Global.InputManager.StickyXorAdapter.SetAxis(YName, (int)((float)YNumeric.Value * MultiplierY)); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(YName, (int)((float)YNumeric.Value * MultiplierY)); _isSet = true; } } diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs index aa21fa9f69..a6b3d2a385 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs @@ -164,8 +164,8 @@ namespace BizHawk.Client.EmuHawk private void SetAnalog() { - Global.InputManager.StickyXorAdapter.SetAxis(XName, HasValue ? X : (int?)null); - Global.InputManager.StickyXorAdapter.SetAxis(YName, HasValue ? Y : (int?)null); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(XName, HasValue ? X : (int?)null); + GlobalWin.InputManager.StickyXorAdapter.SetAxis(YName, HasValue ? Y : (int?)null); Refresh(); }