remove globals from AutofireController
This commit is contained in:
parent
d3c4e60405
commit
96fa84ff8b
|
@ -9,10 +9,10 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public class AutofireController : IController
|
||||
{
|
||||
public AutofireController(ControllerDefinition definition, IEmulator emulator)
|
||||
public AutofireController(ControllerDefinition definition, IEmulator emulator, int on, int off)
|
||||
{
|
||||
On = Global.Config.AutofireOn < 1 ? 0 : Global.Config.AutofireOn;
|
||||
Off = Global.Config.AutofireOff < 1 ? 0 : Global.Config.AutofireOff;
|
||||
On = on < 1 ? 0 : on;
|
||||
Off = off < 1 ? 0 : off;
|
||||
Definition = definition;
|
||||
_emulator = emulator;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace BizHawk.Client.Common
|
|||
var def = emulator.ControllerDefinition;
|
||||
|
||||
ActiveController = BindToDefinition(def, config.AllTrollers, config.AllTrollersAnalog);
|
||||
AutoFireController = BindToDefinitionAF(def, emulator, config.AllTrollersAutoFire);
|
||||
AutoFireController = BindToDefinitionAF(def, emulator, config.AllTrollersAutoFire, config.AutofireOn, config.AutofireOff);
|
||||
|
||||
// allow propagating controls that are in the current controller definition but not in the prebaked one
|
||||
// these two lines shouldn't be required anymore under the new system?
|
||||
|
@ -121,9 +121,14 @@ namespace BizHawk.Client.Common
|
|||
return ret;
|
||||
}
|
||||
|
||||
private static AutofireController BindToDefinitionAF(ControllerDefinition def, IEmulator emulator, IDictionary<string, Dictionary<string, string>> allBinds)
|
||||
private static AutofireController BindToDefinitionAF(
|
||||
ControllerDefinition def,
|
||||
IEmulator emulator,
|
||||
IDictionary<string, Dictionary<string, string>> allBinds,
|
||||
int on,
|
||||
int off)
|
||||
{
|
||||
var ret = new AutofireController(def, emulator);
|
||||
var ret = new AutofireController(def, emulator, on, off);
|
||||
if (allBinds.TryGetValue(def.Name, out var binds))
|
||||
{
|
||||
foreach (var btn in def.BoolButtons)
|
||||
|
|
|
@ -1947,7 +1947,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
Global.InputManager.ClientControls = controls;
|
||||
_autofireNullControls = new AutofireController(NullController.Instance.Definition, Emulator);
|
||||
_autofireNullControls = new AutofireController(
|
||||
NullController.Instance.Definition,
|
||||
Emulator,
|
||||
Config.AutofireOn,
|
||||
Config.AutofireOff);
|
||||
}
|
||||
|
||||
private void LoadMoviesFromRecent(string path)
|
||||
|
|
Loading…
Reference in New Issue