From 67bf8b061c4137c184dc1484e76e7377e802c95a Mon Sep 17 00:00:00 2001 From: jays2kings Date: Mon, 19 May 2014 01:55:12 -0400 Subject: [PATCH] =?UTF-8?q?You=20can=20now=20press=20a=20button/axis/touch?= =?UTF-8?q?pad=20in=20options=20to=20change=20that=20control=20when=20in?= =?UTF-8?q?=20options.=20The=20icon=20in=20the=20notification=20area=20als?= =?UTF-8?q?o=20shows=20not=20only=20when=20minimized,=20but=20when=20the?= =?UTF-8?q?=20main=20window=20unfocused.=20Fixed=20bug=20where=20when=20th?= =?UTF-8?q?e=20tool=20is=20shrunken=20down,=20the=20last=20message=20of=20?= =?UTF-8?q?log=20didn=E2=80=99t=20show.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DS4Control/Control.cs | 54 +++++++++---- DS4Service/DS4Service.cs | 2 +- DS4Tool/KBM360.cs | 4 +- DS4Tool/Options.Designer.cs | 19 ++--- DS4Tool/Options.cs | 57 ++++++++++--- DS4Tool/ScpForm.Designer.cs | 52 ++++++------ DS4Tool/ScpForm.cs | 155 +++++++++++++++++++----------------- 7 files changed, 206 insertions(+), 137 deletions(-) diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index 6268312..cfdb35c 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -10,7 +10,7 @@ namespace DS4Control public class Control { X360Device x360Bus; - DS4Device[] DS4Controllers = new DS4Device[4]; + public DS4Device[] DS4Controllers = new DS4Device[4]; //TPadModeSwitcher[] modeSwitcher = new TPadModeSwitcher[4]; Mouse[] touchPad = new Mouse[4]; private bool running = false; @@ -85,7 +85,7 @@ namespace DS4Control string[] profileA = Global.getAProfile(ind).Split('\\'); string filename = profileA[profileA.Length - 1]; ind++; - if (System.IO.File.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename)) + if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename)) { LogDebug("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); Log.LogToTray("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); @@ -168,18 +168,14 @@ namespace DS4Control device.Removal -= DS4Devices.On_Removal; device.Removal += this.On_DS4Removal; device.Removal += DS4Devices.On_Removal; - //TPadModeSwitcher m_switcher = new TPadModeSwitcher(device, Index); - //m_switcher.Debug += OnDebug; - //modeSwitcher[Index] = m_switcher; touchPad[Index] = new Mouse(Index, device); device.LightBarColor = Global.loadColor(Index); device.Report += this.On_Report; x360Bus.Plugin(Index); - //m_switcher.setMode(Global.getInitialMode(Index)); TouchPadOn(Index, device); string[] profileA = Global.getAProfile(Index).Split('\\'); string filename = profileA[profileA.Length - 1]; - if (System.IO.File.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename)) + if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename)) { LogDebug("Controller " + (Index+1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); Log.LogToTray("Controller " + (Index + 1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); @@ -304,15 +300,8 @@ namespace DS4Control DS4State pState = PreviousState[ind]; if (pState.Battery != cState.Battery) Global.ControllerStatusChanged(this); - - //bool wasButtonMouse = modeSwitcher[ind].getCurrentMode() is ButtonMouse; CheckForHotkeys(ind, cState, pState); - //if (wasButtonMouse && modeSwitcher[ind].getCurrentMode() is ButtonMouse) - { - //ButtonMouse mode = (ButtonMouse)modeSwitcher[ind].getCurrentMode(); - // XXX so disgusting, need to virtualize this again - // mode.getDS4State().CopyTo(cState); - } + GetInputkeys(ind); if (Global.getHasCustomKeysorButtons(ind)) { @@ -344,6 +333,41 @@ namespace DS4Control } } + public string GetInputkeys(int ind) + { + DS4State cState = CurrentState[ind]; + if (Mapping.getBoolMapping(DS4Controls.Cross, cState)) return "Cross"; + else if (Mapping.getBoolMapping(DS4Controls.Circle, cState)) return "Circle"; + else if (Mapping.getBoolMapping(DS4Controls.Triangle, cState)) return "Triangle"; + else if (Mapping.getBoolMapping(DS4Controls.Square, cState)) return "Square"; + else if (Mapping.getBoolMapping(DS4Controls.L1, cState)) return "L1"; + else if (Mapping.getBoolMapping(DS4Controls.R1, cState)) return "R1"; + else if (Mapping.getBoolMapping(DS4Controls.L2, cState)) return "L2"; + else if (Mapping.getBoolMapping(DS4Controls.R2, cState)) return "R2"; + else if (Mapping.getBoolMapping(DS4Controls.L3, cState)) return "L3"; + else if (Mapping.getBoolMapping(DS4Controls.R3, cState)) return "R3"; + else if (Mapping.getBoolMapping(DS4Controls.DpadUp, cState)) return "Up"; + else if (Mapping.getBoolMapping(DS4Controls.DpadDown, cState)) return "Down"; + else if (Mapping.getBoolMapping(DS4Controls.DpadLeft, cState)) return "Left"; + else if (Mapping.getBoolMapping(DS4Controls.DpadRight, cState)) return "Right"; + else if (Mapping.getBoolMapping(DS4Controls.Share, cState)) return "Share"; + else if (Mapping.getBoolMapping(DS4Controls.Options, cState)) return "Options"; + else if (Mapping.getBoolMapping(DS4Controls.PS, cState)) return "PS"; + else if (Mapping.getBoolMapping(DS4Controls.LXPos, cState)) return "LS Right"; + else if (Mapping.getBoolMapping(DS4Controls.LXNeg, cState)) return "LS Left"; + else if (Mapping.getBoolMapping(DS4Controls.LYPos, cState)) return "LS Down"; + else if (Mapping.getBoolMapping(DS4Controls.LYNeg, cState)) return "LS Up"; + else if (Mapping.getBoolMapping(DS4Controls.RXPos, cState)) return "RS Right"; + else if (Mapping.getBoolMapping(DS4Controls.RXNeg, cState)) return "RS Left"; + else if (Mapping.getBoolMapping(DS4Controls.RYPos, cState)) return "RS Down"; + else if (Mapping.getBoolMapping(DS4Controls.RYNeg, cState)) return "RS Up"; + else if (Mapping.getBoolMapping(DS4Controls.TouchLeft, cState)) return "Touch Left"; + else if (Mapping.getBoolMapping(DS4Controls.TouchRight, cState)) return "Touch Right"; + else if (Mapping.getBoolMapping(DS4Controls.TouchMulti, cState)) return "Touch Multi"; + else if (Mapping.getBoolMapping(DS4Controls.TouchUpper, cState)) return "Touch Upper"; + else return "nothing"; + } + bool touchreleased = true; byte oldtouchvalue = 0; protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState) diff --git a/DS4Service/DS4Service.cs b/DS4Service/DS4Service.cs index f85a9bb..db24dde 100644 --- a/DS4Service/DS4Service.cs +++ b/DS4Service/DS4Service.cs @@ -11,7 +11,7 @@ namespace DS4Service { private Control rootHub; StreamWriter logWriter; - string logFile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\DS4Service.log"; + string logFile = Global.appdatapath + @"\DS4Service.log"; public DS4Service() { InitializeComponent(); diff --git a/DS4Tool/KBM360.cs b/DS4Tool/KBM360.cs index eb23dce..cf7db8b 100644 --- a/DS4Tool/KBM360.cs +++ b/DS4Tool/KBM360.cs @@ -62,7 +62,7 @@ namespace ScpServer else keyname = ((Button)sender).Text; object keytag; - if (((Button)sender).Tag == "X360") + if (((Button)sender).Tag.ToString() == "X360") keytag = ((Button)sender).Text; else keytag = ((Button)sender).Tag; @@ -75,7 +75,7 @@ namespace ScpServer { ops.Toggle_Repeat(cbRepeat.Checked); ops.Toggle_ScanCode(cbScanCode.Checked); - ops.UpdateLists(); + ops.UpdateLists(); } private void Key_Down_Action(object sender, KeyEventArgs e) diff --git a/DS4Tool/Options.Designer.cs b/DS4Tool/Options.Designer.cs index d604ead..4502f34 100644 --- a/DS4Tool/Options.Designer.cs +++ b/DS4Tool/Options.Designer.cs @@ -133,8 +133,8 @@ this.lBProfileTip = new System.Windows.Forms.Label(); this.tBProfile = new System.Windows.Forms.TextBox(); this.btnSaveProfile = new System.Windows.Forms.Button(); - this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.lBSeperator = new System.Windows.Forms.Label(); + this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.MainPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); this.SticksPanel.SuspendLayout(); @@ -1531,11 +1531,12 @@ // // tBMouseSens // + this.tBMouseSens.AutoSize = false; this.tBMouseSens.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244))))); this.tBMouseSens.Location = new System.Drawing.Point(151, 215); this.tBMouseSens.Maximum = 117; this.tBMouseSens.Name = "tBMouseSens"; - this.tBMouseSens.Size = new System.Drawing.Size(131, 45); + this.tBMouseSens.Size = new System.Drawing.Size(131, 26); this.tBMouseSens.TabIndex = 204; this.tBMouseSens.TickStyle = System.Windows.Forms.TickStyle.None; this.tBMouseSens.Value = 50; @@ -1720,12 +1721,6 @@ this.btnSaveProfile.UseVisualStyleBackColor = true; this.btnSaveProfile.Click += new System.EventHandler(this.saveButton_Click); // - // advColorDialog - // - this.advColorDialog.AnyColor = true; - this.advColorDialog.Color = System.Drawing.Color.Blue; - this.advColorDialog.FullOpen = true; - // // lBSeperator // this.lBSeperator.AutoSize = true; @@ -1737,6 +1732,12 @@ this.lBSeperator.TabIndex = 240; this.lBSeperator.Text = "_______________________________________________________________________"; // + // advColorDialog + // + this.advColorDialog.AnyColor = true; + this.advColorDialog.Color = System.Drawing.Color.Blue; + this.advColorDialog.FullOpen = true; + // // Options // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1878,7 +1879,6 @@ private System.Windows.Forms.Button bnLSDown; private System.Windows.Forms.Button bnR3; private System.Windows.Forms.Button btnFullView; - private System.Windows.Forms.Label lBControlTip; public System.Windows.Forms.ListBox lBControls; private System.Windows.Forms.NumericUpDown numUDRainbow; private System.Windows.Forms.PictureBox pBRainbow; @@ -1946,6 +1946,7 @@ private System.Windows.Forms.TextBox tBProfile; private System.Windows.Forms.Button btnSaveProfile; private System.Windows.Forms.Label lBSeperator; + private System.Windows.Forms.Label lBControlTip; } }  \ No newline at end of file diff --git a/DS4Tool/Options.cs b/DS4Tool/Options.cs index 66d0867..ba35f5b 100644 --- a/DS4Tool/Options.cs +++ b/DS4Tool/Options.cs @@ -14,7 +14,7 @@ namespace ScpServer private int device; private string filename; Byte[] oldLedColor, oldLowLedColor; - Timer sixaxisTimer = new Timer(); + Timer inputtimer = new Timer(), sixaxisTimer = new Timer(); private List