示例#1
0
 public void Reset()
 {
     extras          = "0,0,0,0,0,0,0,0";
     keyType         = DS4KeyType.None;
     actionType      = ActionType.Default;
     action          = null;
     shiftActionType = ActionType.Default;
     shiftAction     = null;
     shiftTrigger    = 0;
     shiftExtras     = "0,0,0,0,0,0,0,0";
     shiftKeyType    = DS4KeyType.None;
 }
示例#2
0
 internal void UpdateSettings(bool shift, object act, string exts, DS4KeyType kt, int trigger = 0)
 {
     if (!shift)
     {
         if (act is int || act is ushort)
         {
             actionType = ActionType.Key;
         }
         else if (act is string || act is X360Controls)
         {
             actionType = ActionType.Button;
         }
         else if (act is int[])
         {
             actionType = ActionType.Macro;
         }
         else
         {
             actionType = ActionType.Default;
         }
         action  = act;
         extras  = exts;
         keyType = kt;
     }
     else
     {
         if (act is int || act is ushort)
         {
             shiftActionType = ActionType.Key;
         }
         else if (act is string || act is X360Controls)
         {
             shiftActionType = ActionType.Button;
         }
         else if (act is int[])
         {
             shiftActionType = ActionType.Macro;
         }
         else
         {
             shiftActionType = ActionType.Default;
         }
         shiftAction  = act;
         shiftExtras  = exts;
         shiftKeyType = kt;
         shiftTrigger = trigger;
     }
 }
示例#3
0
        bool mapTouchPad(DS4Controls padControl, bool release = false)
        {
            ushort key = Global.getCustomKey(padControl);

            if (key == 0)
            {
                return(false);
            }
            else
            {
                DS4KeyType keyType = Global.getCustomKeyType(padControl);
                if (!release)
                {
                    if (keyType.HasFlag(DS4KeyType.ScanCode))
                    {
                        performSCKeyPress(key);
                    }
                    else
                    {
                        performKeyPress(key);
                    }
                }
                else
                if (!keyType.HasFlag(DS4KeyType.Repeat))
                {
                    if (keyType.HasFlag(DS4KeyType.ScanCode))
                    {
                        performSCKeyRelease(key);
                    }
                    else
                    {
                        performKeyRelease(key);
                    }
                }
                return(true);
            }
        }
