Example #1
0
        public void TouchPadOn(int ind, DS4Device device)
        {
            ITouchpadBehaviour tPad = touchPad[ind];

            device.Touchpad.TouchButtonDown += tPad.touchButtonDown;
            device.Touchpad.TouchButtonUp   += tPad.touchButtonUp;
            device.Touchpad.TouchesBegan    += tPad.touchesBegan;
            device.Touchpad.TouchesMoved    += tPad.touchesMoved;
            device.Touchpad.TouchesEnded    += tPad.touchesEnded;
            device.Touchpad.TouchUnchanged  += tPad.touchUnchanged;
            device.SixAxis.SixAccelMoved    += tPad.sixaxisMoved;
            //LogDebug("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString());
            //Log.LogToTray("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString());
            //ControllerStatusChanged(this);
        }
        public void Initialize()
        {
            InitializeLayout();

            try
            {
                DS4Devices.findControllers();
                IEnumerable <DS4Device> devices = DS4Devices.getDS4Controllers();
                device = devices.ElementAt(0);
                device.StartUpdate();
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Example #3
0
        public bool Initialize()
        {
            newkey          = Global.Configuration.VarRegistry.GetVariable <DeviceKeys>($"{devicename}_devicekey");
            setRestoreColor = Color.Transparent;
            DS4Devices.findControllers();
            IEnumerable <DS4Device> devices = DS4Devices.getDS4Controllers();

            if (!devices.Any())
            {
                return(false);
            }

            device    = devices.ElementAt(0);
            initColor = device.LightBarColor;

            if (!isInitialized)
            {
                try
                {
                    device.Report += SendColor;
                    device.Report += UpdateProperties;
                    device.StartUpdate();
                    Global.logger.Info("Initialized Dualshock");
                }
                catch (Exception e)
                {
                    Global.logger.Error("Could not initialize Dualshock" + e);
                    isInitialized = false;
                }
                if (device != null)
                {
                    isInitialized = true;
                    if (Global.Configuration.dualshock_first_time)
                    {
                        App.Current.Dispatcher.Invoke(() =>
                        {
                            DualshockInstallInstructions instructions = new DualshockInstallInstructions();
                            instructions.ShowDialog();
                        });
                        Global.Configuration.dualshock_first_time = false;
                        Settings.ConfigManager.Save(Global.Configuration);
                    }
                }
            }

            return(isInitialized);
        }
Example #4
0
 public void Stop()
 {
     Console.WriteLine("DS4 disconnecting");
     if (_controller == null)
     {
         return;
     }
     _controller.LightBarColor       = new DS4Color(0, 0, 0);
     _controller.LightBarOnDuration  = 0;
     _controller.LightBarOffDuration = 0;
     _controller.FlushHID();
     if (_controller.ConnectionType == DS4Windows.ConnectionType.BT)
     {
         _controller.DisconnectBT();
     }
     _controller = null;
 }
Example #5
0
        protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState)
        {
            DS4Device d = DS4Controllers[deviceID];

            if ((!pState.PS || !pState.Options) && cState.PS && cState.Options)
            {
                if (!d.Charging)
                {
                    d.DisconnectBT(); InputMethods.performKeyRelease(Global.getCustomKey(0, DS4Controls.PS));
                    string[] skeys = Global.getCustomMacro(0, DS4Controls.PS).Split('/');
                    ushort[] keys  = new ushort[skeys.Length];
                    for (int i = 0; i < keys.Length; i++)
                    {
                        keys[i] = ushort.Parse(skeys[i]);
                        InputMethods.performKeyRelease(keys[i]);
                    }
                    d = null;
                }
            }
            if (!Global.getUseTPforControls(deviceID) && cState.Touch1 && pState.PS)
            {
                if (Global.getTouchSensitivity(deviceID) > 0 && touchreleased[deviceID])
                {
                    oldtouchvalue[deviceID]  = Global.getTouchSensitivity(deviceID);
                    oldscrollvalue[deviceID] = Global.getScrollSensitivity(deviceID);
                    Global.setTouchSensitivity(deviceID, 0);
                    Global.setScrollSensitivity(deviceID, 0);
                    LogDebug(Global.getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
                    Log.LogToTray(Global.getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
                    touchreleased[deviceID] = false;
                }
                else if (touchreleased[deviceID])
                {
                    Global.setTouchSensitivity(deviceID, oldtouchvalue[deviceID]);
                    Global.setScrollSensitivity(deviceID, oldscrollvalue[deviceID]);
                    LogDebug(Global.getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
                    Log.LogToTray(Global.getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
                    touchreleased[deviceID] = false;
                }
            }
            else
            {
                touchreleased[deviceID] = true;
            }
        }
        public static DS4Device CreateDevice(InputDeviceType tempType,
                                             HidDevice hidDevice, string disName, VidPidFeatureSet featureSet = VidPidFeatureSet.DefaultDS4)
        {
            DS4Device temp = null;

            switch (tempType)
            {
            case InputDeviceType.DS4:
                temp = new DS4Device(hidDevice, disName, featureSet);
                break;

            case InputDeviceType.SwitchPro:
                temp = new SwitchProDevice(hidDevice, disName, featureSet);
                break;
            }

            return(temp);
        }
Example #7
0
 public string getDS4MacAddress(int index)
 {
     if (DS4Controllers[index] != null)
     {
         DS4Device d = DS4Controllers[index];
         if (!d.IsAlive())
         //return "Connecting..."; // awaiting the first battery charge indication
         {
             var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
             TimeoutThread.IsBackground = true;
             TimeoutThread.Name         = "TimeoutFor" + d.MacAddress.ToString();
             TimeoutThread.Start();
             return(Properties.Resources.Connecting);
         }
         return(d.MacAddress);
     }
     else
     {
         return(String.Empty);
     }
 }
Example #8
0
        public Form1()
        {
            InitializeComponent();

            // The array of picture boxes will make easier to manage them
            pbx[0] = b;
            pbx[1] = c;
            pbx[2] = d;
            pbx[3] = e;


            cor[0] = Color.Green;
            cor[1] = Color.Blue;
            cor[2] = Color.Purple;
            cor[3] = Color.Yellow;
            DS4Devices.findControllers();
            ds4 = DS4Devices.getDS4Controllers().FirstOrDefault();
            if (ds4 != null)
            {
                ds4.StartUpdate();
            }
        }
Example #9
0
 public string getDS4ControllerInfo(int index)
 {
     if (DS4Controllers[index] != null)
     {
         DS4Device d = DS4Controllers[index];
         if (!d.IsAlive())
         //return "Connecting..."; // awaiting the first battery charge indication
         {
             var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
             TimeoutThread.IsBackground = true;
             TimeoutThread.Name         = "TimeoutFor" + d.MacAddress.ToString();
             TimeoutThread.Start();
             return(Properties.Resources.Connecting);
         }
         String battery;
         if (d.Charging)
         {
             if (d.Battery >= 100)
             {
                 battery = Properties.Resources.Charged;
             }
             else
             {
                 battery = Properties.Resources.Charging.Replace("*number*", d.Battery.ToString());
             }
         }
         else
         {
             battery = Properties.Resources.Battery.Replace("*number*", d.Battery.ToString());
         }
         return(d.MacAddress + " (" + d.ConnectionType + "), " + battery);
         //return d.MacAddress + " (" + d.ConnectionType + "), Battery is " + battery + ", Touchpad in " + modeSwitcher[index].ToString();
     }
     else
     {
         return(String.Empty);
     }
 }
Example #10
0
        private int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
        //Called when DS4 is disconnected or timed out
        protected virtual void On_DS4Removal(object sender, EventArgs e)
        {
            DS4Device device = (DS4Device)sender;
            int       ind    = -1;

            for (int i = 0; i < DS4Controllers.Length; i++)
            {
                if (DS4Controllers[i] != null && device.MacAddress == DS4Controllers[i].MacAddress)
                {
                    ind = i;
                }
            }
            if (ind != -1)
            {
                CurrentState[ind].Battery = PreviousState[ind].Battery = 0; // Reset for the next connection's initial status change.
                x360Bus.Unplug(ind);
                LogDebug(Properties.Resources.ControllerWasRemoved.Replace("*Mac address*", device.MacAddress));
                Log.LogToTray(Properties.Resources.ControllerWasRemoved.Replace("*Mac address*", device.MacAddress));
                System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
                DS4Controllers[ind] = null;
                touchPad[ind]       = null;
                Global.ControllerStatusChanged(this);
            }
        }
Example #11
0
        //Called every time the new input report has arrived
        protected virtual void On_Report(object sender, EventArgs e)
        {
            DS4Device device = (DS4Device)sender;

            int ind = -1;

            for (int i = 0; i < DS4Controllers.Length; i++)
            {
                if (device == DS4Controllers[i])
                {
                    ind = i;
                }
            }

            if (ind != -1)
            {
                if (Global.getFlushHIDQueue(ind))
                {
                    device.FlushHID();
                }
                if (!string.IsNullOrEmpty(device.error))
                {
                    LogDebug(device.error);
                }
                device.getExposedState(ExposedState[ind], CurrentState[ind]);
                DS4State cState = CurrentState[ind];
                device.getPreviousState(PreviousState[ind]);
                DS4State pState = PreviousState[ind];
                if (pState.Battery != cState.Battery)
                {
                    Global.ControllerStatusChanged(this);
                }
                CheckForHotkeys(ind, cState, pState);
                GetInputkeys(ind);
                if (Global.getLSCurve(ind) + Global.getRSCurve(ind) + Global.getLSDeadzone(ind) + Global.getRSDeadzone(ind) +
                    Global.getL2Deadzone(ind) + Global.getR2Deadzone(ind) > 0) //if a curve or deadzone is in place
                {
                    cState = Mapping.SetCurveAndDeadzone(ind, cState);
                }
                if (!recordingMacro && (!string.IsNullOrEmpty(Global.tempprofilename[ind]) ||
                                        Global.getHasCustomKeysorButtons(ind) || Global.getHasShiftCustomKeysorButtons(ind)))
                {
                    Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind], this);
                    cState = MappedState[ind];
                }
                if (Global.getHasCustomExtras(ind))
                {
                    DoExtras(ind);
                }

                // Update the GUI/whatever.
                DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind], touchPad[ind]);

                x360Bus.Parse(cState, processingData[ind].Report, ind);
                // We push the translated Xinput state, and simultaneously we
                // pull back any possible rumble data coming from Xinput consumers.
                if (x360Bus.Report(processingData[ind].Report, processingData[ind].Rumble))
                {
                    Byte Big   = (Byte)(processingData[ind].Rumble[3]);
                    Byte Small = (Byte)(processingData[ind].Rumble[4]);

                    if (processingData[ind].Rumble[1] == 0x08)
                    {
                        setRumble(Big, Small, ind);
                    }
                }

                // Output any synthetic events.
                Mapping.Commit(ind);
                // Pull settings updates.
                device.IdleTimeout = Global.getIdleDisconnectTimeout(ind);
            }
        }
Example #12
0
        private void DeviceOnReport(DS4Device sender, EventArgs args)
        {
            _isAlive = !sender.IsRemoved;
            var state         = sender.getCurrentState();
            var previousState = sender.getPreviousState();


            var current = state.GetType().GetFields().Where(field => field.FieldType == typeof(bool))
                          .ToDictionary(field => field.Name, field => (bool)field.GetValue(state));

            var previous = state.GetType().GetFields().Where(field => field.FieldType == typeof(bool))
                           .ToDictionary(field => field.Name, field => (bool)field.GetValue(previousState));

            var activeCurrent  = current.Where(val => val.Value).ToDictionary(i => i.Key, i => i.Value);
            var activePrevious = previous.Where(val => val.Value).ToDictionary(i => i.Key, i => i.Value);

            var inativeCurrent   = current.Where(val => !val.Value).ToDictionary(i => i.Key, i => i.Value);
            var inactivePrevious = previous.Where(val => !val.Value).ToDictionary(i => i.Key, i => i.Value);

            var l3  = GetNormalized(state.LX, state.LY);
            var l3P = GetNormalized(previousState.LX, previousState.LY);


            Move?.Invoke(l3);


            if (state.L2Btn || state.R2Btn)
            {
                Breath?.Invoke(new Vector2(state.L2, state.R2));
            }
            else
            {
                BreathRelease?.Invoke();
            }

            //Move Up
            if (l3.Y > .5f)
            {
                if (l3P.Y < .5 && l3P.Y > 0)
                {
                    Next?.Invoke();
                }
            }
            //Move Down
            if (l3.Y < -.5)
            {
                if (l3P.Y > -.5)
                {
                    Previous?.Invoke();
                }
            }

            OnButtonPressedEvent(sender, state);

            foreach (var c in activeCurrent.Where(c => !activePrevious.ContainsKey(c.Key)))
            {
                if (CanReceiveInput)
                {
                    OnOnButtonClickEvent(sender, state, c.Key);
                }
            }

            foreach (var c in inativeCurrent.Where(c => activePrevious.ContainsKey(c.Key)))
            {
                if (CanReceiveInput)
                {
                    OnReleaseClickEvent(sender, state, c.Key);
                }
            }
        }
Example #13
0
        private void OnOnButtonClickEvent(DS4Device sender, DS4State state, string cKey)
        {
            var chave = Enum.TryParse(cKey, out DS4Button button);

            if (!chave)
            {
                return;
            }
            switch (button)
            {
            case DS4Button.Cross:
                CallAction(Select, "Select");
                Jump?.Invoke();

                break;

            case DS4Button.Square:
                Attack?.Invoke();
                break;

            case DS4Button.Circle:
                break;

            case DS4Button.Triangle:
                break;

            case DS4Button.Options:
                CallAction(Menu, "Menu");
                break;

            case DS4Button.Share:
                break;

            case DS4Button.L1:
                break;

            case DS4Button.L3:
                break;

            case DS4Button.R1:
                Roll?.Invoke();
                break;

            case DS4Button.R3:
                break;

            case DS4Button.DpadLeft:
                break;

            case DS4Button.DpadUp:
                Next?.Invoke();
                break;

            case DS4Button.DpadRight:
                break;

            case DS4Button.DpadDown:
                Previous?.Invoke();
                break;
            }
        }
Example #14
0
 public DS4ControllerHandler(int _id, DS4Device device)
 {
     id        = _id;
     ds4Device = device;
     ds4Device.StartUpdate();
 }
Example #15
0
        public static void updateLightBar(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState)
        {
            DS4Color color;

            if (!defualtLight)
            {
                if (Global.getShiftColorOn(deviceNum) && Global.getShiftModifier(deviceNum) > 0 && shiftMod(device, deviceNum, cState, eState))
                {
                    color = Global.loadShiftColor(deviceNum);
                }
                else
                {
                    if (Global.getRainbow(deviceNum) > 0)
                    {                                                      // Display rainbow
                        DateTime now = DateTime.UtcNow;
                        if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion
                        {
                            oldnow = now;
                            if (device.Charging)
                            {
                                counters[deviceNum] -= 1.5 * 3 / Global.getRainbow(deviceNum);
                            }
                            else
                            {
                                counters[deviceNum] += 1.5 * 3 / Global.getRainbow(deviceNum);
                            }
                        }
                        if (counters[deviceNum] < 0)
                        {
                            counters[deviceNum] = 180000;
                        }
                        if (Global.getLedAsBatteryIndicator(deviceNum))
                        {
                            color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery));
                        }
                        else
                        {
                            color = HuetoRGB((float)counters[deviceNum] % 360, 255);
                        }
                    }
                    else if (Global.getLedAsBatteryIndicator(deviceNum))
                    {
                        //if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation
                        {
                            DS4Color fullColor = new DS4Color
                            {
                                red   = Global.loadColor(deviceNum).red,
                                green = Global.loadColor(deviceNum).green,
                                blue  = Global.loadColor(deviceNum).blue
                            };

                            color = Global.loadLowColor(deviceNum);
                            DS4Color lowColor = new DS4Color
                            {
                                red   = color.red,
                                green = color.green,
                                blue  = color.blue
                            };

                            color = Global.getTransitionedColor(lowColor, fullColor, (uint)device.Battery);
                        }
                    }
                    else
                    {
                        color = Global.loadColor(deviceNum);
                    }


                    if (device.Battery <= Global.getFlashAt(deviceNum) && !defualtLight && !device.Charging)
                    {
                        if (!(Global.loadFlashColor(deviceNum).red == 0 &&
                              Global.loadFlashColor(deviceNum).green == 0 &&
                              Global.loadFlashColor(deviceNum).blue == 0))
                        {
                            color = Global.loadFlashColor(deviceNum);
                        }
                    }

                    if (Global.getIdleDisconnectTimeout(deviceNum) > 0 && Global.getLedAsBatteryIndicator(deviceNum) && (!device.Charging || device.Battery >= 100))
                    {//Fade lightbar by idle time
                        TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
                        double   botratio  = timeratio.TotalMilliseconds;
                        double   topratio  = TimeSpan.FromSeconds(Global.getIdleDisconnectTimeout(deviceNum)).TotalMilliseconds;
                        double   ratio     = ((botratio / topratio) * 100);
                        if (ratio >= 50 && ratio <= 100)
                        {
                            color = Global.getTransitionedColor(color, new DS4Color {
                                red = 0, green = 0, blue = 0
                            }, (uint)((ratio - 50) * 2));
                        }
                        else if (ratio >= 100)
                        {
                            color = Global.getTransitionedColor(color, new DS4Color {
                                red = 0, green = 0, blue = 0
                            }, 100);
                        }
                    }
                    if (device.Charging && device.Battery < 100)
                    {
                        switch (Global.getChargingType(deviceNum))
                        {
                        case 1:
                            if (fadetimer[deviceNum] <= 0)
                            {
                                fadedirection[deviceNum] = true;
                            }
                            else if (fadetimer[deviceNum] >= 105)
                            {
                                fadedirection[deviceNum] = false;
                            }
                            if (fadedirection[deviceNum])
                            {
                                fadetimer[deviceNum] += .1;
                            }
                            else
                            {
                                fadetimer[deviceNum] -= .1;
                            }
                            color = Global.getTransitionedColor(color, new DS4Color {
                                red = 0, green = 0, blue = 0
                            }, fadetimer[deviceNum]);
                            break;

                        case 2:
                            counters[deviceNum] += .167;
                            color = HuetoRGB((float)counters[deviceNum] % 360, 255);
                            break;

                        case 3:
                            color = Global.loadChargingColor(deviceNum);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            else if (shuttingdown)
            {
                color = new DS4Color {
                    red = 0, green = 0, blue = 0
                }
            }
            ;
            else
            {
                if (device.ConnectionType == ConnectionType.BT)
                {
                    color = new DS4Color {
                        red = 32, green = 64, blue = 64
                    }
                }
                ;
                else
                {
                    color = new DS4Color {
                        red = 0, green = 0, blue = 0
                    }
                };
            }
            bool distanceprofile = (Global.getAProfile(deviceNum).ToLower().Contains("distance") || Global.tempprofilename[deviceNum].ToLower().Contains("distance"));

            if (distanceprofile && !defualtLight)
            { //Thing I did for Distance
                float rumble = device.LeftHeavySlowRumble / 2.55f;
                byte  max    = Math.Max(color.red, Math.Max(color.green, color.blue));
                if (device.LeftHeavySlowRumble > 100)
                {
                    color = getTransitionedColor(new DS4Color {
                        green = max, red = max
                    }, rumble, new DS4Color {
                        red = 255
                    });
                }
                else
                {
                    color = getTransitionedColor(color, device.LeftHeavySlowRumble, getTransitionedColor(new DS4Color {
                        green = max, red = max
                    }, 39.6078f, new DS4Color {
                        red = 255
                    }));
                }
            }
            DS4HapticState haptics = new DS4HapticState
            {
                LightBarColor = color
            };

            if (haptics.IsLightBarSet())
            {
                if (device.Battery <= Global.getFlashAt(deviceNum) && !defualtLight && !device.Charging)
                {
                    int level = device.Battery / 10;
                    //if (level >= 10)
                    //level = 0; // all values of ~0% or >~100% are rendered the same
                    haptics.LightBarFlashDurationOn  = BatteryIndicatorDurations[level, 0];
                    haptics.LightBarFlashDurationOff = BatteryIndicatorDurations[level, 1];
                }
                else if (distanceprofile && device.LeftHeavySlowRumble > 155) //also part of Distance
                {
                    haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)((-device.LeftHeavySlowRumble + 265));
                    haptics.LightBarExplicitlyOff    = true;
                }
                else
                {
                    //haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1;
                    haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 0;
                    haptics.LightBarExplicitlyOff    = true;
                }
            }
            else
            {
                haptics.LightBarExplicitlyOff = true;
            }
            if (device.LightBarOnDuration != haptics.LightBarFlashDurationOn && device.LightBarOnDuration != 1 && haptics.LightBarFlashDurationOn == 0)
            {
                haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1;
            }
            if (device.LightBarOnDuration == 1) //helps better reset the color
            {
                System.Threading.Thread.Sleep(5);
            }
            device.pushHapticState(haptics);
        }
Example #16
0
        public static bool shiftMod(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState)
        {
            bool shift;

            switch (Global.getShiftModifier(deviceNum))
            {
            case 1: shift = Mapping.getBoolMapping(DS4Controls.Cross, cState, eState); break;

            case 2: shift = Mapping.getBoolMapping(DS4Controls.Circle, cState, eState); break;

            case 3: shift = Mapping.getBoolMapping(DS4Controls.Square, cState, eState); break;

            case 4: shift = Mapping.getBoolMapping(DS4Controls.Triangle, cState, eState); break;

            case 5: shift = Mapping.getBoolMapping(DS4Controls.Options, cState, eState); break;

            case 6: shift = Mapping.getBoolMapping(DS4Controls.Share, cState, eState); break;

            case 7: shift = Mapping.getBoolMapping(DS4Controls.DpadUp, cState, eState); break;

            case 8: shift = Mapping.getBoolMapping(DS4Controls.DpadDown, cState, eState); break;

            case 9: shift = Mapping.getBoolMapping(DS4Controls.DpadLeft, cState, eState); break;

            case 10: shift = Mapping.getBoolMapping(DS4Controls.DpadRight, cState, eState); break;

            case 11: shift = Mapping.getBoolMapping(DS4Controls.PS, cState, eState); break;

            case 12: shift = Mapping.getBoolMapping(DS4Controls.L1, cState, eState); break;

            case 13: shift = Mapping.getBoolMapping(DS4Controls.R1, cState, eState); break;

            case 14: shift = Mapping.getBoolMapping(DS4Controls.L2, cState, eState); break;

            case 15: shift = Mapping.getBoolMapping(DS4Controls.R2, cState, eState); break;

            case 16: shift = Mapping.getBoolMapping(DS4Controls.L3, cState, eState); break;

            case 17: shift = Mapping.getBoolMapping(DS4Controls.R3, cState, eState); break;

            case 18: shift = Mapping.getBoolMapping(DS4Controls.TouchLeft, cState, eState); break;

            case 19: shift = Mapping.getBoolMapping(DS4Controls.TouchUpper, cState, eState); break;

            case 20: shift = Mapping.getBoolMapping(DS4Controls.TouchMulti, cState, eState); break;

            case 21: shift = Mapping.getBoolMapping(DS4Controls.TouchRight, cState, eState); break;

            case 22: shift = Mapping.getBoolMapping(DS4Controls.GyroZNeg, cState, eState); break;

            case 23: shift = Mapping.getBoolMapping(DS4Controls.GyroZPos, cState, eState); break;

            case 24: shift = Mapping.getBoolMapping(DS4Controls.GyroXPos, cState, eState); break;

            case 25: shift = Mapping.getBoolMapping(DS4Controls.GyroXNeg, cState, eState); break;

            case 26: shift = device.getCurrentState().Touch1; break;

            default: shift = false; break;
            }
            return(shift);
        }