Update action string aliases in the GUI

This commit is contained in:
Travis Nickles 2019-04-18 22:56:18 -05:00
parent 1b58265c28
commit 0b345b8474
6 changed files with 4247 additions and 977 deletions

View File

@ -242,6 +242,9 @@ namespace DS4Windows
public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true };
public static bool[] linkedProfileCheck = new bool[4] { true, true, true, true };
public static bool[] touchpadActive = new bool[5] { true, true, true, true, true };
public static OutContType[] outDevTypeTemp = new OutContType[5] { DS4Windows.OutContType.None, DS4Windows.OutContType.None,
DS4Windows.OutContType.None, DS4Windows.OutContType.None,
DS4Windows.OutContType.None };
public static X360Controls[] defaultButtonMapping = { X360Controls.None, X360Controls.LXNeg, X360Controls.LXPos,
X360Controls.LYNeg, X360Controls.LYPos, X360Controls.RXNeg, X360Controls.RXPos, X360Controls.RYNeg, X360Controls.RYPos,

View File

@ -213,6 +213,9 @@
this.cBShiftButton = new System.Windows.Forms.ComboBox();
this.pnl360Controls = new System.Windows.Forms.Panel();
this.lb360Tip = new System.Windows.Forms.Label();
this.pnlDS4Controls = new System.Windows.Forms.Panel();
this.buttonTmp = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.advColorDialog = new DS4Windows.AdvancedColorDialog();
((System.ComponentModel.ISupportInitialize)(this.pBHighlight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pBMouse)).BeginInit();
@ -225,6 +228,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDMouse)).BeginInit();
this.gBExtras.SuspendLayout();
this.pnl360Controls.SuspendLayout();
this.pnlDS4Controls.SuspendLayout();
this.SuspendLayout();
//
// pBHighlight
@ -1899,6 +1903,26 @@
this.lb360Tip.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.lb360Tip.Name = "lb360Tip";
//
// pnlDS4Controls
//
this.pnlDS4Controls.BackgroundImage = global::DS4Windows.Properties.Resources.DS4_Config;
resources.ApplyResources(this.pnlDS4Controls, "pnlDS4Controls");
this.pnlDS4Controls.Controls.Add(this.buttonTmp);
this.pnlDS4Controls.Controls.Add(this.label1);
this.pnlDS4Controls.Name = "pnlDS4Controls";
//
// buttonTmp
//
this.buttonTmp.BackColor = System.Drawing.Color.Transparent;
resources.ApplyResources(this.buttonTmp, "buttonTmp");
this.buttonTmp.Name = "buttonTmp";
this.buttonTmp.UseVisualStyleBackColor = false;
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// advColorDialog
//
this.advColorDialog.AnyColor = true;
@ -1910,6 +1934,8 @@
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.pnlDS4Controls);
this.Controls.Add(this.pnl360Controls);
this.Controls.Add(this.cBShiftButton);
this.Controls.Add(this.rBShiftModifer);
this.Controls.Add(this.rBRegular);
@ -2043,7 +2069,6 @@
this.Controls.Add(this.btnCAPS);
this.Controls.Add(this.btnNUM0);
this.Controls.Add(this.pBMouse);
this.Controls.Add(this.pnl360Controls);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.KeyPreview = true;
this.MaximizeBox = false;
@ -2064,6 +2089,8 @@
this.gBExtras.PerformLayout();
this.pnl360Controls.ResumeLayout(false);
this.pnl360Controls.PerformLayout();
this.pnlDS4Controls.ResumeLayout(false);
this.pnlDS4Controls.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -2256,5 +2283,8 @@
private System.Windows.Forms.ComboBox cBShiftButton;
private System.Windows.Forms.Panel pnl360Controls;
private System.Windows.Forms.Label lb360Tip;
private System.Windows.Forms.Panel pnlDS4Controls;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button buttonTmp;
}
}

View File