示例#4
0
		private static async void PlayMacro(int device, bool[] macrocontrol, string macro, DS4Controls control, DS4KeyType keyType)
		{
			if (macro.StartsWith("164/9/9/164", StringComparison.Ordinal) || macro.StartsWith("18/9/9/18", StringComparison.Ordinal))
			{
				int wait = 1000;
				if (!string.IsNullOrEmpty(macro))
				{
					string[] skeys = macro.Split('/');
					ushort delay;
					if (ushort.TryParse(skeys[skeys.Length - 1], out delay) && (delay > 300))
					{
						wait = delay - 300;
					}
				}
				AltTabSwapping(wait, device);
				if (control != DS4Controls.None)
				{
					macrodone[DS4ControltoInt(control)] = true;
				}
			}
			else
			{
				string[] skeys;
				int[] keys;
				if (!string.IsNullOrEmpty(macro))
				{
					skeys = macro.Split('/');
					keys = new int[skeys.Length];
				}
				else
				{
					skeys = new string[0];
					keys = new int[0];
				}
				for (int i = 0; i < keys.Length; i++)
				{
					keys[i] = int.Parse(skeys[i]);
				}
				bool[] keydown = new bool[286];
				if ((control == DS4Controls.None) || !macrodone[DS4ControltoInt(control)])
				{
					if (control != DS4Controls.None)
					{
						macrodone[DS4ControltoInt(control)] = true;
					}
					foreach (int i in keys)
					{
						if (i >= 1000000000)
						{
							string lb = i.ToString().Substring(1);
							if (i > 1000000000)
							{
								byte r = (byte)(int.Parse(lb[0].ToString()) * 100 + int.Parse(lb[1].ToString()) * 10 + int.Parse(lb[2].ToString()));
								byte g = (byte)(int.Parse(lb[3].ToString()) * 100 + int.Parse(lb[4].ToString()) * 10 + int.Parse(lb[5].ToString()));
								byte b = (byte)(int.Parse(lb[6].ToString()) * 100 + int.Parse(lb[7].ToString()) * 10 + int.Parse(lb[8].ToString()));
								DS4LightBar.forcelight[device] = true;
								DS4LightBar.forcedFlash[device] = 0;
								DS4LightBar.forcedColor[device] = new DS4Color(r, g, b);
							}
							else
							{
								DS4LightBar.forcedFlash[device] = 0;
								DS4LightBar.forcelight[device] = false;
							}
						}
						else if (i >= 1000000)
						{
							DS4Device d = Program.RootHub.DS4Controllers[device];
							string r = i.ToString().Substring(1);
							byte heavy = (byte)(int.Parse(r[0].ToString()) * 100 + int.Parse(r[1].ToString()) * 10 + int.Parse(r[2].ToString()));
							byte light = (byte)(int.Parse(r[3].ToString()) * 100 + int.Parse(r[4].ToString()) * 10 + int.Parse(r[5].ToString()));
							d.SetRumble(light, heavy);
						}
						else if (i >= 300) //ints over 300 used to delay
						{
							await Task.Delay(i - 300);
						}
						else if (!keydown[i])
						{
							switch (i)
							{
								case 256:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTDOWN); //anything above 255 is not a keyvalue
									break;
								case 257:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTDOWN);
									break;
								case 258:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEDOWN);
									break;
								case 259:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 1);
									break;
								case 260:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 2);
									break;
								case 261:
									macroControl[0] = true;
									break;
								case 262:
									macroControl[1] = true;
									break;
								case 263:
									macroControl[2] = true;
									break;
								case 264:
									macroControl[3] = true;
									break;
								case 265:
									macroControl[4] = true;
									break;
								case 266:
									macroControl[5] = true;
									break;
								case 267:
									macroControl[6] = true;
									break;
								case 268:
									macroControl[7] = true;
									break;
								case 269:
									macroControl[8] = true;
									break;
								case 270:
									macroControl[9] = true;
									break;
								case 271:
									macroControl[10] = true;
									break;
								case 272:
									macroControl[11] = true;
									break;
								case 273:
									macroControl[12] = true;
									break;
								case 274:
									macroControl[13] = true;
									break;
								case 275:
									macroControl[14] = true;
									break;
								case 276:
									macroControl[15] = true;
									break;
								case 277:
									macroControl[16] = true;
									break;
								case 278:
									macroControl[17] = true;
									break;
								case 279:
									macroControl[18] = true;
									break;
								case 280:
									macroControl[19] = true;
									break;
								case 281:
									macroControl[20] = true;
									break;
								case 282:
									macroControl[21] = true;
									break;
								case 283:
									macroControl[22] = true;
									break;
								case 284:
									macroControl[23] = true;
									break;
								case 285:
									macroControl[24] = true;
									break;
								default:
									if (keyType.HasFlag(DS4KeyType.ScanCode))
									{
										InputMethods.PerformScKeyPress((ushort)i);
									}
									else
									{
										InputMethods.PerformKeyPress((ushort)i);
									}
									break;
							}
							keydown[i] = true;
						}
						else
						{
							switch (i)
							{
								case 256:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
									break;
								case 257:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP);
									break;
								case 258:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP);
									break;
								case 259:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 1);
									break;
								case 260:
									InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 2);
									break;
								case 261:
									macroControl[0] = false;
									break;
								case 262:
									macroControl[1] = false;
									break;
								case 263:
									macroControl[2] = false;
									break;
								case 264:
									macroControl[3] = false;
									break;
								case 265:
									macroControl[4] = false;
									break;
								case 266:
									macroControl[5] = false;
									break;
								case 267:
									macroControl[6] = false;
									break;
								case 268:
									macroControl[7] = false;
									break;
								case 269:
									macroControl[8] = false;
									break;
								case 270:
									macroControl[9] = false;
									break;
								case 271:
									macroControl[10] = false;
									break;
								case 272:
									macroControl[11] = false;
									break;
								case 273:
									macroControl[12] = false;
									break;
								case 274:
									macroControl[13] = false;
									break;
								case 275:
									macroControl[14] = false;
									break;
								case 276:
									macroControl[15] = false;
									break;
								case 277:
									macroControl[16] = false;
									break;
								case 278:
									macroControl[17] = false;
									break;
								case 279:
									macroControl[18] = false;
									break;
								case 280:
									macroControl[19] = false;
									break;
								case 281:
									macroControl[20] = false;
									break;
								case 282:
									macroControl[21] = false;
									break;
								case 283:
									macroControl[22] = false;
									break;
								case 284:
									macroControl[23] = false;
									break;
								case 285:
									macroControl[24] = false;
									break;
								default:
									if (keyType.HasFlag(DS4KeyType.ScanCode))
									{
										InputMethods.PerformScKeyRelease((ushort)i);
									}
									else
									{
										InputMethods.PerformKeyRelease((ushort)i);
									}
									break;
							}
							keydown[i] = false;
						}
					}
					for (ushort i = 0; i < keydown.Length; i++)
					{
						if (!keydown[i])
						{
							continue;
						}

						switch (i)
						{
							case 256:
								InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
								break;
							case 257:
								InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP);
								break;
							case 258:
								InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP);
								break;
							case 259:
								InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 1);
								break;
							case 260:
								InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 2);
								break;
							case 261:
								macroControl[0] = false;
								break;
							case 262:
								macroControl[1] = false;
								break;
							case 263:
								macroControl[2] = false;
								break;
							case 264:
								macroControl[3] = false;
								break;
							case 265:
								macroControl[4] = false;
								break;
							case 266:
								macroControl[5] = false;
								break;
							case 267:
								macroControl[6] = false;
								break;
							case 268:
								macroControl[7] = false;
								break;
							case 269:
								macroControl[8] = false;
								break;
							case 270:
								macroControl[9] = false;
								break;
							case 271:
								macroControl[10] = false;
								break;
							case 272:
								macroControl[11] = false;
								break;
							case 273:
								macroControl[12] = false;
								break;
							case 274:
								macroControl[13] = false;
								break;
							case 275:
								macroControl[14] = false;
								break;
							case 276:
								macroControl[15] = false;
								break;
							case 277:
								macroControl[16] = false;
								break;
							case 278:
								macroControl[17] = false;
								break;
							case 279:
								macroControl[18] = false;
								break;
							case 280:
								macroControl[19] = false;
								break;
							case 281:
								macroControl[20] = false;
								break;
							case 282:
								macroControl[21] = false;
								break;
							case 283:
								macroControl[22] = false;
								break;
							case 284:
								macroControl[23] = false;
								break;
							case 285:
								macroControl[24] = false;
								break;
							default:
								if (keyType.HasFlag(DS4KeyType.ScanCode))
								{
									InputMethods.PerformScKeyRelease(i);
								}
								else
								{
									InputMethods.PerformKeyRelease(i);
								}
								break;
						}
					}
					DS4LightBar.forcedFlash[device] = 0;
					DS4LightBar.forcelight[device] = false;
					Program.RootHub.DS4Controllers[device].SetRumble(0, 0);
					if (!keyType.HasFlag(DS4KeyType.HoldMacro))
					{
						return;
					}
					await Task.Delay(50);
					if (control != DS4Controls.None)
					{
						macrodone[DS4ControltoInt(control)] = false;
					}
				}
			}
		}
