here it is, fixed another way, for the record: float ranges can now support inverted senses.

This commit is contained in:
zeromus 2014-05-17 00:06:20 +00:00
parent 35b9746880
commit 19f3b1b1da
3 changed files with 16 additions and 12 deletions

View File

@ -113,14 +113,18 @@ namespace BizHawk.Client.Common
} }
var output = (input * multiplier + 10000.0f) * (range.Max - range.Min) / 20000.0f + range.Min; var output = (input * multiplier + 10000.0f) * (range.Max - range.Min) / 20000.0f + range.Min;
if (output < range.Min)
float lbound = Math.Min(range.Min, range.Max);
float ubound = Math.Max(range.Min, range.Max);
if (output < lbound)
{ {
output = range.Min; output = lbound;
} }
if (output > range.Max) if (output > ubound)
{ {
output = range.Max; output = ubound;
} }
_floatButtons[outkey] = output; _floatButtons[outkey] = output;

View File

@ -34,13 +34,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
FloatRanges = FloatRanges =
{ {
new[] {-128.0f, 0.0f, 127.0f}, new[] {-128.0f, 0.0f, 127.0f},
new[] {127.0f, 0.0f, -128.0f},
new[] {-128.0f, 0.0f, 127.0f}, new[] {-128.0f, 0.0f, 127.0f},
new[] {127.0f, 0.0f, -128.0f},
new[] {-128.0f, 0.0f, 127.0f}, new[] {-128.0f, 0.0f, 127.0f},
new[] {127.0f, 0.0f, -128.0f},
new[] {-128.0f, 0.0f, 127.0f}, new[] {-128.0f, 0.0f, 127.0f},
new[] {-128.0f, 0.0f, 127.0f}, new[] {127.0f, 0.0f, -128.0f}
new[] {-128.0f, 0.0f, 127.0f},
new[] {-128.0f, 0.0f, 127.0f},
new[] {-128.0f, 0.0f, 127.0f}
} }
}; };

View File

@ -776,7 +776,7 @@
}, },
"P1 Y Axis": { "P1 Y Axis": {
"Value": "J1 Y", "Value": "J1 Y",
"Mult": -1.0, "Mult": 1.0,
"Deadzone": 0.1 "Deadzone": 0.1
}, },
"P2 X Axis": { "P2 X Axis": {
@ -786,7 +786,7 @@
}, },
"P2 Y Axis": { "P2 Y Axis": {
"Value": "", "Value": "",
"Mult": -1.0, "Mult": 1.0,
"Deadzone": 0.1 "Deadzone": 0.1
}, },
"P3 X Axis": { "P3 X Axis": {
@ -796,7 +796,7 @@
}, },
"P3 Y Axis": { "P3 Y Axis": {
"Value": "", "Value": "",
"Mult": -1.0, "Mult": 1.0,
"Deadzone": 0.1 "Deadzone": 0.1
}, },
"P4 X Axis": { "P4 X Axis": {
@ -806,7 +806,7 @@
}, },
"P4 Y Axis": { "P4 Y Axis": {
"Value": "", "Value": "",
"Mult": -1.0, "Mult": 1.0,
"Deadzone": 0.1 "Deadzone": 0.1
} }
}, },