From e80e3d987044db8b56acf73095496446d88129dc Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 18 Aug 2020 21:32:03 +0200 Subject: [PATCH] Add support for game validation --- GCMM/MainForm.Designer.cs | 21 +++++++++++++++++++-- GCMM/MainForm.cs | 12 ++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/GCMM/MainForm.Designer.cs b/GCMM/MainForm.Designer.cs index bec7965..47308bd 100644 --- a/GCMM/MainForm.Designer.cs +++ b/GCMM/MainForm.Designer.cs @@ -50,6 +50,7 @@ this.unpatched = new System.Windows.Forms.CheckBox(); this.modinfobox = new System.Windows.Forms.RichTextBox(); this.refreshbtn = new System.Windows.Forms.Button(); + this.validatebtn = new System.Windows.Forms.Button(); this.SuspendLayout(); // // modlist @@ -226,21 +227,36 @@ this.refreshbtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; this.refreshbtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(40)))), ((int)(((byte)(0))))); this.refreshbtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.refreshbtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.refreshbtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.refreshbtn.Location = new System.Drawing.Point(12, 12); this.refreshbtn.Name = "refreshbtn"; - this.refreshbtn.Size = new System.Drawing.Size(81, 29); + this.refreshbtn.Size = new System.Drawing.Size(105, 29); this.refreshbtn.TabIndex = 10; this.refreshbtn.Text = "Refresh"; this.refreshbtn.UseVisualStyleBackColor = true; this.refreshbtn.Click += new System.EventHandler(this.refreshbtn_Click); // + // validatebtn + // + this.validatebtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.validatebtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(40)))), ((int)(((byte)(0))))); + this.validatebtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.validatebtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.validatebtn.Location = new System.Drawing.Point(398, 12); + this.validatebtn.Name = "validatebtn"; + this.validatebtn.Size = new System.Drawing.Size(105, 29); + this.validatebtn.TabIndex = 11; + this.validatebtn.Text = "Validate game"; + this.validatebtn.UseVisualStyleBackColor = true; + this.validatebtn.Click += new System.EventHandler(this.validatebtn_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(784, 561); + this.Controls.Add(this.validatebtn); this.Controls.Add(this.refreshbtn); this.Controls.Add(this.modinfobox); this.Controls.Add(this.unpatched); @@ -277,6 +293,7 @@ private System.Windows.Forms.CheckBox unpatched; private System.Windows.Forms.RichTextBox modinfobox; private System.Windows.Forms.Button refreshbtn; + private System.Windows.Forms.Button validatebtn; } } diff --git a/GCMM/MainForm.cs b/GCMM/MainForm.cs index 1576908..77d5c31 100644 --- a/GCMM/MainForm.cs +++ b/GCMM/MainForm.cs @@ -241,5 +241,17 @@ You may also want to verify the game's files by right clicking the game in Steam GetAvailableMods(); CheckUninstalledMods(mods); } + + private void validatebtn_Click(object sender, EventArgs e) + { + if (CheckNoExe()) + return; + if (MessageBox.Show("Validating the game's files is useful if the game doesn't start even without mods. Make sure to click Refresh once Steam finished verifying the game. The Steam window that shows the progress might open in the background. Note that you will need to patch the game again using the Play button in order to use mods.\n\nContinue?", "Verify game files", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + return; + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + Process.Start("steam://validate/1078000/"); + else + Process.Start("xdg-open", "steam://validate/1078000/"); + } } }