예제 #1
0
        private void CalibrateTrigger_Click(object sender, RoutedEventArgs e)
        {
            _calibrationTarget = (sender as FrameworkElement).Tag.ToString();

            var nonCalibrated = new NintrollerLib.Trigger();
            var curCalibrated = new NintrollerLib.Trigger();

            if (!(_lastState is ClassicController))
            {
                return;
            }

            if (_calibrationTarget == App.CAL_CC_RTRIGGER)
            {
                nonCalibrated = Calibrations.None.ClassicControllerRaw.R;
                curCalibrated = ((ClassicController)_lastState).R;
            }
            else if (_calibrationTarget == App.CAL_CC_LTRIGGER)
            {
                nonCalibrated = Calibrations.None.ClassicControllerRaw.L;
                curCalibrated = ((ClassicController)_lastState).L;
            }

            Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated);
            _openTrigWindow = trigCal;
            trigCal.ShowDialog();

            if (trigCal.Apply)
            {
                OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
            }

            _openTrigWindow = null;
        }
예제 #2
0
        private void CalibrateTrigger_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Apply Port target
            _calibrationTarget = (sender as FrameworkElement).Tag.ToString();

            GameCubeController controller;

            GetActivePort(out controller);

            var nonCalibrated = new NintrollerLib.Trigger();
            var curCalibrated = new NintrollerLib.Trigger();

            if (_calibrationTarget == App.CAL_GCN_RTRIGGER)
            {
                nonCalibrated = Calibrations.None.GameCubeControllerRaw.R;
                curCalibrated = controller.R;
            }
            else if (_calibrationTarget == App.CAL_GCN_LTRIGGER)
            {
                nonCalibrated = Calibrations.None.GameCubeControllerRaw.L;
                curCalibrated = controller.L;
            }

            Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated);
            _openTrigWindow = trigCal;
            trigCal.ShowDialog();

            if (trigCal.Apply)
            {
                OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
            }

            _openJoyWindow = null;
            trigCal        = null;
        }
        private void CalibrateTrigger_Click(object sender, RoutedEventArgs e)
        {
            _calibrationTarget = (sender as FrameworkElement).Tag.ToString();

            var nonCalibrated = new NintrollerLib.Trigger();
            var curCalibrated = new NintrollerLib.Trigger();

            if (_calibrationTarget == App.CAL_CC_RTRIGGER)
            {
                nonCalibrated = Calibrations.None.ClassicControllerRaw.R;
                curCalibrated = ((ClassicController)_lastState).R;
            }
            else if (_calibrationTarget == App.CAL_CC_LTRIGGER)
            {
                nonCalibrated = Calibrations.None.ClassicControllerRaw.L;
                curCalibrated = ((ClassicController)_lastState).L;
            }
            else if (_calibrationTarget == App.CAL_GUT_WHAMMY)
            {
                nonCalibrated = Calibrations.None.GuitarRaw.whammyBar;
                curCalibrated = ((Guitar)_lastState).whammyBar;
            }
            else
            {
                return;
            }

            Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated);
            _openTrigWindow = trigCal;

#if DEBUG
            if (DeviceID.StartsWith("Dummy"))
            {
                trigCal.Closed += (obj, args) =>
                {
                    if (trigCal.Apply)
                    {
                        OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
                    }

                    _openTrigWindow = null;
                };
                trigCal.Show();

                return;
            }
#endif

            trigCal.ShowDialog();

            if (trigCal.Apply)
            {
                OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
            }

            _openTrigWindow = null;
        }
예제 #4
0
        private void CalibrateTrigger(bool rightTrigger)
        {
            GameCubeController controller;

            GetActivePort(out controller);

            var nonCalibrated = new NintrollerLib.Trigger();
            var curCalibrated = new NintrollerLib.Trigger();

            if (rightTrigger)
            {
                _calibrationTarget = "R";
                nonCalibrated      = Calibrations.None.GameCubeControllerRaw.R;
                curCalibrated      = controller.R;
            }
            else
            {
                _calibrationTarget = "L";
                nonCalibrated      = Calibrations.None.GameCubeControllerRaw.L;
                curCalibrated      = controller.L;
            }

            Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated);
            _openTrigWindow = trigCal;

#if DEBUG
            // Don't use show dialog so dummy values can be modified
            if (DeviceID?.StartsWith("Dummy") ?? false)
            {
                trigCal.Closed += (obj, args) =>
                {
                    if (trigCal.Apply)
                    {
                        OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
                    }
                    _openTrigWindow = null;
                };

                trigCal.Show();
                return;
            }
#endif

            trigCal.ShowDialog();

            if (trigCal.Apply)
            {
                OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName);
            }

            _openTrigWindow = null;
            trigCal         = null;
        }