Resolve TODO in Controller.NormalizeAxes
_axes and _axisRanges have the same keys, and should probably be one dict, and _axisBindings has the same keys or a subset
This commit is contained in:
parent
b6f1afcce8
commit
04257ec676
|
@ -53,7 +53,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var kvp in _axisBindings)
|
foreach (var kvp in _axisBindings)
|
||||||
{
|
{
|
||||||
if (!_axisRanges.TryGetValue(kvp.Key, out var range)) continue; //TODO throw (or use indexer instead of TryGetValue)? this `continue` should never be hit --yoshi
|
var range = _axisRanges[kvp.Key];
|
||||||
|
|
||||||
// values of _axes are ints in -10000..10000 (or 0..10000), so scale to -1..1, using floats to keep fractional part
|
// values of _axes are ints in -10000..10000 (or 0..10000), so scale to -1..1, using floats to keep fractional part
|
||||||
var value = _axes[kvp.Key] / 10000.0f;
|
var value = _axes[kvp.Key] / 10000.0f;
|
||||||
|
@ -99,12 +99,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
foreach (var kvp in _axisBindings)
|
foreach (var kvp in _axisBindings)
|
||||||
{
|
{
|
||||||
var input = controller.AxisValue(kvp.Value.Value);
|
_axes[kvp.Key] = controller.AxisValue(kvp.Value.Value);
|
||||||
string outKey = kvp.Key;
|
|
||||||
if (_axisRanges.ContainsKey(outKey))
|
|
||||||
{
|
|
||||||
_axes[outKey] = input;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's not sure where this should happen, so for backwards compatibility.. do it every time
|
// it's not sure where this should happen, so for backwards compatibility.. do it every time
|
||||||
|
|
Loading…
Reference in New Issue