From cbd292366dc225a98c2d5c307e19d6910a5e52fd Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 12 Jun 2011 19:31:06 +0000 Subject: [PATCH] NES virtual pad hooked up (behaves as graphical autohold) --- .../NEStools/NESGraphicsConfig.Designer.cs | 26 ++++++++-------- .../NEStools/NESGraphicsConfig.cs | 2 ++ BizHawk.MultiClient/tools/VirtualPadNES.cs | 30 +++++++++++++++++++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs index b0deafb673..361d807dca 100644 --- a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs @@ -39,6 +39,7 @@ this.groupBox2 = new System.Windows.Forms.GroupBox(); this.ClipLeftAndRightCheckBox = new System.Windows.Forms.CheckBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.checkUseBackdropColor = new System.Windows.Forms.CheckBox(); this.ChangeBGColor = new System.Windows.Forms.Button(); this.BackGroundColorNumber = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); @@ -47,7 +48,6 @@ this.DispBackground = new System.Windows.Forms.CheckBox(); this.DispSprites = new System.Windows.Forms.CheckBox(); this.BGColorDialog = new System.Windows.Forms.ColorDialog(); - this.checkUseBackdropColor = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -183,6 +183,18 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "BG and Sprites"; // + // checkUseBackdropColor + // + this.checkUseBackdropColor.AutoSize = true; + this.checkUseBackdropColor.Checked = true; + this.checkUseBackdropColor.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkUseBackdropColor.Location = new System.Drawing.Point(170, 100); + this.checkUseBackdropColor.Name = "checkUseBackdropColor"; + this.checkUseBackdropColor.Size = new System.Drawing.Size(59, 17); + this.checkUseBackdropColor.TabIndex = 36; + this.checkUseBackdropColor.Text = "Enable"; + this.checkUseBackdropColor.UseVisualStyleBackColor = true; + // // ChangeBGColor // this.ChangeBGColor.Location = new System.Drawing.Point(112, 98); @@ -251,18 +263,6 @@ this.DispSprites.Text = "Display Sprites"; this.DispSprites.UseVisualStyleBackColor = true; // - // checkUseBackdropColor - // - this.checkUseBackdropColor.AutoSize = true; - this.checkUseBackdropColor.Checked = true; - this.checkUseBackdropColor.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkUseBackdropColor.Location = new System.Drawing.Point(170, 100); - this.checkUseBackdropColor.Name = "checkUseBackdropColor"; - this.checkUseBackdropColor.Size = new System.Drawing.Size(59, 17); - this.checkUseBackdropColor.TabIndex = 36; - this.checkUseBackdropColor.Text = "Enable"; - this.checkUseBackdropColor.UseVisualStyleBackColor = true; - // // NESGraphicsConfig // this.AcceptButton = this.OK; diff --git a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs index 6e92d7a375..2bbe2906b8 100644 --- a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs +++ b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs @@ -109,5 +109,7 @@ namespace BizHawk.MultiClient if (BGColorDialog.ShowDialog() == DialogResult.OK) SetColorBox(); } + + } } diff --git a/BizHawk.MultiClient/tools/VirtualPadNES.cs b/BizHawk.MultiClient/tools/VirtualPadNES.cs index 6770d7bee4..aec975de9b 100644 --- a/BizHawk.MultiClient/tools/VirtualPadNES.cs +++ b/BizHawk.MultiClient/tools/VirtualPadNES.cs @@ -39,6 +39,7 @@ namespace BizHawk.MultiClient this.PU.Location = ButtonPoints[0]; this.PU.TabIndex = 1; this.PU.UseVisualStyleBackColor = true; + this.PU.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.PD = new CheckBox(); this.PD.Appearance = System.Windows.Forms.Appearance.Button; @@ -48,6 +49,7 @@ namespace BizHawk.MultiClient this.PD.Location = ButtonPoints[1]; this.PD.TabIndex = 4; this.PD.UseVisualStyleBackColor = true; + this.PD.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.PR = new CheckBox(); this.PR.Appearance = System.Windows.Forms.Appearance.Button; @@ -57,6 +59,7 @@ namespace BizHawk.MultiClient this.PR.Location = ButtonPoints[3]; this.PR.TabIndex = 3; this.PR.UseVisualStyleBackColor = true; + this.PR.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.PL = new CheckBox(); this.PL.Appearance = System.Windows.Forms.Appearance.Button; @@ -66,6 +69,7 @@ namespace BizHawk.MultiClient this.PL.Location = ButtonPoints[2]; this.PL.TabIndex = 2; this.PL.UseVisualStyleBackColor = true; + this.PL.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.B1 = new CheckBox(); this.B1.Appearance = System.Windows.Forms.Appearance.Button; @@ -75,6 +79,7 @@ namespace BizHawk.MultiClient this.B1.Text = "s"; this.B1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B1.UseVisualStyleBackColor = true; + this.B1.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.B2 = new CheckBox(); this.B2.Appearance = System.Windows.Forms.Appearance.Button; @@ -84,6 +89,7 @@ namespace BizHawk.MultiClient this.B2.Text = "S"; this.B2.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B2.UseVisualStyleBackColor = true; + this.B2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.B3 = new CheckBox(); this.B3.Appearance = System.Windows.Forms.Appearance.Button; @@ -93,6 +99,7 @@ namespace BizHawk.MultiClient this.B3.Text = "B"; this.B3.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B3.UseVisualStyleBackColor = true; + this.B3.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.B4 = new CheckBox(); this.B4.Appearance = System.Windows.Forms.Appearance.Button; @@ -102,6 +109,7 @@ namespace BizHawk.MultiClient this.B4.Text = "A"; this.B4.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B4.UseVisualStyleBackColor = true; + this.B4.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); this.Controls.Add(this.PU); this.Controls.Add(this.PD); @@ -159,5 +167,27 @@ namespace BizHawk.MultiClient input.Append("|"); return input.ToString(); } + + private void Buttons_CheckedChanged(object sender, EventArgs e) + { + if (Global.Emulator.SystemId != "NES") return; + if (sender == PU) + Global.ActiveController.SetSticky("Up", PU.Checked); + else if (sender == PD) + Global.ActiveController.SetSticky("Down", PD.Checked); + else if (sender == PL) + Global.ActiveController.SetSticky("Left", PL.Checked); + else if (sender == PR) + Global.ActiveController.SetSticky("Right", PR.Checked); + else if (sender == B1) + Global.ActiveController.SetSticky("Select", B1.Checked); + else if (sender == B2) + Global.ActiveController.SetSticky("Start", B2.Checked); + else if (sender == B3) + Global.ActiveController.SetSticky("B", B3.Checked); + else if (sender == B4) + Global.ActiveController.SetSticky("A", B4.Checked); + + } } }