示例#5
0
		public static void UpdateDS4CSetting(int deviceNum, string buttonName, bool shift, object action, string exts, DS4KeyType keyType, int trigger = 0)
		{
			m_Config.UpdateDS4CSetting(deviceNum, buttonName, shift, action, exts, keyType, trigger);
		}
示例#6
0
		public SpecialAction(string name, string controls, string type, string details, double delay = 0, string extras = null)
		{
			this.name = name;
			this.type = type;
			this.controls = controls;
			delayTime = delay;
			string[] ctrls = controls.Split('/');
			foreach (string s in ctrls)
			{
				trigger.Add(getDS4ControlsByName(s));
			}
			switch (type)
			{
				case "Macro":
					string[] macs = details.Split('/');
					foreach (string s in macs)
					{
						int v;
						if (int.TryParse(s, out v))
						{
							macro.Add(v);
						}
					}
					if (extras.Contains("Scan Code"))
					{
						keyType |= DS4KeyType.ScanCode;
					}
					break;
				case "Key":
					this.details = details.Split(' ')[0];
					if (!string.IsNullOrEmpty(extras))
					{
						string[] exts = extras.Split('\n');
						pressRelease = exts[0] == "Release";
						ucontrols = exts[1];
						string[] uctrls = exts[1].Split('/');
						foreach (string s in uctrls)
						{
							uTrigger.Add(getDS4ControlsByName(s));
						}
					}
					if (details.Contains("Scan Code"))
					{
						keyType |= DS4KeyType.ScanCode;
					}
					break;
				case "Program":
					this.details = details;
					if (extras != string.Empty)
					{
						extra = extras;
					}
					break;
				default:
					this.details = details;
					break;
			}

			if ((type != "Key") && !string.IsNullOrEmpty(extras))
			{
				ucontrols = extras;
				string[] uctrls = extras.Split('/');
				foreach (string s in uctrls)
				{
					uTrigger.Add(getDS4ControlsByName(s));
				}
			}
		}
