diff --git a/WiiTUIO/Input/WiiProvider/Keymap/WiiKeyMap.cs b/WiiTUIO/Input/WiiProvider/Keymap/WiiKeyMap.cs index 4e2f131d..ee3b8095 100644 --- a/WiiTUIO/Input/WiiProvider/Keymap/WiiKeyMap.cs +++ b/WiiTUIO/Input/WiiProvider/Keymap/WiiKeyMap.cs @@ -287,24 +287,28 @@ public void updateAccelerometer(AccelState accelState) public void updateNunchuk(NunchukState nunchuk) { KeymapOutConfig outConfig; + double joyX = (nunchuk.RawJoystick.X - 127f) / 128f * 0.5; + double joyY = (nunchuk.RawJoystick.Y - 128f) / 127f * 0.5; + + //Console.WriteLine(nunchuk.RawJoystick.X +"," + nunchuk.RawJoystick.Y + "|" + joyX + "," + joyY); if (this.config.TryGetValue("Nunchuk.StickRight", out outConfig)) { - if (nunchuk.Joystick.X > 0) + if (joyX > 0) { - updateStickHandlers(outConfig, nunchuk.Joystick.X * 2); + updateStickHandlers(outConfig, joyX * 2); } - else if (nunchuk.Joystick.X == 0) + else if (joyX == 0) { updateStickHandlers(outConfig, 0); } - if (nunchuk.Joystick.X * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickRight"]) + if (joyX * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickRight"]) { PressedButtons["Nunchuk.StickRight"] = true; this.executeButtonDown("Nunchuk.StickRight"); } - else if (nunchuk.Joystick.X * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickRight"]) + else if (joyX * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickRight"]) { PressedButtons["Nunchuk.StickRight"] = false; this.executeButtonUp("Nunchuk.StickRight"); @@ -313,21 +317,21 @@ public void updateNunchuk(NunchukState nunchuk) if (this.config.TryGetValue("Nunchuk.StickLeft", out outConfig)) { - if (nunchuk.Joystick.X < 0) + if (joyX < 0) { - updateStickHandlers(outConfig, nunchuk.Joystick.X * -2); + updateStickHandlers(outConfig, joyX * -2); } - else if (nunchuk.Joystick.X == 0) + else if (joyX == 0) { updateStickHandlers(outConfig, 0); } - if (nunchuk.Joystick.X * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickLeft"]) + if (joyX * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickLeft"]) { PressedButtons["Nunchuk.StickLeft"] = true; this.executeButtonDown("Nunchuk.StickLeft"); } - else if (nunchuk.Joystick.X * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickLeft"]) + else if (joyX * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickLeft"]) { PressedButtons["Nunchuk.StickLeft"] = false; this.executeButtonUp("Nunchuk.StickLeft"); @@ -335,21 +339,21 @@ public void updateNunchuk(NunchukState nunchuk) } if (this.config.TryGetValue("Nunchuk.StickUp", out outConfig)) { - if (nunchuk.Joystick.Y > 0) + if (joyY > 0) { - updateStickHandlers(outConfig, nunchuk.Joystick.Y * 2); + updateStickHandlers(outConfig, joyY * 2); } - else if (nunchuk.Joystick.Y == 0) + else if (joyY == 0) { updateStickHandlers(outConfig, 0); } - if (nunchuk.Joystick.Y * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickUp"]) + if (joyY * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickUp"]) { PressedButtons["Nunchuk.StickUp"] = true; this.executeButtonDown("Nunchuk.StickUp"); } - else if (nunchuk.Joystick.Y * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickUp"]) + else if (joyY * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickUp"]) { PressedButtons["Nunchuk.StickUp"] = false; this.executeButtonUp("Nunchuk.StickUp"); @@ -358,21 +362,21 @@ public void updateNunchuk(NunchukState nunchuk) } if (this.config.TryGetValue("Nunchuk.StickDown", out outConfig)) { - if (nunchuk.Joystick.Y < 0) + if (joyY < 0) { - updateStickHandlers(outConfig, nunchuk.Joystick.Y * -2); + updateStickHandlers(outConfig, joyY * -2); } - else if (nunchuk.Joystick.Y == 0) + else if (joyY == 0) { updateStickHandlers(outConfig, 0); } - if (nunchuk.Joystick.Y * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickDown"]) + if (joyY * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickDown"]) { PressedButtons["Nunchuk.StickDown"] = true; this.executeButtonDown("Nunchuk.StickDown"); } - else if (nunchuk.Joystick.Y * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickDown"]) + else if (joyY * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickDown"]) { PressedButtons["Nunchuk.StickDown"] = false; this.executeButtonUp("Nunchuk.StickDown"); diff --git a/WiiTUIO/WiiTUIO.csproj b/WiiTUIO/WiiTUIO.csproj index 1bd4e098..ea3da2d4 100644 --- a/WiiTUIO/WiiTUIO.csproj +++ b/WiiTUIO/WiiTUIO.csproj @@ -497,7 +497,7 @@ copy "$(ProjectDir)VMultiDll_$(PlatformName).dll" "$(TargetDir)VMultiDll.dll" /Y xcopy "$(TargetDir)..\$(ConfigurationName)" "C:\Program Files\Touchmote" /H /Y cd "C:\Program Files\Touchmote" -"C:\Program Files (x86)\Windows Kits\8.1\bin\$(PlatformName)\signtool.exe" sign /v /a /s ROOT /n Touchmote /t http://timestamp.verisign.com/scripts/timstamp.dll "C:\Program Files\Touchmote\Touchmote.exe" +"C:\Program Files (x86)\Windows Kits\8.1\bin\$(PlatformName)\signtool.exe" sign /v /a /s ROOT /n Touchmote /t http://timestamp.sectigo.com "C:\Program Files\Touchmote\Touchmote.exe"