delete unused KeyTurbo.cs and misc small cleanups to InputAdapters
This commit is contained in:
parent
f9c6234262
commit
c3811721c2
|
@ -177,7 +177,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void Overrides(OverrideAdaptor controller)
|
||||
public void Overrides(OverrideAdapter controller)
|
||||
{
|
||||
foreach (var button in controller.Overrides)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.Common
|
|||
// the "output" port for the controller chain.
|
||||
public static readonly CopyControllerAdapter ControllerOutput = new CopyControllerAdapter();
|
||||
|
||||
public static readonly UD_LR_ControllerAdapter UD_LR_ControllerAdapter = new UD_LR_ControllerAdapter();
|
||||
public static readonly UdlrControllerAdapter UD_LR_ControllerAdapter = new UdlrControllerAdapter();
|
||||
|
||||
public static readonly AutoFireStickyXorAdapter AutofireStickyXORAdapter = new AutoFireStickyXorAdapter();
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Used to AND to another controller, used for <see cref="JoypadApi.Set(System.Collections.Generic.Dictionary{string,bool},System.Nullable{int})">JoypadApi.Set</see>
|
||||
/// </summary>
|
||||
public static readonly OverrideAdaptor ButtonOverrideAdaptor = new OverrideAdaptor();
|
||||
public static readonly OverrideAdapter ButtonOverrideAdaptor = new OverrideAdapter();
|
||||
|
||||
/// <summary>
|
||||
/// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class TurboKey
|
||||
{
|
||||
private int _upTime, _downTime, _timer;
|
||||
|
||||
public bool Value { get; set; }
|
||||
|
||||
public void Reset(int downTime, int upTime)
|
||||
{
|
||||
Value = false;
|
||||
_timer = 0;
|
||||
_upTime = upTime;
|
||||
_downTime = downTime;
|
||||
}
|
||||
|
||||
public void Tick(bool down)
|
||||
{
|
||||
if (!down)
|
||||
{
|
||||
Reset(_downTime, _upTime);
|
||||
return;
|
||||
}
|
||||
|
||||
_timer++;
|
||||
|
||||
Value = true;
|
||||
if (_timer > _downTime)
|
||||
{
|
||||
Value = false;
|
||||
}
|
||||
|
||||
if (_timer > _upTime + _downTime)
|
||||
{
|
||||
_timer = 0;
|
||||
Value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
{
|
||||
public AutoPatternBool()
|
||||
{
|
||||
Pattern = new[] { true };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -34,7 +33,7 @@
|
|||
private int _index;
|
||||
|
||||
public bool SkipsLag { get; } = true;
|
||||
public bool[] Pattern { get; }
|
||||
public bool[] Pattern { get; } = { true };
|
||||
public int Loop { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -77,7 +76,6 @@
|
|||
/// </summary>
|
||||
public AutoPatternFloat()
|
||||
{
|
||||
Pattern = new[] { 0f };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -112,7 +110,7 @@
|
|||
private int _index;
|
||||
|
||||
public bool SkipsLag { get; } = true;
|
||||
public float[] Pattern { get; }
|
||||
public float[] Pattern { get; } = { 0f };
|
||||
public int Loop { get; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,118 +1,118 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to pass into an Override method to manage the logic overriding input
|
||||
/// This only works with bool buttons!
|
||||
/// </summary>
|
||||
public class OverrideAdaptor : IController
|
||||
{
|
||||
public ControllerDefinition Definition { get; private set; }
|
||||
|
||||
private readonly Dictionary<string, bool> _overrides = new Dictionary<string, bool>();
|
||||
private readonly Dictionary<string, float> _floatOverrides = new Dictionary<string, float>();
|
||||
private readonly List<string> _inverses = new List<string>();
|
||||
|
||||
/// <exception cref="InvalidOperationException"><paramref name="button"/> not overridden</exception>
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
if (_overrides.ContainsKey(button))
|
||||
{
|
||||
return _overrides[button];
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
if (_floatOverrides.ContainsKey(name))
|
||||
{
|
||||
return _floatOverrides[name];
|
||||
}
|
||||
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public IEnumerable<string> Overrides
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var kvp in _overrides)
|
||||
{
|
||||
yield return kvp.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> FloatOverrides
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var kvp in _floatOverrides)
|
||||
{
|
||||
yield return kvp.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> InversedButtons
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var name in _inverses)
|
||||
{
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFloat(string name, float value)
|
||||
{
|
||||
if (_floatOverrides.ContainsKey(name))
|
||||
{
|
||||
_floatOverrides[name] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_floatOverrides.Add(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetButton(string button, bool value)
|
||||
{
|
||||
if (_overrides.ContainsKey(button))
|
||||
{
|
||||
_overrides[button] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_overrides.Add(button, value);
|
||||
}
|
||||
|
||||
_inverses.Remove(button);
|
||||
}
|
||||
|
||||
public void UnSet(string button)
|
||||
{
|
||||
_overrides.Remove(button);
|
||||
_inverses.Remove(button);
|
||||
}
|
||||
|
||||
public void SetInverse(string button)
|
||||
{
|
||||
_inverses.Add(button);
|
||||
}
|
||||
|
||||
public void FrameTick()
|
||||
{
|
||||
_overrides.Clear();
|
||||
_floatOverrides.Clear();
|
||||
_inverses.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to pass into an Override method to manage the logic overriding input
|
||||
/// This only works with bool buttons!
|
||||
/// </summary>
|
||||
public class OverrideAdapter : IController
|
||||
{
|
||||
public ControllerDefinition Definition { get; private set; }
|
||||
|
||||
private readonly Dictionary<string, bool> _overrides = new Dictionary<string, bool>();
|
||||
private readonly Dictionary<string, float> _floatOverrides = new Dictionary<string, float>();
|
||||
private readonly List<string> _inverses = new List<string>();
|
||||
|
||||
/// <exception cref="InvalidOperationException"><paramref name="button"/> not overridden</exception>
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
if (_overrides.ContainsKey(button))
|
||||
{
|
||||
return _overrides[button];
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
if (_floatOverrides.ContainsKey(name))
|
||||
{
|
||||
return _floatOverrides[name];
|
||||
}
|
||||
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public IEnumerable<string> Overrides
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var kvp in _overrides)
|
||||
{
|
||||
yield return kvp.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> FloatOverrides
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var kvp in _floatOverrides)
|
||||
{
|
||||
yield return kvp.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> InversedButtons
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var name in _inverses)
|
||||
{
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFloat(string name, float value)
|
||||
{
|
||||
if (_floatOverrides.ContainsKey(name))
|
||||
{
|
||||
_floatOverrides[name] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_floatOverrides.Add(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetButton(string button, bool value)
|
||||
{
|
||||
if (_overrides.ContainsKey(button))
|
||||
{
|
||||
_overrides[button] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_overrides.Add(button, value);
|
||||
}
|
||||
|
||||
_inverses.Remove(button);
|
||||
}
|
||||
|
||||
public void UnSet(string button)
|
||||
{
|
||||
_overrides.Remove(button);
|
||||
_inverses.Remove(button);
|
||||
}
|
||||
|
||||
public void SetInverse(string button)
|
||||
{
|
||||
_inverses.Add(button);
|
||||
}
|
||||
|
||||
public void FrameTick()
|
||||
{
|
||||
_overrides.Clear();
|
||||
_floatOverrides.Clear();
|
||||
_inverses.Clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Client.Common
|
|||
/// Filters input for things called Up and Down while considering the client's AllowUD_LR option.
|
||||
/// This is a bit gross but it is unclear how to do it more nicely
|
||||
/// </summary>
|
||||
public class UD_LR_ControllerAdapter : IController
|
||||
public class UdlrControllerAdapter : IController
|
||||
{
|
||||
public ControllerDefinition Definition => Source.Definition;
|
||||
|
||||
|
|
|
@ -338,6 +338,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Multitap/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Multitrack/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mupen/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mutexing/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=muxed/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nametable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nametables/@EntryIndexedValue">True</s:Boolean>
|
||||
|
@ -356,6 +357,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Overscan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=palettized/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Palletize/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=passthru/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCFX/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCSX/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=performant/@EntryIndexedValue">True</s:Boolean>
|
||||
|
@ -428,6 +430,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Turboing/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tvalue/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=UDLR/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unclick/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=underrun/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Underruns/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=undriven/@EntryIndexedValue">True</s:Boolean>
|
||||
|
@ -439,6 +442,8 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpaused/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unpausing/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpress/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpresses/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpressing/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unregister/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unseekable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unthrottle/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
Loading…
Reference in New Issue