示例#7
0
		private void UpdateDS4CKeyType(int deviceNum, string buttonName, bool shift, DS4KeyType keyType)
		{
			DS4Controls dc;
			if (buttonName.StartsWith("bn", StringComparison.Ordinal))
			{
				dc = getDS4ControlsByName(buttonName);
			}
			else
			{
				dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
			}
			foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
			{
				if (dcs.control == dc)
				{
					if (shift)
					{
						dcs.shiftKeyType = keyType;
					}
					else
					{
						dcs.keyType = keyType;
					}
					break;
				}
			}
		}
示例#8
0
		public void UpdateDS4CSetting(int deviceNum, string buttonName, bool shift, object action, string exts, DS4KeyType keyType, int trigger = 0)
		{
			DS4Controls dc;
			if (buttonName.StartsWith("bn", StringComparison.Ordinal))
			{
				dc = getDS4ControlsByName(buttonName);
			}
			else
			{
				dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
			}
			foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
			{
				if (dcs.control == dc)
				{
					dcs.UpdateSettings(shift, action, exts, keyType, trigger);
					break;
				}
			}
		}
示例#9
0
		internal void UpdateSettings(bool shift, object act, string exts, DS4KeyType _keyType, int trigger = 0)
		{
			if (!shift)
			{
				if (act is int || act is ushort)
				{
					actionType = ActionType.Key;
				}
				else if (act is string || act is X360Controls)
				{
					actionType = ActionType.Button;
				}
				else if (act is int[])
				{
					actionType = ActionType.Macro;
				}
				else
				{
					actionType = ActionType.Default;
				}
				action = act;
				extras = exts;
				keyType = _keyType;
			}
			else
			{
				if (act is int || act is ushort)
				{
					shiftActionType = ActionType.Key;
				}
				else if (act is string || act is X360Controls)
				{
					shiftActionType = ActionType.Button;
				}
				else if (act is int[])
				{
					shiftActionType = ActionType.Macro;
				}
				else
				{
					shiftActionType = ActionType.Default;
				}
				shiftAction = act;
				shiftExtras = exts;
				shiftKeyType = keyType;
				shiftTrigger = trigger;
			}
		}
示例#10
0
		public void Reset()
		{
			extras = "0,0,0,0,0,0,0,0";
			keyType = DS4KeyType.None;
			actionType = ActionType.Default;
			action = null;
			shiftActionType = ActionType.Default;
			shiftAction = null;
			shiftTrigger = 0;
			shiftExtras = "0,0,0,0,0,0,0,0";
			shiftKeyType = DS4KeyType.None;
		}
示例#11
0
 public static void UpdateDS4CSetting(int deviceNum, string buttonName, bool shift, object action, string exts, DS4KeyType kt, int trigger = 0)
 {
     Config.UpdateDS4CSetting(deviceNum, buttonName, shift, action, exts, kt, trigger);
 }
