From 72fccace3305808ea2b1f065b691622e157ca375 Mon Sep 17 00:00:00 2001 From: Marco Calautti Date: Sat, 12 Jan 2019 12:00:15 +0000 Subject: [PATCH 1/2] Add option from starting the application minimized to tray. Alsso added proper nuget dependency for ViGEmClient. --- .gitignore | 3 +- BetterJoyForCemu/BetterJoyForCemu.csproj | 25 +++++-- BetterJoyForCemu/Config.cs | 5 +- BetterJoyForCemu/MainForm.Designer.cs | 91 ++++++++++++++---------- BetterJoyForCemu/MainForm.cs | 45 +++++++++--- BetterJoyForCemu/packages.config | 3 + 6 files changed, 114 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index 3c4efe2..6bd3a88 100644 --- a/.gitignore +++ b/.gitignore @@ -258,4 +258,5 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc +/BetterJoyForCemu/FodyWeavers.xml diff --git a/BetterJoyForCemu/BetterJoyForCemu.csproj b/BetterJoyForCemu/BetterJoyForCemu.csproj index c72cfc6..d1aa73d 100644 --- a/BetterJoyForCemu/BetterJoyForCemu.csproj +++ b/BetterJoyForCemu/BetterJoyForCemu.csproj @@ -11,6 +11,8 @@ v4.6.1 512 true + + AnyCPU @@ -79,9 +81,16 @@ Icons\betterjoyforcemu_icon.ico + + ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll + False + ..\packages\Crc32.NET.1.2.0\lib\net20\Crc32.NET.dll + + ..\packages\Nefarius.ViGEmClient.1.15.16\lib\net452\Nefarius.ViGEmClient.dll + @@ -120,6 +129,7 @@ + Always @@ -131,12 +141,6 @@ - - - {aa18ebcf-7e9d-4bc5-8760-e8c6e9a773e5} - ViGEmClient - - MainForm.cs @@ -147,4 +151,13 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/BetterJoyForCemu/Config.cs b/BetterJoyForCemu/Config.cs index 6892a8b..7bb13af 100644 --- a/BetterJoyForCemu/Config.cs +++ b/BetterJoyForCemu/Config.cs @@ -12,7 +12,8 @@ namespace BetterJoyForCemu { public static void Init() { variables["ProgressiveScan"] = true; - + variables["StartInTray"] = false; + if (File.Exists(PATH)) { using (StreamReader file = new StreamReader(PATH)) { string line = String.Empty; @@ -32,7 +33,7 @@ namespace BetterJoyForCemu { } public static bool Value(string key) { - if (!variables.ContainsKey("ProgressiveScan")) { + if (!variables.ContainsKey("ProgressiveScan") && !variables.ContainsKey("StartInTray")) { return false; } return variables[key]; diff --git a/BetterJoyForCemu/MainForm.Designer.cs b/BetterJoyForCemu/MainForm.Designer.cs index 46213cf..99871d8 100644 --- a/BetterJoyForCemu/MainForm.Designer.cs +++ b/BetterJoyForCemu/MainForm.Designer.cs @@ -34,15 +34,16 @@ this.passiveScanBox = new System.Windows.Forms.CheckBox(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.conCntrls = new System.Windows.Forms.GroupBox(); + this.loc4 = new System.Windows.Forms.Button(); + this.loc3 = new System.Windows.Forms.Button(); + this.loc2 = new System.Windows.Forms.Button(); + this.loc1 = new System.Windows.Forms.Button(); this.con4 = new System.Windows.Forms.Button(); this.con3 = new System.Windows.Forms.Button(); this.con2 = new System.Windows.Forms.Button(); this.con1 = new System.Windows.Forms.Button(); - this.loc1 = new System.Windows.Forms.Button(); - this.loc2 = new System.Windows.Forms.Button(); - this.loc3 = new System.Windows.Forms.Button(); - this.loc4 = new System.Windows.Forms.Button(); this.btnTip = new System.Windows.Forms.ToolTip(this.components); + this.startInTrayBox = new System.Windows.Forms.CheckBox(); this.contextMenu.SuspendLayout(); this.conCntrls.SuspendLayout(); this.SuspendLayout(); @@ -141,6 +142,42 @@ this.conCntrls.TabStop = false; this.conCntrls.Text = "Connected Controllers"; // + // loc4 + // + this.loc4.Location = new System.Drawing.Point(198, 80); + this.loc4.Name = "loc4"; + this.loc4.Size = new System.Drawing.Size(58, 20); + this.loc4.TabIndex = 7; + this.loc4.Text = "Locate"; + this.loc4.UseVisualStyleBackColor = true; + // + // loc3 + // + this.loc3.Location = new System.Drawing.Point(134, 80); + this.loc3.Name = "loc3"; + this.loc3.Size = new System.Drawing.Size(58, 20); + this.loc3.TabIndex = 6; + this.loc3.Text = "Locate"; + this.loc3.UseVisualStyleBackColor = true; + // + // loc2 + // + this.loc2.Location = new System.Drawing.Point(70, 80); + this.loc2.Name = "loc2"; + this.loc2.Size = new System.Drawing.Size(58, 20); + this.loc2.TabIndex = 5; + this.loc2.Text = "Locate"; + this.loc2.UseVisualStyleBackColor = true; + // + // loc1 + // + this.loc1.Location = new System.Drawing.Point(6, 80); + this.loc1.Name = "loc1"; + this.loc1.Size = new System.Drawing.Size(58, 20); + this.loc1.TabIndex = 4; + this.loc1.Text = "Locate"; + this.loc1.UseVisualStyleBackColor = true; + // // con4 // this.con4.BackgroundImage = global::BetterJoyForCemu.Properties.Resources.cross; @@ -190,47 +227,24 @@ this.btnTip.SetToolTip(this.con1, "Click on Joycons to join/split them"); this.con1.UseVisualStyleBackColor = true; // - // loc1 + // startInTrayBox // - this.loc1.Location = new System.Drawing.Point(6, 80); - this.loc1.Name = "loc1"; - this.loc1.Size = new System.Drawing.Size(58, 20); - this.loc1.TabIndex = 4; - this.loc1.Text = "Locate"; - this.loc1.UseVisualStyleBackColor = true; - // - // loc2 - // - this.loc2.Location = new System.Drawing.Point(70, 80); - this.loc2.Name = "loc2"; - this.loc2.Size = new System.Drawing.Size(58, 20); - this.loc2.TabIndex = 5; - this.loc2.Text = "Locate"; - this.loc2.UseVisualStyleBackColor = true; - // - // loc3 - // - this.loc3.Location = new System.Drawing.Point(134, 80); - this.loc3.Name = "loc3"; - this.loc3.Size = new System.Drawing.Size(58, 20); - this.loc3.TabIndex = 6; - this.loc3.Text = "Locate"; - this.loc3.UseVisualStyleBackColor = true; - // - // loc4 - // - this.loc4.Location = new System.Drawing.Point(198, 80); - this.loc4.Name = "loc4"; - this.loc4.Size = new System.Drawing.Size(58, 20); - this.loc4.TabIndex = 7; - this.loc4.Text = "Locate"; - this.loc4.UseVisualStyleBackColor = true; + this.startInTrayBox.AutoSize = true; + this.startInTrayBox.Location = new System.Drawing.Point(107, 238); + this.startInTrayBox.Name = "startInTrayBox"; + this.startInTrayBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.startInTrayBox.Size = new System.Drawing.Size(83, 17); + this.startInTrayBox.TabIndex = 6; + this.startInTrayBox.Text = "Start in Tray"; + this.startInTrayBox.UseVisualStyleBackColor = true; + this.startInTrayBox.CheckedChanged += new System.EventHandler(this.startInTrayBox_CheckedChanged); // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 261); + this.Controls.Add(this.startInTrayBox); this.Controls.Add(this.conCntrls); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.passiveScanBox); @@ -272,5 +286,6 @@ private System.Windows.Forms.Button loc2; private System.Windows.Forms.Button loc1; private System.Windows.Forms.ToolTip btnTip; + private System.Windows.Forms.CheckBox startInTrayBox; } } \ No newline at end of file diff --git a/BetterJoyForCemu/MainForm.cs b/BetterJoyForCemu/MainForm.cs index e6df817..1c5785d 100644 --- a/BetterJoyForCemu/MainForm.cs +++ b/BetterJoyForCemu/MainForm.cs @@ -21,32 +21,50 @@ namespace BetterJoyForCemu { con = new List