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;
}
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)
{
var ret = new Controller(def);

View File

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