move some logic from mainform to InputManager

This commit is contained in:
adelikat 2020-07-03 10:44:05 -05:00
parent a3c586b480
commit 910c37d434
2 changed files with 13 additions and 3 deletions

View File

@ -73,6 +73,17 @@ namespace BizHawk.Client.Common
ControllerOutput.Source = session.MovieOut; ControllerOutput.Source = session.MovieOut;
} }
public void ToggleStickies()
{
StickyXorAdapter.MassToggleStickyState(ActiveController.PressedButtons);
AutofireStickyXorAdapter.MassToggleStickyState(AutoFireController.PressedButtons);
}
public void ToggleAutoStickies()
{
AutofireStickyXorAdapter.MassToggleStickyState(ActiveController.PressedButtons);
}
private static Controller BindToDefinition(ControllerDefinition def, IDictionary<string, Dictionary<string, string>> allBinds, IDictionary<string, Dictionary<string, AnalogBind>> analogBinds) private static Controller BindToDefinition(ControllerDefinition def, IDictionary<string, Dictionary<string, string>> allBinds, IDictionary<string, Dictionary<string, AnalogBind>> analogBinds)
{ {
var ret = new Controller(def); var ret = new Controller(def);

View File

@ -669,12 +669,11 @@ namespace BizHawk.Client.EmuHawk
if (InputManager.ClientControls["Autohold"]) if (InputManager.ClientControls["Autohold"])
{ {
InputManager.StickyXorAdapter.MassToggleStickyState(InputManager.ActiveController.PressedButtons); InputManager.ToggleStickies();
InputManager.AutofireStickyXorAdapter.MassToggleStickyState(InputManager.AutoFireController.PressedButtons);
} }
else if (InputManager.ClientControls["Autofire"]) else if (InputManager.ClientControls["Autofire"])
{ {
InputManager.AutofireStickyXorAdapter.MassToggleStickyState(InputManager.ActiveController.PressedButtons); InputManager.ToggleAutoStickies();
} }
// autohold/autofire must not be affected by the following inputs // autohold/autofire must not be affected by the following inputs