示例#12
0
        public SpecialAction(string name, string controls, string type, string details, double delay = 0, string extras = "")
        {
            this.name     = name;
            this.type     = type;
            this.controls = controls;
            delayTime     = delay;
            var ctrls = controls.Split('/');

            foreach (var s in ctrls)
            {
                trigger.Add(getDS4ControlsByName(s));
            }
            if (type == "Macro")
            {
                var macs = details.Split('/');
                foreach (var s in macs)
                {
                    int v;
                    if (int.TryParse(s, out v))
                    {
                        macro.Add(v);
                    }
                }
                if (extras.Contains("Scan Code"))
                {
                    keyType |= DS4KeyType.ScanCode;
                }
            }
            else if (type == "Key")
            {
                this.details = details.Split(' ')[0];
                if (!string.IsNullOrEmpty(extras))
                {
                    var exts = extras.Split('\n');
                    pressRelease = exts[0] == "Release";
                    ucontrols    = exts[1];
                    var uctrls = exts[1].Split('/');
                    foreach (var s in uctrls)
                    {
                        uTrigger.Add(getDS4ControlsByName(s));
                    }
                }
                if (details.Contains("Scan Code"))
                {
                    keyType |= DS4KeyType.ScanCode;
                }
            }
            else if (type == "Program")
            {
                this.details = details;
                if (extras != string.Empty)
                {
                    extra = extras;
                }
            }
            else if (type == "XboxGameDVR")
            {
                var dets   = details.Split(',');
                var macros = new List <string>();
                //string dets = "";
                var typeT = 0;
                for (var i = 0; i < 3; i++)
                {
                    if (int.TryParse(dets[i], out typeT))
                    {
                        switch (typeT)
                        {
                        case 0:
                            macros.Add("91/71/71/91");
                            break;

                        case 1:
                            macros.Add("91/164/82/82/164/91");
                            break;

                        case 2:
                            macros.Add("91/164/44/44/164/91");
                            break;

                        case 3:
                            macros.Add(dets[3] + "/" + dets[3]);
                            break;

                        case 4:
                            macros.Add("91/164/71/71/164/91");
                            break;
                        }
                    }
                }
                this.type    = "MultiAction";
                type         = "MultiAction";
                this.details = string.Join(",", macros);
            }
            else
            {
                this.details = details;
            }

            if (type != "Key" && !string.IsNullOrEmpty(extras))
            {
                ucontrols = extras;
                var uctrls = extras.Split('/');
                foreach (var s in uctrls)
                {
                    uTrigger.Add(getDS4ControlsByName(s));
                }
            }
        }
