From ae381fc986209fe35d605431fca5ae1e028b7e94 Mon Sep 17 00:00:00 2001 From: pjgat09 Date: Mon, 21 Jul 2014 23:46:29 +0000 Subject: [PATCH] N64: Jabo readiness is now detected and displayed in the plugin config dialog. --- .../N64/N64VideoPluginconfig.Designer.cs | 69 +++++++++++----- .../config/N64/N64VideoPluginconfig.cs | 81 +++++++++++++++++++ .../config/N64/N64VideoPluginconfig.resx | 3 - 3 files changed, 128 insertions(+), 25 deletions(-) diff --git a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.Designer.cs b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.Designer.cs index 8761813407..9a22987112 100644 --- a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.Designer.cs @@ -32,6 +32,7 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(N64VideoPluginconfig)); this.N64plugintabcontrol = new System.Windows.Forms.TabControl(); this.N64vpluginglobaltab = new System.Windows.Forms.TabPage(); + this.jaboStatusLabel = new System.Windows.Forms.Label(); this.label49 = new System.Windows.Forms.Label(); this.RspTypeDropdown = new System.Windows.Forms.ComboBox(); this.label48 = new System.Windows.Forms.Label(); @@ -271,11 +272,12 @@ this.label58 = new System.Windows.Forms.Label(); this.Glide64mk2_filtering = new System.Windows.Forms.ComboBox(); this.Glide64mk2_UseDefaultHacks2 = new System.Windows.Forms.CheckBox(); + this.JaboTab = new System.Windows.Forms.TabPage(); + this.JaboPropertyGrid = new System.Windows.Forms.PropertyGrid(); this.SaveButton = new System.Windows.Forms.Button(); this.CancelBT = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.JaboTab = new System.Windows.Forms.TabPage(); - this.JaboPropertyGrid = new System.Windows.Forms.PropertyGrid(); + this.jaboStatusDetailLabel = new System.Windows.Forms.Label(); this.N64plugintabcontrol.SuspendLayout(); this.N64vpluginglobaltab.SuspendLayout(); this.RiceTabPage.SuspendLayout(); @@ -317,6 +319,8 @@ // // N64vpluginglobaltab // + this.N64vpluginglobaltab.Controls.Add(this.jaboStatusDetailLabel); + this.N64vpluginglobaltab.Controls.Add(this.jaboStatusLabel); this.N64vpluginglobaltab.Controls.Add(this.label49); this.N64vpluginglobaltab.Controls.Add(this.RspTypeDropdown); this.N64vpluginglobaltab.Controls.Add(this.label48); @@ -334,6 +338,15 @@ this.N64vpluginglobaltab.Text = "Global"; this.N64vpluginglobaltab.UseVisualStyleBackColor = true; // + // jaboStatusLabel + // + this.jaboStatusLabel.AutoSize = true; + this.jaboStatusLabel.Location = new System.Drawing.Point(10, 137); + this.jaboStatusLabel.Name = "jaboStatusLabel"; + this.jaboStatusLabel.Size = new System.Drawing.Size(63, 13); + this.jaboStatusLabel.TabIndex = 19; + this.jaboStatusLabel.Text = "Jabo Status"; + // // label49 // this.label49.AutoSize = true; @@ -390,7 +403,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(10, 164); + this.label2.Location = new System.Drawing.Point(10, 201); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 13); this.label2.TabIndex = 13; @@ -414,7 +427,7 @@ "1600 x 1200", "1920 x 1440", "2048 x 1536"}); - this.VideoResolutionComboBox.Location = new System.Drawing.Point(13, 180); + this.VideoResolutionComboBox.Location = new System.Drawing.Point(13, 217); this.VideoResolutionComboBox.Name = "VideoResolutionComboBox"; this.VideoResolutionComboBox.Size = new System.Drawing.Size(136, 21); this.VideoResolutionComboBox.TabIndex = 10; @@ -432,6 +445,7 @@ this.PluginComboBox.Name = "PluginComboBox"; this.PluginComboBox.Size = new System.Drawing.Size(173, 21); this.PluginComboBox.TabIndex = 5; + this.PluginComboBox.SelectedIndexChanged += new System.EventHandler(this.PluginComboBox_SelectedIndexChanged); // // label1 // @@ -3212,6 +3226,26 @@ this.Glide64mk2_UseDefaultHacks2.UseVisualStyleBackColor = true; this.Glide64mk2_UseDefaultHacks2.CheckedChanged += new System.EventHandler(this.Glide64mk2_UseDefaultHacks2_CheckedChanged); // + // JaboTab + // + this.JaboTab.Controls.Add(this.JaboPropertyGrid); + this.JaboTab.Location = new System.Drawing.Point(4, 22); + this.JaboTab.Name = "JaboTab"; + this.JaboTab.Size = new System.Drawing.Size(572, 343); + this.JaboTab.TabIndex = 7; + this.JaboTab.Text = "Jabo"; + this.JaboTab.UseVisualStyleBackColor = true; + // + // JaboPropertyGrid + // + this.JaboPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.JaboPropertyGrid.Location = new System.Drawing.Point(0, 0); + this.JaboPropertyGrid.Name = "JaboPropertyGrid"; + this.JaboPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort; + this.JaboPropertyGrid.Size = new System.Drawing.Size(572, 343); + this.JaboPropertyGrid.TabIndex = 4; + this.JaboPropertyGrid.ToolbarVisible = false; + // // SaveButton // this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -3243,25 +3277,14 @@ this.toolTip1.ReshowDelay = 100; this.toolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; // - // JaboTab + // jaboStatusDetailLabel // - this.JaboTab.Controls.Add(this.JaboPropertyGrid); - this.JaboTab.Location = new System.Drawing.Point(4, 22); - this.JaboTab.Name = "JaboTab"; - this.JaboTab.Size = new System.Drawing.Size(572, 343); - this.JaboTab.TabIndex = 7; - this.JaboTab.Text = "Jabo"; - this.JaboTab.UseVisualStyleBackColor = true; - // - // JaboPropertyGrid - // - this.JaboPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; - this.JaboPropertyGrid.Location = new System.Drawing.Point(0, 0); - this.JaboPropertyGrid.Name = "JaboPropertyGrid"; - this.JaboPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort; - this.JaboPropertyGrid.Size = new System.Drawing.Size(572, 343); - this.JaboPropertyGrid.TabIndex = 4; - this.JaboPropertyGrid.ToolbarVisible = false; + this.jaboStatusDetailLabel.AutoSize = true; + this.jaboStatusDetailLabel.Location = new System.Drawing.Point(10, 160); + this.jaboStatusDetailLabel.Name = "jaboStatusDetailLabel"; + this.jaboStatusDetailLabel.Size = new System.Drawing.Size(91, 13); + this.jaboStatusDetailLabel.TabIndex = 20; + this.jaboStatusDetailLabel.Text = "Jabo Status detail"; // // N64VideoPluginconfig // @@ -3564,5 +3587,7 @@ private System.Windows.Forms.ComboBox RspTypeDropdown; private System.Windows.Forms.TabPage JaboTab; private System.Windows.Forms.PropertyGrid JaboPropertyGrid; + private System.Windows.Forms.Label jaboStatusLabel; + private System.Windows.Forms.Label jaboStatusDetailLabel; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs index 27733117b8..3db5638b83 100644 --- a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs +++ b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs @@ -9,6 +9,8 @@ using BizHawk.Common.ReflectionExtensions; using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Client.Common; using BizHawk.Client.EmuHawk.ControlExtensions; +using System.IO; +using System.Security.Cryptography; namespace BizHawk.Client.EmuHawk { @@ -17,6 +19,17 @@ namespace BizHawk.Client.EmuHawk N64Settings s; N64SyncSettings ss; + enum JaboStatus + { + NotReady, + ReadyToPatch, + Ready, + WrongVersion21, + WrongVersion16 + }; + + JaboStatus currentJaboStatus = JaboStatus.NotReady; + public N64VideoPluginconfig() { InitializeComponent(); @@ -340,6 +353,41 @@ namespace BizHawk.Client.EmuHawk PluginComboBox.Items.Remove("Jabo 1.6.1"); } + if (File.Exists("dll\\Jabo_Direct3D8_patched.dll")) + { + byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes("dll\\Jabo_Direct3D8_patched.dll")); + string hash_string = BitConverter.ToString(hash).Replace("-", ""); + if (hash_string == "F4D6E624489CD88C68A5850426D4D70E") + { + // jabo is ready to go + currentJaboStatus = JaboStatus.Ready; + } + } + else if (File.Exists("dll\\Jabo_Direct3D8.dll")) + { + byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes("dll\\Jabo_Direct3D8.dll")); + string hash_string = BitConverter.ToString(hash).Replace("-", ""); + if (hash_string == "4F353AA71E7455B81205D8EC0AA339E1") + { + // jabo will be patched when a rom is loaded. user is ready to go + currentJaboStatus = JaboStatus.ReadyToPatch; + } + else if (hash_string == "4A4173928ED33735157A8D8CD14D4C9C") + { + // wrong jabo installed (2.0) + currentJaboStatus = JaboStatus.WrongVersion21; + } + else if (hash_string == "FF57F60C58EDE6364B980EDCB311873B") + { + // wrong jabo installed (1.6) + currentJaboStatus = JaboStatus.WrongVersion16; + } + else + { + // this is not the right file + } + } + s = GetSettings(); ss = GetSyncSettings(); @@ -869,5 +917,38 @@ namespace BizHawk.Client.EmuHawk UpdateGlide64mk2HacksSection(); } + private void PluginComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (PluginComboBox.Text == "Jabo 1.6.1") + { + if (currentJaboStatus == JaboStatus.Ready || currentJaboStatus == JaboStatus.ReadyToPatch) + { + jaboStatusLabel.Text = "You are ready to use Jabo."; + jaboStatusDetailLabel.Text = ""; + } + else + { + jaboStatusDetailLabel.Text = "To use Jabo please copy Jabo_Direct3D8.dll from a Project64 v1.6.1 installation into Bizhawk's dll directory."; + if (currentJaboStatus == JaboStatus.NotReady) + { + jaboStatusLabel.Text = "You are NOT ready to use Jabo."; + } + else if (currentJaboStatus == JaboStatus.WrongVersion16) + { + jaboStatusLabel.Text = "You are NOT ready to use Jabo. Bizhawk requires Jabo Direct3D8 v1.6.1, but found v1.6 instead."; + } + else if (currentJaboStatus == JaboStatus.WrongVersion21) + { + jaboStatusLabel.Text = "You are NOT ready to use Jabo. Bizhawk requires Jabo Direct3D8 v1.6.1, but found v2.0 instead."; + } + } + } + else + { + jaboStatusLabel.Text = ""; + jaboStatusDetailLabel.Text = ""; + } + } + } } diff --git a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.resx b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.resx index f1e278dae9..af1cb484f3 100644 --- a/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.resx +++ b/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - Enable/Disable Anisotropic Filtering for Mipmapping (0=no filtering, 2-16=quality). This is uneffective if Mipmapping is 0.