Skip to content

Commit

Permalink
Fixed stick range.
Browse files Browse the repository at this point in the history
  • Loading branch information
irungentoo committed Nov 25, 2016
1 parent cac8c9b commit 8de6da0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,39 @@ private void input_thread(HidDevice Device, ScpBus scpBus, int index)
}

short LeftStickX = (short)((Math.Max(-127.0, currentState[5] - 128) / 127) * 32767);
if (LeftStickX == -32767)
LeftStickX = -32768;

if (LeftStickX != controller.LeftStickX)
{
changed = true;
controller.LeftStickX = LeftStickX;
}

short LeftStickY = (short)((Math.Max(-127.0, currentState[6] - 128) / 127) * -32767);
if (LeftStickY == -32767)
LeftStickY = -32768;

if (LeftStickY != controller.LeftStickY)
{
changed = true;
controller.LeftStickY = LeftStickY;
}

short RightStickX = (short)((Math.Max(-127.0, currentState[7] - 128) / 127) * 32767);
if (RightStickX == -32767)
RightStickX = -32768;

if (RightStickX != controller.RightStickX)
{
changed = true;
controller.RightStickX = RightStickX;
}

short RightStickY = (short)((Math.Max(-127.0, currentState[8] - 128) / 127) * -32767);
if (RightStickY == -32767)
RightStickY = -32768;

if (RightStickY != controller.RightStickY)
{
changed = true;
Expand Down

1 comment on commit 8de6da0

@Komutator69
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

242

Please sign in to comment.