示例#13
0
        public static void mapButtons(ref DS4State nextState, ref DS4State cState, ref DS4State prevState, Mouse touchpad)
        {
            foreach (KeyValuePair <DS4Controls, ushort> customKey in Global.getCustomKeys())
            {
                DS4KeyType keyType = Global.getCustomKeyType(customKey.Key);
                bool       PrevOn  = getBoolMapping(customKey.Key, prevState);
                if (getBoolMapping(customKey.Key, cState))
                {
                    resetToDefaultValue(customKey.Key, ref cState);
                    if (!PrevOn)
                    {
                        if (keyType.HasFlag(DS4KeyType.ScanCode))
                        {
                            touchpad.performSCKeyPress(customKey.Value);
                        }
                        else
                        {
                            touchpad.performKeyPress(customKey.Value);
                        }
                    }
                    else if (keyType.HasFlag(DS4KeyType.Repeat))
                    {
                        if (keyType.HasFlag(DS4KeyType.ScanCode))
                        {
                            touchpad.performSCKeyPress(customKey.Value);
                        }
                        else
                        {
                            touchpad.performKeyPress(customKey.Value);
                        }
                    }
                }
                else if (PrevOn)
                {
                    if (keyType.HasFlag(DS4KeyType.ScanCode))
                    {
                        touchpad.performSCKeyRelease(customKey.Value);
                    }
                    else
                    {
                        touchpad.performKeyRelease(customKey.Value);
                    }
                }
            }

            bool LX = false, LY = false, RX = false, RY = false;

            nextState.LX = 127;
            nextState.LY = 127;
            nextState.RX = 127;
            nextState.RY = 127;

            foreach (KeyValuePair <DS4Controls, X360Controls> customButton in Global.getCustomButtons())
            {
                bool LXChanged = nextState.LX == 127;
                bool LYChanged = nextState.LY == 127;
                bool RXChanged = nextState.RX == 127;
                bool RYChanged = nextState.RY == 127;
                switch (customButton.Value)
                {
                case X360Controls.A:
                    nextState.Cross = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.B:
                    nextState.Circle = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.X:
                    nextState.Square = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.Y:
                    nextState.Triangle = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.LB:
                    nextState.L1 = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.LS:
                    nextState.L3 = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.RB:
                    nextState.R1 = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.RS:
                    nextState.R3 = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.DpadUp:
                    nextState.DpadUp = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.DpadDown:
                    nextState.DpadDown = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.DpadLeft:
                    nextState.DpadLeft = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.DpadRight:
                    nextState.DpadRight = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.Guide:
                    nextState.PS = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.Back:
                    nextState.Share = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.Start:
                    nextState.Options = getBoolMapping(customButton.Key, cState);
                    break;

                case X360Controls.LXNeg:
                    if (LXChanged)
                    {
                        nextState.LX = getXYAxisMapping(customButton.Key, cState);
                        LX           = true;
                    }
                    break;

                case X360Controls.LYNeg:
                    if (LYChanged)
                    {
                        nextState.LY = getXYAxisMapping(customButton.Key, cState);
                        LY           = true;
                    }
                    break;

                case X360Controls.RXNeg:
                    if (RXChanged)
                    {
                        nextState.RX = getXYAxisMapping(customButton.Key, cState);
                        RX           = true;
                    }
                    break;

                case X360Controls.RYNeg:
                    if (RYChanged)
                    {
                        nextState.RY = getXYAxisMapping(customButton.Key, cState);
                        RY           = true;
                    }
                    break;

                case X360Controls.LXPos:
                    if (LXChanged)
                    {
                        nextState.LX = getXYAxisMapping(customButton.Key, cState, true);
                        LX           = true;
                    }
                    break;

                case X360Controls.LYPos:
                    if (LYChanged)
                    {
                        nextState.LY = getXYAxisMapping(customButton.Key, cState, true);
                        LY           = true;
                    }
                    break;

                case X360Controls.RXPos:
                    if (RXChanged)
                    {
                        nextState.RX = getXYAxisMapping(customButton.Key, cState, true);
                        RX           = true;
                    }
                    break;

                case X360Controls.RYPos:
                    if (RYChanged)
                    {
                        nextState.RY = getXYAxisMapping(customButton.Key, cState, true);
                        RY           = true;
                    }
                    break;

                case X360Controls.LT:
                    nextState.L2 = getByteMapping(customButton.Key, cState);
                    break;

                case X360Controls.RT:
                    nextState.R2 = getByteMapping(customButton.Key, cState);
                    break;

                case X360Controls.LeftMouse:
                    bool PrevOn = getBoolMapping(customButton.Key, prevState);
                    bool CurOn  = getBoolMapping(customButton.Key, cState);
                    if (!PrevOn && CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_LEFTDOWN);
                    }
                    else if (PrevOn && !CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_LEFTUP);
                    }
                    break;

                case X360Controls.RightMouse:
                    PrevOn = getBoolMapping(customButton.Key, prevState);
                    CurOn  = getBoolMapping(customButton.Key, cState);
                    if (!PrevOn && CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_RIGHTDOWN);
                    }
                    else if (PrevOn && !CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_RIGHTUP);
                    }
                    break;

                case X360Controls.MiddleMouse:
                    PrevOn = getBoolMapping(customButton.Key, prevState);
                    CurOn  = getBoolMapping(customButton.Key, cState);
                    if (!PrevOn && CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_MIDDLEDOWN);
                    }
                    else if (PrevOn && !CurOn)
                    {
                        touchpad.MouseEvent(Mouse.MOUSEEVENTF_MIDDLEUP);
                    }
                    break;

                case X360Controls.Unbound:
                    resetToDefaultValue(customButton.Key, ref nextState);
                    break;
                }
            }

            if (!LX)
            {
                nextState.LX = cState.LX;
            }
            if (!LY)
            {
                nextState.LY = cState.LY;
            }
            if (!RX)
            {
                nextState.RX = cState.RX;
            }
            if (!RY)
            {
                nextState.RY = cState.RY;
            }
        }