2014-03-28 02:50:40 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using DS4Library;
|
|
|
|
|
using DS4Control;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
namespace ScpServer
|
|
|
|
|
{
|
|
|
|
|
public partial class Options : Form
|
|
|
|
|
{
|
|
|
|
|
private DS4Control.Control scpDevice;
|
|
|
|
|
private int device;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private string filename;
|
|
|
|
|
private ScpForm mainWin;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Byte[] oldLedColor, oldLowLedColor;
|
|
|
|
|
TrackBar tBsixaxisGyroX, tBsixaxisGyroY, tBsixaxisGyroZ,
|
|
|
|
|
tBsixaxisAccelX, tBsixaxisAccelY, tBsixaxisAccelZ;
|
|
|
|
|
Timer sixaxisTimer = new Timer();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private List<Button> buttons = new List<Button>();
|
|
|
|
|
//private Dictionary<string, string> defaults = new Dictionary<string, string>();
|
|
|
|
|
private Button lastSelected;
|
|
|
|
|
int alphacolor;
|
|
|
|
|
Color reg;
|
|
|
|
|
Color full;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public Options(DS4Control.Control bus_device, int deviceNum, string name, ScpForm mainWindow)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
device = deviceNum;
|
|
|
|
|
scpDevice = bus_device;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
filename = name;
|
|
|
|
|
mainWin = mainWindow;
|
|
|
|
|
if (filename != "" && filename != "+New Profile")
|
|
|
|
|
{
|
|
|
|
|
tBProfile.Text = filename;
|
|
|
|
|
DS4Color color = Global.loadColor(device);
|
|
|
|
|
redBar.Value = color.red;
|
|
|
|
|
greenBar.Value = color.green;
|
|
|
|
|
blueBar.Value = color.blue;
|
|
|
|
|
rumbleBoostBar.Value = DS4Control.Global.loadRumbleBoost(device);
|
|
|
|
|
rumbleSwap.Checked = Global.getRumbleSwap(device);
|
|
|
|
|
batteryLed.Checked = DS4Control.Global.getLedAsBatteryIndicator(device);
|
|
|
|
|
flashLed.Checked = DS4Control.Global.getFlashWhenLowBattery(device);
|
|
|
|
|
numUDTouch.Value = Global.getTouchSensitivity(device);
|
|
|
|
|
numUDScroll.Value = Global.getScrollSensitivity(device);
|
|
|
|
|
numUDTap.Value = Global.getTapSensitivity(device);
|
|
|
|
|
cBTap.Checked = Global.getTap(device);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
cBDoubleTap.Checked = Global.getDoubleTap(device);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
leftTriggerMiddlePoint.Text = Global.getLeftTriggerMiddle(device).ToString();
|
|
|
|
|
rightTriggerMiddlePoint.Text = Global.getRightTriggerMiddle(device).ToString();
|
|
|
|
|
DS4Color lowColor = Global.loadLowColor(device);
|
|
|
|
|
touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device);
|
|
|
|
|
cBlowerRCOn.Checked = Global.getLowerRCOn(device);
|
|
|
|
|
flushHIDQueue.Checked = Global.getFlushHIDQueue(device);
|
|
|
|
|
idleDisconnectTimeout.Value = Global.getIdleDisconnectTimeout(device);
|
|
|
|
|
// Force update of color choosers
|
|
|
|
|
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
|
|
|
|
reg = Color.FromArgb(color.red, color.green, color.blue);
|
|
|
|
|
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
|
|
|
|
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
|
|
|
|
pBController.BackColor = colorChooserButton.BackColor;
|
|
|
|
|
lowColorChooserButton.BackColor = Color.FromArgb(lowColor.red, lowColor.green, lowColor.blue);
|
|
|
|
|
lowRedValLabel.Text = lowColor.red.ToString();
|
|
|
|
|
lowGreenValLabel.Text = lowColor.green.ToString();
|
|
|
|
|
lowBlueValLabel.Text = lowColor.blue.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Global.saveColor(device,
|
|
|
|
|
(byte)redBar.Value,
|
|
|
|
|
(byte)greenBar.Value,
|
|
|
|
|
(byte)blueBar.Value);
|
|
|
|
|
Global.saveLowColor(device,
|
|
|
|
|
(byte)redBar.Value,
|
|
|
|
|
(byte)greenBar.Value,
|
|
|
|
|
(byte)blueBar.Value);
|
|
|
|
|
double middle;
|
|
|
|
|
if (Double.TryParse(leftTriggerMiddlePoint.Text, out middle))
|
|
|
|
|
Global.setLeftTriggerMiddle(device, middle);
|
|
|
|
|
if (Double.TryParse(rightTriggerMiddlePoint.Text, out middle))
|
|
|
|
|
Global.setRightTriggerMiddle(device, middle);
|
|
|
|
|
Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value);
|
|
|
|
|
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
|
|
|
|
Global.setRumbleSwap(device, rumbleSwap.Checked);
|
|
|
|
|
Global.setTouchSensitivity(device, (byte)numUDTouch.Value);
|
|
|
|
|
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
|
|
|
|
|
Global.setLowerRCOn(device, cBlowerRCOn.Checked);
|
|
|
|
|
Global.setTapSensitivity(device, (byte)numUDTap.Value);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
Global.setDoubleTap(device, cBDoubleTap.Checked);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
|
|
|
|
|
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
#region watch sixaxis data
|
|
|
|
|
// Control Positioning
|
2014-04-27 21:32:09 +02:00
|
|
|
|
int horizontalOffset = cbSixaxis.Location.X,
|
2014-03-28 02:50:40 +01:00
|
|
|
|
verticalOffset = cbSixaxis.Location.Y + cbSixaxis.Height + 5,
|
2014-04-27 21:32:09 +02:00
|
|
|
|
tWidth = 100, tHeight = 19,
|
2014-03-28 02:50:40 +01:00
|
|
|
|
horizontalMargin = 10 + tWidth,
|
|
|
|
|
verticalMargin = 1 + tHeight;
|
|
|
|
|
|
|
|
|
|
sixaxisTimer.Tick +=
|
|
|
|
|
(delegate
|
|
|
|
|
{
|
|
|
|
|
if (tBsixaxisGyroX == null)
|
|
|
|
|
{
|
|
|
|
|
tBsixaxisGyroX = new TrackBar();
|
|
|
|
|
tBsixaxisGyroY = new TrackBar();
|
|
|
|
|
tBsixaxisGyroZ = new TrackBar();
|
|
|
|
|
tBsixaxisAccelX = new TrackBar();
|
|
|
|
|
tBsixaxisAccelY = new TrackBar();
|
|
|
|
|
tBsixaxisAccelZ = new TrackBar();
|
|
|
|
|
TrackBar[] allSixAxes = { tBsixaxisGyroX, tBsixaxisGyroY, tBsixaxisGyroZ,
|
|
|
|
|
tBsixaxisAccelX, tBsixaxisAccelY, tBsixaxisAccelZ};
|
|
|
|
|
foreach (TrackBar t in allSixAxes)
|
|
|
|
|
{
|
|
|
|
|
((System.ComponentModel.ISupportInitialize)(t)).BeginInit();
|
|
|
|
|
t.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
|
|
|
t.BackColor = SystemColors.ControlLightLight;
|
|
|
|
|
t.AutoSize = false;
|
|
|
|
|
t.Enabled = false;
|
|
|
|
|
t.Minimum = -0x8000;
|
|
|
|
|
t.Maximum = 0x7fff;
|
|
|
|
|
t.Size = new Size(tWidth, tHeight);
|
|
|
|
|
t.TickFrequency = 0x2000; // calibrated to ~1G
|
|
|
|
|
}
|
|
|
|
|
// tBsixaxisGyroX
|
|
|
|
|
tBsixaxisGyroX.Location = new Point(horizontalOffset, verticalOffset);
|
|
|
|
|
tBsixaxisGyroX.Name = "tBsixaxisGyroX";
|
|
|
|
|
// tBsixaxisGyroY
|
|
|
|
|
tBsixaxisGyroY.Location = new Point(horizontalOffset, verticalOffset + verticalMargin);
|
|
|
|
|
tBsixaxisGyroY.Name = "tBsixaxisGyroY";
|
|
|
|
|
// tBsixaxisGyroZ
|
|
|
|
|
tBsixaxisGyroZ.Location = new Point(horizontalOffset, verticalOffset + verticalMargin * 2);
|
|
|
|
|
tBsixaxisGyroZ.Name = "tBsixaxisGyroZ";
|
|
|
|
|
// tBsixaxisAccelX
|
|
|
|
|
tBsixaxisAccelX.Location = new Point(horizontalOffset + horizontalMargin, verticalOffset);
|
|
|
|
|
tBsixaxisAccelX.Name = "tBsixaxisAccelX";
|
|
|
|
|
// tBsixaxisAccelY
|
|
|
|
|
tBsixaxisAccelY.Location = new Point(horizontalOffset + horizontalMargin, verticalOffset + verticalMargin);
|
|
|
|
|
tBsixaxisAccelY.Name = "tBsixaxisAccelY";
|
|
|
|
|
// tBsixaxisAccelZ
|
|
|
|
|
tBsixaxisAccelZ.Location = new Point(horizontalOffset + horizontalMargin, verticalOffset + verticalMargin * 2);
|
|
|
|
|
tBsixaxisAccelZ.Name = "tBsixaxisAccelZ";
|
|
|
|
|
foreach (TrackBar t in allSixAxes)
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
tabOther.Controls.Add(t);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
((System.ComponentModel.ISupportInitialize)(t)).EndInit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//byte[] inputData = null;// scpDevice.GetInputData(device);
|
|
|
|
|
//if (inputData != null)
|
|
|
|
|
{
|
|
|
|
|
// MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff
|
|
|
|
|
// Enough additional acceleration and we are no longer mostly measuring Earth's gravity...
|
|
|
|
|
// We should try to indicate setpoints of the calibration when exposing this measurement....
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisGyroX, (scpDevice.ExposedState[device].GyroX + tBsixaxisGyroX.Value * 2) / 3);
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisGyroY, (scpDevice.ExposedState[device].GyroY + tBsixaxisGyroY.Value * 2) / 3);
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisGyroZ, (scpDevice.ExposedState[device].GyroZ + tBsixaxisGyroZ.Value * 2) / 3);
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisAccelX, (scpDevice.ExposedState[device].AccelX + tBsixaxisAccelX.Value * 2) / 3);
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisAccelY, (scpDevice.ExposedState[device].AccelY + tBsixaxisAccelY.Value * 2) / 3);
|
|
|
|
|
SetDynamicTrackBarValue(tBsixaxisAccelZ, (scpDevice.ExposedState[device].AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
sixaxisTimer.Interval = 1000 / 60;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
this.FormClosing += delegate
|
|
|
|
|
{
|
|
|
|
|
if (sixaxisTimer.Enabled)
|
|
|
|
|
sixaxisTimer.Stop();
|
|
|
|
|
//foreach (CustomMapping cmf in customMappingForms)
|
|
|
|
|
// if (cmf != null)
|
|
|
|
|
// cmf.Close();
|
|
|
|
|
};
|
2014-03-28 02:50:40 +01:00
|
|
|
|
if (cbSixaxis.Checked)
|
|
|
|
|
sixaxisTimer.Start();
|
|
|
|
|
#endregion
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
foreach (System.Windows.Forms.Control control in tabControls.Controls)
|
|
|
|
|
if (control is Button)
|
|
|
|
|
if (!((Button)control).Text.Contains("btn"))
|
|
|
|
|
buttons.Add((Button)control);
|
|
|
|
|
foreach (System.Windows.Forms.Control control in tabTouchPad.Controls)
|
|
|
|
|
if (control is Button)
|
|
|
|
|
buttons.Add((Button)control);
|
|
|
|
|
foreach (System.Windows.Forms.Control control in tabAnalogSticks.Controls)
|
|
|
|
|
if (control is Button)
|
|
|
|
|
buttons.Add((Button)control);
|
|
|
|
|
if (filename != "" && filename != "New Profile")
|
|
|
|
|
Global.LoadProfile(device, buttons.ToArray());
|
|
|
|
|
ToolTip tp = new ToolTip();
|
|
|
|
|
tp.SetToolTip(cBlowerRCOn, "Best used with right side as mouse");
|
2014-04-29 03:14:01 +02:00
|
|
|
|
tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with one tap");
|
2014-04-27 21:32:09 +02:00
|
|
|
|
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
|
|
|
|
|
btnLeftStick.Enter += btnSticks_Enter;
|
|
|
|
|
btnRightStick.Enter += btnSticks_Enter;
|
|
|
|
|
btnTouchtab.Enter += btnTouchtab_Enter;
|
|
|
|
|
btnLightbar.Click += btnLightbar_Click;
|
|
|
|
|
UpdateLists();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbSixaxis_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbSixaxis.Checked)
|
|
|
|
|
{
|
|
|
|
|
sixaxisTimer.Start();
|
|
|
|
|
if (tBsixaxisGyroX != null)
|
|
|
|
|
{
|
|
|
|
|
tBsixaxisGyroX.Visible = true;
|
|
|
|
|
tBsixaxisGyroY.Visible = true;
|
|
|
|
|
tBsixaxisGyroZ.Visible = true;
|
|
|
|
|
tBsixaxisAccelX.Visible = true;
|
|
|
|
|
tBsixaxisAccelY.Visible = true;
|
|
|
|
|
tBsixaxisAccelZ.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sixaxisTimer.Stop();
|
|
|
|
|
tBsixaxisGyroX.Visible = false;
|
|
|
|
|
tBsixaxisGyroY.Visible = false;
|
|
|
|
|
tBsixaxisGyroZ.Visible = false;
|
|
|
|
|
tBsixaxisAccelX.Visible = false;
|
|
|
|
|
tBsixaxisAccelY.Visible = false;
|
|
|
|
|
tBsixaxisAccelZ.Visible = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetDynamicTrackBarValue(TrackBar trackBar, int value)
|
|
|
|
|
{
|
|
|
|
|
if (trackBar.Maximum < value)
|
|
|
|
|
trackBar.Maximum = value;
|
|
|
|
|
else if (trackBar.Minimum > value)
|
|
|
|
|
trackBar.Minimum = value;
|
|
|
|
|
trackBar.Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
KBM360 kbm360 = null;
|
|
|
|
|
|
|
|
|
|
private void Show_ControlsBn(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lastSelected = (Button)sender;
|
|
|
|
|
kbm360 = new KBM360(scpDevice, device, this, lastSelected, 0);
|
|
|
|
|
kbm360.Icon = this.Icon;
|
|
|
|
|
kbm360.ShowDialog();
|
|
|
|
|
//kbm360.FormClosed += delegate { kbm360 = null; };
|
|
|
|
|
//this.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Show360Controls(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.Button == MouseButtons.Right)
|
|
|
|
|
{
|
|
|
|
|
lastSelected = (Button)sender;
|
|
|
|
|
kbm360 = new KBM360(scpDevice, device, this, lastSelected, 1);
|
|
|
|
|
kbm360.Icon = this.Icon;
|
|
|
|
|
kbm360.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ChangeButtonText(string controlname, object tag)
|
|
|
|
|
{
|
|
|
|
|
lastSelected.Text = controlname;
|
|
|
|
|
int value;
|
|
|
|
|
if (Int32.TryParse(tag.ToString(), out value))
|
|
|
|
|
lastSelected.Tag = value;
|
|
|
|
|
else
|
|
|
|
|
lastSelected.Tag = tag.ToString();
|
|
|
|
|
}
|
|
|
|
|
public void ChangeButtonText(string controlname)
|
|
|
|
|
{
|
|
|
|
|
lastSelected.Text = controlname;
|
|
|
|
|
lastSelected.Tag = controlname;
|
|
|
|
|
}
|
|
|
|
|
public void Toggle_Repeat(bool Checked)
|
|
|
|
|
{
|
|
|
|
|
if (lastSelected.Tag is int || lastSelected.Tag is UInt16)
|
|
|
|
|
if (Checked)
|
|
|
|
|
lastSelected.ForeColor = Color.Red;
|
|
|
|
|
else lastSelected.ForeColor = SystemColors.WindowText;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//cbRepeat.Checked = false;
|
|
|
|
|
lastSelected.ForeColor = SystemColors.WindowText;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void Toggle_ScanCode(bool Checked)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (lastSelected.Tag is int || lastSelected.Tag is UInt16)
|
|
|
|
|
if (Checked)
|
|
|
|
|
lastSelected.Font = new Font(lastSelected.Font, FontStyle.Bold);
|
|
|
|
|
else lastSelected.Font = new Font(lastSelected.Font, FontStyle.Regular);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//cbScanCode.Checked = false;
|
|
|
|
|
lastSelected.Font = new Font(lastSelected.Font, FontStyle.Regular);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void btnSticks_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tabOptions.SelectTab(1);
|
|
|
|
|
}
|
|
|
|
|
private void btnTouchtab_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tabOptions.SelectTab(2);
|
|
|
|
|
}
|
|
|
|
|
private void btnLightbar_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//tabOptions.SelectTab(3);
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
lowColorChooserButton_Click(sender, e);
|
|
|
|
|
else colorChooserButton_Click(sender, e);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void saveButton_Click(object sender, EventArgs e)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
Global.saveColor(device,
|
2014-04-27 21:32:09 +02:00
|
|
|
|
(byte)redBar.Value,
|
|
|
|
|
(byte)greenBar.Value,
|
|
|
|
|
(byte)blueBar.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Global.saveLowColor(device,
|
2014-04-27 21:32:09 +02:00
|
|
|
|
lowColorChooserButton.BackColor.R,
|
|
|
|
|
lowColorChooserButton.BackColor.G,
|
2014-03-28 02:50:40 +01:00
|
|
|
|
lowColorChooserButton.BackColor.B);
|
|
|
|
|
double middle;
|
|
|
|
|
if (Double.TryParse(leftTriggerMiddlePoint.Text, out middle))
|
|
|
|
|
Global.setLeftTriggerMiddle(device, middle);
|
|
|
|
|
if (Double.TryParse(rightTriggerMiddlePoint.Text, out middle))
|
|
|
|
|
Global.setRightTriggerMiddle(device, middle);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value);
|
|
|
|
|
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
|
|
|
|
Global.setRumbleSwap(device, rumbleSwap.Checked);
|
|
|
|
|
Global.setTouchSensitivity(device, (byte)numUDTouch.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setLowerRCOn(device, cBlowerRCOn.Checked);
|
|
|
|
|
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
|
|
|
|
|
int disconnectTimeout;
|
|
|
|
|
if (int.TryParse(idleDisconnectTimeout.Text, out disconnectTimeout))
|
|
|
|
|
Global.setIdleDisconnectTimeout(device, disconnectTimeout);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
Global.setDoubleTap(device, cBDoubleTap.Checked);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
Global.setAProfile(device, tBProfile.Text);
|
2014-04-29 10:22:37 +02:00
|
|
|
|
Global.SaveProfile(device, tBProfile.Text, buttons.ToArray());
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.Save();
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MessageBox.Show("Please enter a valid name", "Not valid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void redBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// New settings
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
//lowRedValLabel.Text = redBar.Value.ToString();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
lowColorChooserButton.BackColor = Color.FromArgb(
|
|
|
|
|
redBar.Value,
|
|
|
|
|
lowColorChooserButton.BackColor.G,
|
|
|
|
|
lowColorChooserButton.BackColor.B);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.saveLowColor(device, (byte)redBar.Value, lowColorChooserButton.BackColor.G, lowColorChooserButton.BackColor.B);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
|
|
|
|
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
|
|
|
|
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
|
|
|
|
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor +50)), full);
|
|
|
|
|
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
|
|
|
|
pBController.BackColor = colorChooserButton.BackColor;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
// Previous implementation
|
|
|
|
|
redValLabel.Text = redBar.Value.ToString();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
//redValLabel.Text = (colorChooserButton.BackColor.GetBrightness() * 255 * 2).ToString();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void greenBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// New settings
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
{
|
|
|
|
|
lowGreenValLabel.Text = greenBar.Value.ToString();
|
|
|
|
|
lowColorChooserButton.BackColor = Color.FromArgb(
|
|
|
|
|
lowColorChooserButton.BackColor.R,
|
|
|
|
|
greenBar.Value,
|
|
|
|
|
lowColorChooserButton.BackColor.B);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.saveLowColor(device, lowColorChooserButton.BackColor.R, (byte)greenBar.Value, lowColorChooserButton.BackColor.B);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
|
|
|
|
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
|
|
|
|
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
|
|
|
|
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
|
|
|
|
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
pBController.BackColor = colorChooserButton.BackColor;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
// Previous implementation
|
|
|
|
|
greenValLabel.Text = greenBar.Value.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void blueBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// New settings
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
{
|
|
|
|
|
lowBlueValLabel.Text = blueBar.Value.ToString();
|
|
|
|
|
lowColorChooserButton.BackColor = Color.FromArgb(
|
|
|
|
|
lowColorChooserButton.BackColor.R,
|
|
|
|
|
lowColorChooserButton.BackColor.G,
|
|
|
|
|
blueBar.Value);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
//if (realTimeChangesCheckBox.Checked)
|
|
|
|
|
Global.saveLowColor(device,
|
2014-03-28 02:50:40 +01:00
|
|
|
|
lowColorChooserButton.BackColor.R,
|
|
|
|
|
lowColorChooserButton.BackColor.G,
|
2014-04-27 21:32:09 +02:00
|
|
|
|
(byte)blueBar.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
|
|
|
|
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
|
|
|
|
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
|
|
|
|
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
|
|
|
|
//if (realTimeChangesCheckBox.Checked)
|
|
|
|
|
Global.saveColor(device, (byte)redBar.Value,
|
|
|
|
|
(byte)greenBar.Value,
|
|
|
|
|
(byte)blueBar.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
pBController.BackColor = colorChooserButton.BackColor;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
// Previous implementation
|
|
|
|
|
blueValLabel.Text = blueBar.Value.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public Color HuetoRGB(float hue, float sat)
|
|
|
|
|
{
|
|
|
|
|
int C = (int)(sat*255);
|
|
|
|
|
int X = (int)((sat * (float)(1 - Math.Abs((hue / 60) % 2 - 1)))*255);
|
|
|
|
|
if (sat == 0)
|
|
|
|
|
return Color.FromName("White");
|
|
|
|
|
else if (0 <= hue && hue < 60)
|
|
|
|
|
return Color.FromArgb(C, X, 0);
|
|
|
|
|
else if (60 <= hue && hue < 120)
|
|
|
|
|
return Color.FromArgb(X, C, 0);
|
|
|
|
|
else if (120 <= hue && hue < 180)
|
|
|
|
|
return Color.FromArgb(0, C, X);
|
|
|
|
|
else if (180 <= hue && hue < 240)
|
|
|
|
|
return Color.FromArgb(0, X, C);
|
|
|
|
|
else if (240 <= hue && hue < 300)
|
|
|
|
|
return Color.FromArgb(X, 0, C);
|
|
|
|
|
else if (300 <= hue && hue < 360)
|
|
|
|
|
return Color.FromArgb(C, 0, X);
|
|
|
|
|
else
|
|
|
|
|
return Color.FromName("Black");
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
private void rumbleBoostBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
rumbleBoostMotorValLabel.Text = rumbleBoostBar.Value.ToString();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value);
|
|
|
|
|
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
private void leftMotorBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
leftMotorValLabel.Text = leftMotorBar.Value.ToString();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rightMotorBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
rightMotorValLabel.Text = rightMotorBar.Value.ToString();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void numUDTouch_ValueChanged(object sender, EventArgs e)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setTouchSensitivity(device, (byte)numUDTouch.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void numUDTap_ValueChanged(object sender, EventArgs e)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setTapSensitivity(device, (byte)numUDTap.Value);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
if (numUDTap.Value == 0)
|
|
|
|
|
cBDoubleTap.Enabled = false;
|
|
|
|
|
else
|
|
|
|
|
cBDoubleTap.Enabled = true;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void numUDScroll_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lowBatteryLed_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
{
|
|
|
|
|
fullLedPanel.Enabled = false;
|
|
|
|
|
redBar.Value = int.Parse(lowRedValLabel.Text);
|
|
|
|
|
greenBar.Value = int.Parse(lowGreenValLabel.Text);
|
|
|
|
|
blueBar.Value = int.Parse(lowBlueValLabel.Text);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Global.saveLowColor(device,
|
|
|
|
|
lowColorChooserButton.BackColor.R,
|
|
|
|
|
lowColorChooserButton.BackColor.G,
|
|
|
|
|
lowColorChooserButton.BackColor.B);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fullLedPanel.Enabled = true;
|
|
|
|
|
redBar.Value = int.Parse(redValLabel.Text);
|
|
|
|
|
greenBar.Value = int.Parse(greenValLabel.Text);
|
|
|
|
|
blueBar.Value = int.Parse(blueValLabel.Text);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Global.saveColor(device,
|
|
|
|
|
colorChooserButton.BackColor.R,
|
|
|
|
|
colorChooserButton.BackColor.G,
|
|
|
|
|
colorChooserButton.BackColor.B);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ledAsBatteryIndicator_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setLedAsBatteryIndicator(device, batteryLed.Checked);
|
|
|
|
|
|
|
|
|
|
// New settings
|
|
|
|
|
if (batteryLed.Checked)
|
|
|
|
|
{
|
|
|
|
|
lowLedPanel.Visible = true;
|
|
|
|
|
lowLedCheckBox.Visible = true;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Global.setLedAsBatteryIndicator(device, true);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
else
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
lowLedPanel.Visible = false;
|
|
|
|
|
lowLedCheckBox.Visible = false;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Global.setLedAsBatteryIndicator(device, false);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void flashWhenLowBattery_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setFlashWhenLowBattery(device, flashLed.Checked);
|
|
|
|
|
}
|
|
|
|
|
private void lowerRCOffCheckBox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setLowerRCOn(device, cBlowerRCOn.Checked);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void touchpadJitterCompensation_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
private void pictureBox_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
lowColorChooserButton_Click(sender, e);
|
|
|
|
|
else colorChooserButton_Click(sender, e);
|
|
|
|
|
}
|
|
|
|
|
private void colorChooserButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
advColorDialog.Color = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
advColorDialog_OnUpdateColor(colorChooserButton.BackColor, e);
|
|
|
|
|
if (advColorDialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
redValLabel.Text = advColorDialog.Color.R.ToString();
|
|
|
|
|
greenValLabel.Text = advColorDialog.Color.G.ToString();
|
|
|
|
|
blueValLabel.Text = advColorDialog.Color.B.ToString();
|
|
|
|
|
colorChooserButton.BackColor = advColorDialog.Color;
|
|
|
|
|
if (!lowLedCheckBox.Checked)
|
|
|
|
|
{
|
|
|
|
|
redBar.Value = advColorDialog.Color.R;
|
|
|
|
|
greenBar.Value = advColorDialog.Color.G;
|
|
|
|
|
blueBar.Value = advColorDialog.Color.B;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
|
|
|
|
Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
|
|
|
|
oldLedColor = null;
|
|
|
|
|
oldLowLedColor = null;
|
|
|
|
|
}
|
|
|
|
|
private void lowColorChooserButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
advColorDialog.Color = lowColorChooserButton.BackColor;
|
|
|
|
|
advColorDialog_OnUpdateColor(lowColorChooserButton.BackColor, e);
|
|
|
|
|
if (advColorDialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
lowRedValLabel.Text = advColorDialog.Color.R.ToString();
|
|
|
|
|
lowGreenValLabel.Text = advColorDialog.Color.G.ToString();
|
|
|
|
|
lowBlueValLabel.Text = advColorDialog.Color.B.ToString();
|
|
|
|
|
lowColorChooserButton.BackColor = advColorDialog.Color;
|
|
|
|
|
if (lowLedCheckBox.Checked)
|
|
|
|
|
{
|
|
|
|
|
redBar.Value = advColorDialog.Color.R;
|
|
|
|
|
greenBar.Value = advColorDialog.Color.G;
|
|
|
|
|
blueBar.Value = advColorDialog.Color.B;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
|
|
|
|
Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
|
|
|
|
oldLedColor = null;
|
|
|
|
|
oldLowLedColor = null;
|
|
|
|
|
}
|
|
|
|
|
private void advColorDialog_OnUpdateColor(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (oldLedColor == null || oldLowLedColor == null)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = Global.loadColor(device);
|
|
|
|
|
oldLedColor = new Byte[] { color.red, color.green, color.blue };
|
|
|
|
|
color = Global.loadLowColor(device);
|
|
|
|
|
oldLowLedColor = new Byte[] { color.red, color.green, color.blue };
|
|
|
|
|
}
|
|
|
|
|
if (sender is Color)
|
|
|
|
|
{
|
|
|
|
|
Color color = (Color)sender;
|
|
|
|
|
Global.saveColor(device, color.R, color.G, color.B);
|
|
|
|
|
Global.saveLowColor(device, color.R, color.G, color.B);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void flushHIDQueue_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setFlushHIDQueue(device, flushHIDQueue.Checked);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void idleDisconnectTimeout_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (idleDisconnectTimeout.Value <= 29 && idleDisconnectTimeout.Value > 15)
|
|
|
|
|
{
|
|
|
|
|
idleDisconnectTimeout.Value = 0;
|
|
|
|
|
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
|
|
|
|
}
|
|
|
|
|
else if (idleDisconnectTimeout.Value > 0 && idleDisconnectTimeout.Value <= 15)
|
|
|
|
|
{
|
|
|
|
|
idleDisconnectTimeout.Value = 30;
|
|
|
|
|
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void rumbleSwap_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setRumbleSwap(device, rumbleSwap.Checked);
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void Options_Closed(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.LoadProfile(device);
|
|
|
|
|
mainWin.RefreshProfiles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tBProfile_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
tBProfile.ForeColor = System.Drawing.SystemColors.WindowText;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tBProfile_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tBProfile.Text == "<type profile name here>")
|
|
|
|
|
tBProfile.Text = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tBProfile_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tBProfile.Text == "")
|
|
|
|
|
tBProfile.Text = "<type profile name here>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cBSlide.Checked)
|
|
|
|
|
numUDTouch.Value = 100;
|
|
|
|
|
else
|
|
|
|
|
numUDTouch.Value = 0;
|
|
|
|
|
numUDTouch.Enabled = cBSlide.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cBScroll_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cBScroll.Checked)
|
|
|
|
|
numUDScroll.Value = 5;
|
|
|
|
|
else
|
|
|
|
|
numUDScroll.Value = 0;
|
|
|
|
|
numUDScroll.Enabled = cBScroll.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cBTap_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cBTap.Checked)
|
|
|
|
|
numUDTap.Value = 100;
|
|
|
|
|
else
|
|
|
|
|
numUDTap.Value = 0;
|
|
|
|
|
numUDTap.Enabled = cBTap.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 03:14:01 +02:00
|
|
|
|
private void cBDoubleTap_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setDoubleTap(device, cBDoubleTap.Checked);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
private void tbProfile_EnterDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyValue == 13)
|
|
|
|
|
saveButton_Click(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lBControls_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateLists()
|
|
|
|
|
{
|
|
|
|
|
lBControls.Items[0] = "Cross : " + bnCross.Text;
|
|
|
|
|
lBControls.Items[1] = "Circle : " + bnCircle.Text;
|
|
|
|
|
lBControls.Items[2] = "Sqaure : " + bnSquare.Text;
|
|
|
|
|
lBControls.Items[3] = "Triangle : " + bnTriangle.Text;
|
|
|
|
|
lBControls.Items[4] = "Options : " + bnOptions.Text;
|
|
|
|
|
lBControls.Items[5] = "Share : " + bnShare.Text;
|
|
|
|
|
lBControls.Items[6] = "Up : " + bnUp.Text;
|
|
|
|
|
lBControls.Items[7] = "Down : " + bnDown.Text;
|
|
|
|
|
lBControls.Items[8] = "Left : " + bnLeft.Text;
|
|
|
|
|
lBControls.Items[9] = "Right : " + bnRight.Text;
|
|
|
|
|
lBControls.Items[10] = "PS : " + bnPS.Text;
|
|
|
|
|
lBControls.Items[11] = "L1 : " + bnL1.Text;
|
|
|
|
|
lBControls.Items[12] = "R1 : " + bnR1.Text;
|
|
|
|
|
lBControls.Items[13] = "L2 : " + bnL2.Text;
|
|
|
|
|
lBControls.Items[14] = "R2 : " + bnR2.Text;
|
|
|
|
|
lBControls.Items[15] = "L3 : " + bnL3.Text;
|
|
|
|
|
lBControls.Items[16] = "R3 : " + bnR3.Text;
|
|
|
|
|
lBControls.Items[17] = "Left Stick : " + bnLSUp.Text + ", " + bnLSDown.Text + ", " + bnLSLeft.Text + ", " + bnLSRight.Text;
|
|
|
|
|
lBControls.Items[18] = "Right Stick : " + bnRSUp.Text + ", " + bnRSDown.Text + ", " + bnRSLeft.Text + ", " + bnRSRight.Text;
|
|
|
|
|
lBControls.Items[19] = "Touchpad : " + bnTouchLeft.Text + ", " + bnTouchUpper.Text + ", " + bnTouchMulti.Text + ", " + bnTouchRight.Text;
|
|
|
|
|
lBAnalogSticks.Items[0] = lBControls.Items[15];
|
|
|
|
|
lBAnalogSticks.Items[1] = lBControls.Items[16];
|
|
|
|
|
lBAnalogSticks.Items[2] = "LS Up : " + bnLSUp.Text;
|
|
|
|
|
lBAnalogSticks.Items[3] = "LS Down : " + bnLSDown.Text;
|
|
|
|
|
lBAnalogSticks.Items[4] = "LS Left :" + bnLSLeft.Text;
|
|
|
|
|
lBAnalogSticks.Items[5] = "LS Right : " + bnLSRight.Text;
|
|
|
|
|
lBAnalogSticks.Items[6] = "RS Up : " + bnRSUp.Text;
|
|
|
|
|
lBAnalogSticks.Items[7] = "RS Down : " + bnRSDown.Text;
|
|
|
|
|
lBAnalogSticks.Items[8] = "RS Left : " + bnRSLeft.Text;
|
|
|
|
|
lBAnalogSticks.Items[9] = "RS Right : " + bnRSRight.Text;
|
|
|
|
|
lBTouchControls.Items[0] = "Left Side : " + bnTouchLeft.Text;
|
|
|
|
|
lBTouchControls.Items[1] = "Upperpad : " + bnTouchUpper.Text;
|
|
|
|
|
lBTouchControls.Items[2] = "Multitouch : " + bnTouchMulti.Text;
|
|
|
|
|
lBTouchControls.Items[3] = "Right Side : " + bnTouchRight.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Show_ControlsList(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tabOptions.SelectedTab == tabControls)
|
|
|
|
|
{
|
|
|
|
|
if (lBControls.SelectedIndex == 0) Show_ControlsBn(bnCross, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 1) Show_ControlsBn(bnCircle, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 2) Show_ControlsBn(bnSquare, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 3) Show_ControlsBn(bnTriangle, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 4) Show_ControlsBn(bnOptions, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 5) Show_ControlsBn(bnShare, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 6) Show_ControlsBn(bnUp, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 7) Show_ControlsBn(bnDown, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 8) Show_ControlsBn(bnLeft, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 9) Show_ControlsBn(bnRight, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 10) Show_ControlsBn(bnPS, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 11) Show_ControlsBn(bnL1, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 12) Show_ControlsBn(bnR1, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 13) Show_ControlsBn(bnL2, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 14) Show_ControlsBn(bnR2, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 15) Show_ControlsBn(bnL3, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 16) Show_ControlsBn(bnR3, e);
|
|
|
|
|
if (lBControls.SelectedIndex == 17) tabOptions.SelectTab(1);
|
|
|
|
|
if (lBControls.SelectedIndex == 18) tabOptions.SelectTab(1);
|
|
|
|
|
if (lBControls.SelectedIndex == 19) tabOptions.SelectTab(2);
|
|
|
|
|
}
|
|
|
|
|
else if (tabOptions.SelectedTab == tabAnalogSticks)
|
|
|
|
|
{
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 0) Show_ControlsBn(bnL3, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 1) Show_ControlsBn(bnR3, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 2) Show_ControlsBn(bnLSUp, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 3) Show_ControlsBn(bnLSDown, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 4) Show_ControlsBn(bnLSLeft, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 5) Show_ControlsBn(bnLSRight, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 6) Show_ControlsBn(bnRSUp, e);
|
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 7) Show_ControlsBn(bnRSDown, e);
|
2014-04-28 06:08:49 +02:00
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 8) Show_ControlsBn(bnRSLeft, e);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (lBAnalogSticks.SelectedIndex == 9) Show_ControlsBn(bnRSRight, e);
|
|
|
|
|
}
|
|
|
|
|
else if (tabOptions.SelectedTab == tabTouchPad)
|
|
|
|
|
{
|
|
|
|
|
if (lBTouchControls.SelectedIndex == 0) Show_ControlsBn(bnTouchLeft, e);
|
|
|
|
|
if (lBTouchControls.SelectedIndex == 1) Show_ControlsBn(bnTouchUpper, e);
|
|
|
|
|
if (lBTouchControls.SelectedIndex == 2) Show_ControlsBn(bnTouchMulti, e);
|
|
|
|
|
if (lBTouchControls.SelectedIndex == 3) Show_ControlsBn(bnTouchRight, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void List_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Show_ControlsList(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void List_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyValue == 13)
|
|
|
|
|
Show_ControlsList(sender, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|