@ -7,6 +7,9 @@ namespace DS4Windows
{
public partial class KBM360 : Form
{
private bool use360 = true;
private Dictionary<string, string> ds4StrAliases =
new Dictionary<string, string>();
private int device;
private Button button;
private Options ops;
@ -24,13 +27,25 @@ namespace DS4Windows
int bgc = 240; // Color of the form background, If greyscale color
private bool extraChanged;
private Bitmap pnl360BgImage;
private Bitmap pnlDS4BgImage;
public KBM360(int deviceNum, Options ooo, Button buton)
{
InitializeComponent();
pnl360BgImage = (Bitmap)Properties.Resources._360_map.Clone();
pnl360Controls.BackgroundImage = null;
pnl360Controls.BackgroundImageLayout = ImageLayout.None;
//pnl360Controls.BackgroundImage = null;
//pnl360Controls.BackgroundImageLayout = ImageLayout.None;
use360 = true;
pnl360Controls.Paint -= pnl360Controls_Paint;
if (Global.outDevTypeTemp[device] == OutContType.DS4)
{
use360 = false;
InitDS4Panel();
PopulateDS4StrAliases();
pnl360Controls.Hide();
pnlDS4Controls.Show();
}
device = deviceNum;
ops = ooo;
button = buton;
@ -56,10 +71,22 @@ namespace DS4Windows
((Button)control).Click += anybtn_Click;
}
foreach (Control control in pnl360Controls.Controls)
if (use360)
{
if (control is Button)
((Button)control).Click += anybtn_Click;
pnl360Controls.Paint -= pnl360Controls_Paint;
foreach (Control control in pnl360Controls.Controls)
{
if (control is Button)
((Button)control).Click += anybtn_Click;
}
}
else
{
foreach (Control control in pnlDS4Controls.Controls)
{
if (control is Button)
((Button)control).Click += anybtn_Click;
}
}
if (button.Name.Contains("Touch") || button.Name.Contains("Swipe"))
@ -122,6 +149,174 @@ namespace DS4Windows
btnGuide.Text = "";
}
private void InitDS4Panel()
{
pnlDS4BgImage = (Bitmap)Properties.Resources.DS4_Config.Clone();
pnl360Controls.Controls.Remove(this.btnAButton);
this.btnAButton.Location = new Point(461, 145);
this.btnAButton.Size = new Size(23, 23);
pnlDS4Controls.Controls.Add(this.btnAButton);
pnl360Controls.Controls.Remove(this.btnBButton);
this.btnBButton.Location = new Point(494, 116);
this.btnBButton.Size = new Size(23, 23);
pnlDS4Controls.Controls.Add(this.btnBButton);
pnl360Controls.Controls.Remove(this.btnXButton);
this.btnXButton.Location = new Point(429, 116);
this.btnXButton.Size = new Size(23, 23);
pnlDS4Controls.Controls.Add(this.btnXButton);
pnl360Controls.Controls.Remove(this.btnYButton);
this.btnYButton.Location = new Point(460, 86);
this.btnYButton.Size = new Size(23, 23);
pnlDS4Controls.Controls.Add(this.btnYButton);
pnl360Controls.Controls.Remove(this.btnGuide);
this.btnGuide.Location = new Point(322, 160);
this.btnGuide.Size = new Size(23, 20);
pnlDS4Controls.Controls.Add(this.btnGuide);
pnl360Controls.Controls.Remove(this.btnLB);
this.btnLB.Location = new Point(164, 26);
this.btnLB.Size = new Size(66, 17);
pnlDS4Controls.Controls.Add(this.btnLB);
pnl360Controls.Controls.Remove(this.btnRB);
this.btnRB.Location = new Point(442, 26);
this.btnRB.Size = new Size(66, 17);
pnlDS4Controls.Controls.Add(this.btnRB);
pnl360Controls.Controls.Remove(this.btnLT);
this.btnLT.Location = new Point(178, 3);
this.btnLT.Size = new Size(43, 23);
pnlDS4Controls.Controls.Add(this.btnLT);
pnl360Controls.Controls.Remove(this.btnRT);
this.btnRT.Location = new Point(447, 3);
this.btnRT.Size = new Size(43, 23);
pnlDS4Controls.Controls.Add(this.btnRT);
pnl360Controls.Controls.Remove(this.btnBack);
this.btnBack.Location = new Point(238, 74);
this.btnBack.Size = new Size(16, 23);
pnlDS4Controls.Controls.Add(this.btnBack);
pnl360Controls.Controls.Remove(this.btnStart);
this.btnStart.Location = new Point(415, 74);
this.btnStart.Size = new Size(16, 23);
pnlDS4Controls.Controls.Add(this.btnStart);
pnl360Controls.Controls.Remove(this.btnDpadUp);
this.btnDpadUp.Location = new Point(190, 96);
this.btnDpadUp.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnDpadUp);
pnl360Controls.Controls.Remove(this.btnDpadRight);
this.btnDpadRight.Location = new Point(207, 116);
this.btnDpadRight.Size = new Size(24, 23);
pnlDS4Controls.Controls.Add(this.btnDpadRight);
pnl360Controls.Controls.Remove(this.btnDpadDown);
this.btnDpadDown.Location = new Point(184, 131);
this.btnDpadDown.Size = new Size(24, 30);
pnlDS4Controls.Controls.Add(this.btnDpadDown);
pnl360Controls.Controls.Remove(this.btnDpadLeft);
this.btnDpadLeft.Location = new Point(165, 118);
this.btnDpadLeft.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnDpadLeft);
pnl360Controls.Controls.Remove(this.btnLSUp);
this.btnLSUp.Location = new Point(256, 167);
this.btnLSUp.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnLSUp);
pnl360Controls.Controls.Remove(this.btnLSRight);
this.btnLSRight.Location = new Point(275, 179);
this.btnLSRight.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnLSRight);
pnl360Controls.Controls.Remove(this.btnLSDown);
this.btnLSDown.Location = new Point(258, 194);
this.btnLSDown.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnLSDown);
pnl360Controls.Controls.Remove(this.btnLSLeft);
this.btnLSLeft.Location = new Point(241, 181);
this.btnLSLeft.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnLSLeft);
pnl360Controls.Controls.Remove(this.btnRSUp);
this.btnRSUp.Location = new Point(398, 166);
this.btnRSUp.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnRSUp);
pnl360Controls.Controls.Remove(this.btnRSRight);
this.btnRSRight.Location = new Point(412, 179);
this.btnRSRight.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnRSRight);
pnl360Controls.Controls.Remove(this.btnRSDown);
this.btnRSDown.Location = new Point(397, 195);
this.btnRSDown.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnRSDown);
pnl360Controls.Controls.Remove(this.btnRSLeft);
this.btnRSLeft.Location = new Point(380, 182);
this.btnRSLeft.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnRSLeft);
pnl360Controls.Controls.Remove(this.btnLSClick);
this.btnLSClick.Location = new Point(256, 181);
this.btnLSClick.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnLSClick);
pnl360Controls.Controls.Remove(this.btnRSClick);
this.btnRSClick.Location = new Point(397, 181);
this.btnRSClick.Size = new Size(16, 18);
pnlDS4Controls.Controls.Add(this.btnRSClick);
pnl360Controls.Controls.Remove(this.lb360Tip);
pnlDS4Controls.Controls.Add(this.lb360Tip);
pnl360Controls.Controls.Remove(this.pBHighlight);
pnlDS4Controls.Controls.Add(this.pBHighlight);
//this.pnlDS4Controls.Paint += new PaintEventHandler(this.pnlDS4Controls_Paint);
}
private void PopulateDS4StrAliases()
{
ds4StrAliases["A Button"] = "Cross";
ds4StrAliases["B Button"] = "Circle";
ds4StrAliases["X Button"] = "Square";
ds4StrAliases["Y Button"] = "Triangle";
ds4StrAliases["Left Bumper"] = "L1";
ds4StrAliases["Right Bumper"] = "R1";
ds4StrAliases["Left Trigger"] = "L2";
ds4StrAliases["Right Trigger"] = "R2";
ds4StrAliases["Back"] = "Share";
ds4StrAliases["Start"] = "Options";
ds4StrAliases["Guide"] = "PS";
ds4StrAliases["Left Stick"] = "L3";
ds4StrAliases["Right Stick"] = "R3";
ds4StrAliases["Up Button"] = "Dpad Up";
ds4StrAliases["Right Button"] = "Dpad Right";
ds4StrAliases["Down Button"] = "Dpad Down";
ds4StrAliases["Left Button"] = "Dpad Left";
ds4StrAliases["Left X-Axis-"] = "LS Left";
ds4StrAliases["Left X-Axis+"] = "LS Right";
ds4StrAliases["Left Y-Axis-"] = "LS Up";
ds4StrAliases["Left Y-Axis+"] = "LS Down";
ds4StrAliases["Right X-Axis-"] = "RS Left";
ds4StrAliases["Right X-Axis+"] = "RS Right";
ds4StrAliases["Right Y-Axis-"] = "RS Up";
ds4StrAliases["Right Y-Axis+"] = "RS Down";
}
public void anybtn_Click(object sender, EventArgs e)
{
if (rb == null && sender is Button && ((Button)sender).Name != "bnMacro" && ((Button)sender).Name != "bnTest")
@ -267,7 +462,7 @@ namespace DS4Windows
bool toggleavil = tagisint;
KeyValuePair<object, string> tag;
if (tt is X360Controls)
tag = new KeyValuePair<object, string>(getX360ControlsByName((X360Controls)tt), extras);
tag = new KeyValuePair<object, string>(getX360ControlsByName((X360Controls)tt, Global.outDevTypeTemp[device]), extras);
else
tag = new KeyValuePair<object, string>(tt, extras);
ops.ChangeButtonText(button, rBShiftModifer.Checked, tag, (scanavail ? cBScanCode.Checked : false), (toggleavil ? cBToggle.Checked : false), lBMacroOn.Visible, macrorepeat, cBShiftButton.SelectedIndex);
@ -479,23 +674,25 @@ namespace DS4Windows
Point l = c.Location;
pBHighlight.Location = new Point(l.X + s.Width / 2 - s2.Width / 2, l.Y + s.Height / 2 - s2.Height / 2);
Point l2 = pBHighlight.Location;
lb360Tip.Text = X360ControlName(c.Name.Substring(3));
lb360Tip.Text = X360ControlName(c.Tag.ToString().Substring(4));
lb360Tip.Location = new Point(l2.X + s2.Width / 2 - lb360Tip.Width / 2, l2.Y - 20);
lb360Tip.BringToFront();
pBHighlight.BringToFront();
}
private string X360ControlName(string v)
{
string s = v;
for (int i = s.Length - 1; i > (s.StartsWith("L") || s.StartsWith("R") ? 1 : 0); i--)
string result = string.Empty;
if (use360)
{
if (s[i] >= 'A' && s[i] <= 'Z')
s = s.Insert(i, " ");
result = v;
}
else
{
ds4StrAliases.TryGetValue(v, out result);
}
if (s == "Guide")
s = guideText;
return s;
return result;
}
private void Highlight_Leave(object sender, EventArgs e)
@ -566,7 +763,7 @@ namespace DS4Windows
{
string tag;
if (tagO is X360Controls)
tag = getX360ControlsByName((X360Controls)tagO);
tag = getX360ControlsByName((X360Controls)tagO, Global.outDevTypeTemp[device]);
else
tag = tagO.ToString();
@ -603,7 +800,7 @@ namespace DS4Windows
tagO = ops.defaults[button.Name];
string tag;
if (tagO is X360Controls)
tag = getX360ControlsByName((X360Controls)tagO);
tag = getX360ControlsByName((X360Controls)tagO, Global.outDevTypeTemp[device]);
else
tag = tagO.ToString();
@ -699,52 +896,104 @@ namespace DS4Windows
extraChanged = false;
}
public static string getX360ControlsByName(X360Controls key)
public static string getX360ControlsByName(X360Controls key,
OutContType contType=OutContType.X360)
{
switch (key)
if (contType == OutContType.X360 || contType== OutContType.None)
{
case X360Controls.Back: return "Back";
case X360Controls.LS: return "Left Stick";
case X360Controls.RS: return "Right Stick";
case X360Controls.Start: return "Start";
case X360Controls.DpadUp: return "Up Button";
case X360Controls.DpadRight: return "Right Button";
case X360Controls.DpadDown: return "Down Button";
case X360Controls.DpadLeft: return "Left Button";
switch (key)
{
case X360Controls.Back: return "Back";
case X360Controls.LS: return "Left Stick";
case X360Controls.RS: return "Right Stick";
case X360Controls.Start: return "Start";
case X360Controls.DpadUp: return "Up Button";
case X360Controls.DpadRight: return "Right Button";
case X360Controls.DpadDown: return "Down Button";
case X360Controls.DpadLeft: return "Left Button";
case X360Controls.LB: return "Left Bumper";
case X360Controls.RB: return "Right Bumper";
case X360Controls.Y: return "Y Button";
case X360Controls.B: return "B Button";
case X360Controls.A: return "A Button";
case X360Controls.X: return "X Button";
case X360Controls.LB: return "Left Bumper";
case X360Controls.RB: return "Right Bumper";
case X360Controls.Y: return "Y Button";
case X360Controls.B: return "B Button";
case X360Controls.A: return "A Button";
case X360Controls.X: return "X Button";
case X360Controls.Guide: return "Guide";
case X360Controls.LXNeg: return "Left X-Axis-";
case X360Controls.LYNeg: return "Left Y-Axis-";
case X360Controls.RXNeg: return "Right X-Axis-";
case X360Controls.RYNeg: return "Right Y-Axis-";
case X360Controls.Guide: return "Guide";
case X360Controls.LXNeg: return "Left X-Axis-";
case X360Controls.LYNeg: return "Left Y-Axis-";
case X360Controls.RXNeg: return "Right X-Axis-";
case X360Controls.RYNeg: return "Right Y-Axis-";
case X360Controls.LXPos: return "Left X-Axis+";
case X360Controls.LYPos: return "Left Y-Axis+";
case X360Controls.RXPos: return "Right X-Axis+";
case X360Controls.RYPos: return "Right Y-Axis+";
case X360Controls.LT: return "Left Trigger";
case X360Controls.RT: return "Right Trigger";
case X360Controls.LXPos: return "Left X-Axis+";
case X360Controls.LYPos: return "Left Y-Axis+";
case X360Controls.RXPos: return "Right X-Axis+";
case X360Controls.RYPos: return "Right Y-Axis+";
case X360Controls.LT: return "Left Trigger";
case X360Controls.RT: return "Right Trigger";
case X360Controls.LeftMouse: return "Left Mouse Button";
case X360Controls.RightMouse: return "Right Mouse Button";
case X360Controls.MiddleMouse: return "Middle Mouse Button";
case X360Controls.FourthMouse: return "4th Mouse Button";
case X360Controls.FifthMouse: return "5th Mouse Button";
case X360Controls.WUP: return "Mouse Wheel Up";
case X360Controls.WDOWN: return "Mouse Wheel Down";
case X360Controls.MouseUp: return "Mouse Up";
case X360Controls.MouseDown: return "Mouse Down";
case X360Controls.MouseLeft: return "Mouse Left";
case X360Controls.MouseRight: return "Mouse Right";
case X360Controls.Unbound: return "Unbound";
default: break;
case X360Controls.LeftMouse: return "Left Mouse Button";
case X360Controls.RightMouse: return "Right Mouse Button";
case X360Controls.MiddleMouse: return "Middle Mouse Button";
case X360Controls.FourthMouse: return "4th Mouse Button";
case X360Controls.FifthMouse: return "5th Mouse Button";
case X360Controls.WUP: return "Mouse Wheel Up";
case X360Controls.WDOWN: return "Mouse Wheel Down";
case X360Controls.MouseUp: return "Mouse Up";
case X360Controls.MouseDown: return "Mouse Down";
case X360Controls.MouseLeft: return "Mouse Left";
case X360Controls.MouseRight: return "Mouse Right";
case X360Controls.Unbound: return "Unbound";
default: break;
}
}
else
{
switch (key)
{
case X360Controls.Back: return "Share";
case X360Controls.LS: return "L3";
case X360Controls.RS: return "R3";
case X360Controls.Start: return "Options";
case X360Controls.DpadUp: return "Dpad Up";
case X360Controls.DpadRight: return "Dpad Right";
case X360Controls.DpadDown: return "Dpad Down";
case X360Controls.DpadLeft: return "Dpad Left";
case X360Controls.LB: return "L1";
case X360Controls.RB: return "R1";
case X360Controls.Y: return "Triangle";
case X360Controls.B: return "Circle";
case X360Controls.A: return "Cross";
case X360Controls.X: return "Square";
case X360Controls.Guide: return "PS";
case X360Controls.LXNeg: return "Left X-Axis-";
case X360Controls.LYNeg: return "Left Y-Axis-";
case X360Controls.RXNeg: return "Right X-Axis-";
case X360Controls.RYNeg: return "Right Y-Axis-";
case X360Controls.LXPos: return "Left X-Axis+";
case X360Controls.LYPos: return "Left Y-Axis+";
case X360Controls.RXPos: return "Right X-Axis+";
case X360Controls.RYPos: return "Right Y-Axis+";
case X360Controls.LT: return "L2";
case X360Controls.RT: return "R2";
case X360Controls.LeftMouse: return "Left Mouse Button";
case X360Controls.RightMouse: return "Right Mouse Button";
case X360Controls.MiddleMouse: return "Middle Mouse Button";
case X360Controls.FourthMouse: return "4th Mouse Button";
case X360Controls.FifthMouse: return "5th Mouse Button";
case X360Controls.WUP: return "Mouse Wheel Up";
case X360Controls.WDOWN: return "Mouse Wheel Down";
case X360Controls.MouseUp: return "Mouse Up";
case X360Controls.MouseDown: return "Mouse Down";
case X360Controls.MouseLeft: return "Mouse Left";
case X360Controls.MouseRight: return "Mouse Right";
case X360Controls.Unbound: return "Unbound";
default: break;
}
}
return "Unbound";
@ -788,7 +1037,17 @@ namespace DS4Windows
private void pnl360Controls_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(pnl360BgImage, new Rectangle(0, 13, Convert.ToInt32(pnl360Controls.Width), Convert.ToInt32(pnl360Controls.Height - 26)), new Rectangle(0, 0, Convert.ToInt32(pnl360BgImage.Width), Convert.ToInt32(pnl360BgImage.Height)), GraphicsUnit.Pixel);
//e.Graphics.DrawImage(pnl360BgImage, new Rectangle(0, 13, Convert.ToInt32(pnl360Controls.Width), Convert.ToInt32(pnl360Controls.Height - 26)), new Rectangle(0, 0, Convert.ToInt32(pnl360BgImage.Width), Convert.ToInt32(pnl360BgImage.Height)), GraphicsUnit.Pixel);
}
private void pnlDS4Controls_Paint(object sender, PaintEventArgs e)
{
/*e.Graphics.DrawImage(pnlDS4BgImage,
new Rectangle(0, 13, Convert.ToInt32(pnlDS4Controls.Width),
Convert.ToInt32(pnlDS4Controls.Height - 26)),
new Rectangle(0, 0, Convert.ToInt32(pnlDS4Controls.Width),
Convert.ToInt32(pnlDS4Controls.Height)), GraphicsUnit.Pixel);
*/
}
private void nUD_ValueChanged(object sender, EventArgs e)

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,9 @@ namespace DS4Windows
bool olddinputcheck = false;
private float dpix;
private float dpiy;
public Dictionary<string, string> defaults = new Dictionary<string, string>();
public Dictionary<string, string> defaults = null;
private Dictionary<string, string> xboxDefaults = new Dictionary<string, string>();
private Dictionary<string, string> ds4Defaults = new Dictionary<string, string>();
public bool saving, loading;
public bool actionTabSeen = false;
public static Size mSize { get; private set; }
@ -86,10 +88,14 @@ namespace DS4Windows
foreach (Button b in buttons)
{
defaults.Add(b.Name, b.Text);
//Console.WriteLine("{0} -> {1}", b.Name, b.Text);
xboxDefaults.Add(b.Name, b.Text);
b.Text = "";
}
defaults = xboxDefaults;
PopulateDS4Defaults();
foreach (Control control in Controls)
{
if (control.HasChildren)
@ -140,6 +146,8 @@ namespace DS4Windows
btnLightbar.BackgroundImage = null;
btnLightbar.BackgroundImageLayout = ImageLayout.None;
OutContTypeCb.SelectedIndexChanged += OutContTypeCb_SelectedIndexChanged;
populateHoverIndexDict();
populateHoverImageDict();
populateHoverLabelDict();
@ -271,6 +279,47 @@ namespace DS4Windows
hoverLabelDict[bnRSRight] = lbLRS;
}
public void PopulateDS4Defaults()
{
ds4Defaults["bnSwipeUp"] = "Swipe Up";
ds4Defaults["bnSwipeDown"] = "Swipe Down";
ds4Defaults["bnSwipeLeft"] = "Swipe Left";
ds4Defaults["bnSwipeRight"] = "Swipe Right";
ds4Defaults["bnGyroZN"] = "";
ds4Defaults["bnGyroZP"] = "";
ds4Defaults["bnGyroXP"] = "";
ds4Defaults["bnGyroXN"] = "";
ds4Defaults["bnRSDown"] = "Right Y - Axis +";
ds4Defaults["bnL3"] = "L3";
ds4Defaults["bnRSUp"] = "Right Y - Axis -";
ds4Defaults["bnRSRight"] = "Right X - Axis +";
ds4Defaults["bnR3"] = "Right Stick";
ds4Defaults["bnRSLeft"] = "Right X - Axis -";
ds4Defaults["bnLSLeft"] = "Left X - Axis -";
ds4Defaults["bnLSUp"] = "Left Y - Axis -";
ds4Defaults["bnLSRight"] = "Left X - Axis +";
ds4Defaults["bnLSDown"] = "Left Y - Axis +";
ds4Defaults["bnR2"] = "R2";
ds4Defaults["bnUp"] = "Dpad Up";
ds4Defaults["bnDown"] = "Dpad Down";
ds4Defaults["bnTriangle"] = "Triangle";
ds4Defaults["bnR1"] = "R1";
ds4Defaults["bnSquare"] = "Square";
ds4Defaults["bnRight"] = "Dpad Right";
ds4Defaults["bnLeft"] = "Dpad Left";
ds4Defaults["bnOptions"] = "Options";
ds4Defaults["bnShare"] = "Share";
ds4Defaults["bnL1"] = "L1";
ds4Defaults["bnTouchRight"] = "Left Mouse Button";
ds4Defaults["bnL2"] = "L2";
ds4Defaults["bnTouchLeft"] = "Left Mouse Button";
ds4Defaults["bnTouchMulti"] = "Right Mouse Button";
ds4Defaults["bnTouchUpper"] = "Middle Mouse Button";
ds4Defaults["bnPS"] = "PS";
ds4Defaults["bnCross"] = "Cross";
ds4Defaults["bnCircle"] = "Circle";
}
public void Reload(int deviceNum, string name)
{
loading = true;
@ -308,7 +357,8 @@ namespace DS4Windows
LoadProfile(device, false, Program.rootHub);
devOutContType = Global.OutContType[device];
//devOutContType = Global.OutContType[device];
Global.outDevTypeTemp[device] = Global.OutContType[device];
if (Rainbow[device] == 0)
{
@ -733,13 +783,19 @@ namespace DS4Windows
if (idxSASteeringWheelEmulationRange >= 0) cBSteeringWheelEmulationRange.SelectedIndex = idxSASteeringWheelEmulationRange;
OutContType tempOutType = Global.OutContType[device];
devOutContType = tempOutType;
switch(tempOutType)
{
case OutContType.X360: OutContTypeCb.SelectedIndex = 0; break;
case OutContType.DS4: OutContTypeCb.SelectedIndex = 1; break;
case OutContType.X360:
OutContTypeCb.SelectedIndex = 0;
defaults = xboxDefaults;
break;
case OutContType.DS4:
OutContTypeCb.SelectedIndex = 1;
defaults = ds4Defaults;
break;
default: break;
}
}
else
{
@ -1357,7 +1413,7 @@ namespace DS4Windows
default: break;
}
if (devOutContType != tempType)
if (Global.outDevTypeTemp[device] != tempType)
{
Global.OutContType[device] = tempType;
}
@ -1794,7 +1850,7 @@ namespace DS4Windows
else if (tagO is X360Controls)
{
string tag;
tag = KBM360.getX360ControlsByName((X360Controls)tagO);
tag = KBM360.getX360ControlsByName((X360Controls)tagO, devOutContType);
return tag;
}
else if (tagO is string)
@ -3093,6 +3149,30 @@ namespace DS4Windows
}
}
private void OutContTypeCb_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
int tempOutCont = OutContTypeCb.SelectedIndex;
OutContType tempType = OutContType.X360;
switch (tempOutCont)
{
case 0:
tempType = OutContType.X360;
defaults = xboxDefaults;
break;
case 1:
tempType = OutContType.DS4;
defaults = ds4Defaults;
break;
default: break;
}
devOutContType = tempType;
UpdateLists();
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)

File diff suppressed because it is too large Load Diff