diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 284e1c9fe1..be685f28bd 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -765,6 +765,12 @@ Component + + UserControl + + + VirtualPadGen6Button.cs + UserControl @@ -1077,6 +1083,9 @@ VirtualPadForm.cs + + VirtualPadGen6Button.cs + VirtualPadN64.cs diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index a800c4802b..85402d19f6 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1414,7 +1414,7 @@ namespace BizHawk.Client.EmuHawk private void AtariSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - config.GenericCoreConfig.DoDialog(this, "Atari 2600 Settings"); + GenericCoreConfig.DoDialog(this, "Atari 2600 Settings"); } #endregion @@ -1652,7 +1652,7 @@ namespace BizHawk.Client.EmuHawk private void GenesisSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - config.GenericCoreConfig.DoDialog(this, "Genesis Settings"); + GenericCoreConfig.DoDialog(this, "Genesis Settings"); } #endregion diff --git a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs index 31226b3a63..c511504e40 100644 --- a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs @@ -1,4 +1,4 @@ -namespace BizHawk.Client.EmuHawk.config +namespace BizHawk.Client.EmuHawk { partial class GenericCoreConfig { @@ -129,7 +129,9 @@ this.Controls.Add(this.button1); this.Controls.Add(this.tabControl1); this.Name = "GenericCoreConfig"; + this.ShowIcon = false; this.Text = "GenericCoreConfig"; + this.Load += new System.EventHandler(this.GenericCoreConfig_Load); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); diff --git a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs index fe52cb9197..bc0c8a5f52 100644 --- a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs +++ b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs @@ -9,7 +9,7 @@ using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Client.EmuHawk; -namespace BizHawk.Client.EmuHawk.config +namespace BizHawk.Client.EmuHawk { public partial class GenericCoreConfig : Form { @@ -55,5 +55,10 @@ namespace BizHawk.Client.EmuHawk.config { syncsettingschanged = true; } + + private void GenericCoreConfig_Load(object sender, EventArgs e) + { + + } } } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs index c04fb377e0..7eb521fb32 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk { public partial class VirtualPadForm : Form, IToolForm { - private int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired + private int defaultWidth; private int defaultHeight; private readonly List _pads = new List(); @@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk private void LoadConfigSettings() { - defaultWidth = Size.Width; //Save these first so that the user can restore to its original size + defaultWidth = Size.Width; defaultHeight = Size.Height; StickyBox.Checked = Global.Config.VirtualPadSticky; @@ -174,9 +174,17 @@ namespace BizHawk.Client.EmuHawk ControllerBox.Controls.Add(gbapad1); break; case "GEN": - VirtualPadGen3Button genpad1 = new VirtualPadGen3Button { Location = new Point(8, 19), Controller = "P1" }; + VirtualPadGen6Button genpad1 = new VirtualPadGen6Button { Location = new Point(8, 19), Controller = "P1" }; + VirtualPadGen6Button genpad2 = new VirtualPadGen6Button { Location = new Point(195, 19), Controller = "P2" }; _pads.Add(genpad1); + _pads.Add(genpad2); ControllerBox.Controls.Add(genpad1); + ControllerBox.Controls.Add(genpad2); + + VirtualPadNESControl gencontrol = new VirtualPadNESControl { Location = new Point(8, 105) }; + _pads.Add(gencontrol); + ControllerBox.Controls.Add(gencontrol); + break; case "Coleco": VirtualPadColeco coleco1 = new VirtualPadColeco { Location = new Point(8, 19), Controller = "P1" }; diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.Designer.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.Designer.cs new file mode 100644 index 0000000000..4d19eae9c4 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.Designer.cs @@ -0,0 +1,228 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class VirtualPadGen6Button + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.BStart = new System.Windows.Forms.CheckBox(); + this.BZ = new System.Windows.Forms.CheckBox(); + this.BX = new System.Windows.Forms.CheckBox(); + this.BY = new System.Windows.Forms.CheckBox(); + this.BC = new System.Windows.Forms.CheckBox(); + this.BA = new System.Windows.Forms.CheckBox(); + this.BB = new System.Windows.Forms.CheckBox(); + this.PL = new System.Windows.Forms.CheckBox(); + this.PD = new System.Windows.Forms.CheckBox(); + this.PR = new System.Windows.Forms.CheckBox(); + this.PU = new System.Windows.Forms.CheckBox(); + this.BM = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // BStart + // + this.BStart.Appearance = System.Windows.Forms.Appearance.Button; + this.BStart.AutoSize = true; + this.BStart.Location = new System.Drawing.Point(74, 28); + this.BStart.Name = "BStart"; + this.BStart.Size = new System.Drawing.Size(24, 23); + this.BStart.TabIndex = 31; + this.BStart.Text = "S"; + this.BStart.UseVisualStyleBackColor = true; + this.BStart.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BZ + // + this.BZ.Appearance = System.Windows.Forms.Appearance.Button; + this.BZ.AutoSize = true; + this.BZ.Location = new System.Drawing.Point(153, 4); + this.BZ.Name = "BZ"; + this.BZ.Size = new System.Drawing.Size(24, 23); + this.BZ.TabIndex = 30; + this.BZ.Text = "Z"; + this.BZ.UseVisualStyleBackColor = true; + this.BZ.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BX + // + this.BX.Appearance = System.Windows.Forms.Appearance.Button; + this.BX.AutoSize = true; + this.BX.Location = new System.Drawing.Point(103, 14); + this.BX.Name = "BX"; + this.BX.Size = new System.Drawing.Size(24, 23); + this.BX.TabIndex = 29; + this.BX.Text = "X"; + this.BX.UseVisualStyleBackColor = true; + this.BX.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BY + // + this.BY.Appearance = System.Windows.Forms.Appearance.Button; + this.BY.AutoSize = true; + this.BY.Location = new System.Drawing.Point(128, 9); + this.BY.Name = "BY"; + this.BY.Size = new System.Drawing.Size(24, 23); + this.BY.TabIndex = 28; + this.BY.Text = "Y"; + this.BY.UseVisualStyleBackColor = true; + this.BY.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BC + // + this.BC.Appearance = System.Windows.Forms.Appearance.Button; + this.BC.AutoSize = true; + this.BC.Location = new System.Drawing.Point(154, 31); + this.BC.Name = "BC"; + this.BC.Size = new System.Drawing.Size(24, 23); + this.BC.TabIndex = 27; + this.BC.Text = "C"; + this.BC.UseVisualStyleBackColor = true; + this.BC.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BA + // + this.BA.Appearance = System.Windows.Forms.Appearance.Button; + this.BA.AutoSize = true; + this.BA.Location = new System.Drawing.Point(104, 41); + this.BA.Name = "BA"; + this.BA.Size = new System.Drawing.Size(24, 23); + this.BA.TabIndex = 26; + this.BA.Text = "A"; + this.BA.UseVisualStyleBackColor = true; + this.BA.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BB + // + this.BB.Appearance = System.Windows.Forms.Appearance.Button; + this.BB.AutoSize = true; + this.BB.Location = new System.Drawing.Point(129, 36); + this.BB.Name = "BB"; + this.BB.Size = new System.Drawing.Size(24, 23); + this.BB.TabIndex = 25; + this.BB.Text = "B"; + this.BB.UseVisualStyleBackColor = true; + this.BB.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PL + // + this.PL.Appearance = System.Windows.Forms.Appearance.Button; + this.PL.AutoSize = true; + this.PL.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Back; + this.PL.Location = new System.Drawing.Point(4, 28); + this.PL.Name = "PL"; + this.PL.Size = new System.Drawing.Size(22, 22); + this.PL.TabIndex = 24; + this.PL.UseVisualStyleBackColor = true; + this.PL.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PD + // + this.PD.Appearance = System.Windows.Forms.Appearance.Button; + this.PD.AutoSize = true; + this.PD.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.BlueDown; + this.PD.Location = new System.Drawing.Point(25, 37); + this.PD.Name = "PD"; + this.PD.Size = new System.Drawing.Size(22, 22); + this.PD.TabIndex = 23; + this.PD.UseVisualStyleBackColor = true; + this.PD.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PR + // + this.PR.Appearance = System.Windows.Forms.Appearance.Button; + this.PR.AutoSize = true; + this.PR.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Forward; + this.PR.Location = new System.Drawing.Point(46, 28); + this.PR.Name = "PR"; + this.PR.Size = new System.Drawing.Size(22, 22); + this.PR.TabIndex = 22; + this.PR.UseVisualStyleBackColor = true; + this.PR.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PU + // + this.PU.Appearance = System.Windows.Forms.Appearance.Button; + this.PU.AutoSize = true; + this.PU.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.BlueUp; + this.PU.Location = new System.Drawing.Point(25, 16); + this.PU.Name = "PU"; + this.PU.Size = new System.Drawing.Size(22, 22); + this.PU.TabIndex = 21; + this.PU.UseVisualStyleBackColor = true; + this.PU.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BM + // + this.BM.Appearance = System.Windows.Forms.Appearance.Button; + this.BM.AutoSize = true; + this.BM.Location = new System.Drawing.Point(63, 56); + this.BM.Name = "BM"; + this.BM.Size = new System.Drawing.Size(26, 23); + this.BM.TabIndex = 32; + this.BM.Text = "M"; + this.BM.UseVisualStyleBackColor = true; + this.BM.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // VirtualPadGen6Button + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.BM); + this.Controls.Add(this.BStart); + this.Controls.Add(this.BZ); + this.Controls.Add(this.BX); + this.Controls.Add(this.BY); + this.Controls.Add(this.BC); + this.Controls.Add(this.BA); + this.Controls.Add(this.BB); + this.Controls.Add(this.PL); + this.Controls.Add(this.PD); + this.Controls.Add(this.PR); + this.Controls.Add(this.PU); + this.Name = "VirtualPadGen6Button"; + this.Size = new System.Drawing.Size(181, 83); + this.Load += new System.EventHandler(this.VirtualPadGen6Button_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox BStart; + private System.Windows.Forms.CheckBox BZ; + private System.Windows.Forms.CheckBox BX; + private System.Windows.Forms.CheckBox BY; + private System.Windows.Forms.CheckBox BC; + private System.Windows.Forms.CheckBox BA; + private System.Windows.Forms.CheckBox BB; + private System.Windows.Forms.CheckBox PL; + private System.Windows.Forms.CheckBox PD; + private System.Windows.Forms.CheckBox PR; + private System.Windows.Forms.CheckBox PU; + private System.Windows.Forms.CheckBox BM; + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.cs new file mode 100644 index 0000000000..b9854d792c --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.cs @@ -0,0 +1,191 @@ +using System; +using System.Text; +using System.Windows.Forms; + +using BizHawk.Client.Common; + +namespace BizHawk.Client.EmuHawk +{ + public partial class VirtualPadGen6Button : UserControl, IVirtualPad + { + public string Controller = "P1"; + + public VirtualPadGen6Button() + { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + BorderStyle = BorderStyle.Fixed3D; + InitializeComponent(); + } + + private void VirtualPadGen6Button_Load(object sender, EventArgs e) + { + + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Up) + { + // TODO: move to next logical key + Refresh(); + } + else if (keyData == Keys.Down) + { + Refresh(); + } + else if (keyData == Keys.Left) + { + Refresh(); + } + else if (keyData == Keys.Right) + { + Refresh(); + } + else if (keyData == Keys.Tab) + { + Refresh(); + } + return true; + } + + public string GetMnemonic() + { + StringBuilder input = new StringBuilder(""); + input.Append(PU.Checked ? "U" : "."); + input.Append(PD.Checked ? "D" : "."); + input.Append(PL.Checked ? "L" : "."); + input.Append(PR.Checked ? "R" : "."); + + input.Append(BA.Checked ? "A" : "."); + input.Append(BB.Checked ? "B" : "."); + input.Append(BC.Checked ? "C" : "."); + + input.Append(BStart.Checked ? "S" : "."); + + input.Append(BX.Checked ? "X" : "."); + input.Append(BY.Checked ? "Y" : "."); + input.Append(BZ.Checked ? "Z" : "."); + + input.Append(BM.Checked ? "M" : "."); + + input.Append("|"); + return input.ToString(); + } + + public void Clear() + { + if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); + + if (BA.Checked) Global.StickyXORAdapter.SetSticky(Controller + " A", false); + if (BB.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); + if (BC.Checked) Global.StickyXORAdapter.SetSticky(Controller + " C", false); + + if (BStart.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Start", false); + + if (BX.Checked) Global.StickyXORAdapter.SetSticky(Controller + " X", false); + if (BY.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Y", false); + if (BZ.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Z", false); + + if (BM.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Mode", false); + + PU.Checked = false; + PD.Checked = false; + PL.Checked = false; + PR.Checked = false; + + BStart.Checked = false; + + BA.Checked = false; + BB.Checked = false; + BC.Checked = false; + + BX.Checked = false; + BY.Checked = false; + BZ.Checked = false; + + BM.Checked = false; + } + + public void SetButtons(string buttons) + { + if (buttons.Length < 12) return; + + if (buttons[0] == '.') PU.Checked = false; else PU.Checked = true; + if (buttons[1] == '.') PD.Checked = false; else PD.Checked = true; + if (buttons[2] == '.') PL.Checked = false; else PL.Checked = true; + if (buttons[3] == '.') PR.Checked = false; else PR.Checked = true; + + if (buttons[4] == '.') BA.Checked = false; else BA.Checked = true; + if (buttons[5] == '.') BB.Checked = false; else BB.Checked = true; + if (buttons[6] == '.') BC.Checked = false; else BC.Checked = true; + + if (buttons[7] == '.') BStart.Checked = false; else BStart.Checked = true; + + if (buttons[8] == '.') BX.Checked = false; else BX.Checked = true; + if (buttons[9] == '.') BY.Checked = false; else BY.Checked = true; + if (buttons[10] == '.') BZ.Checked = false; else BZ.Checked = true; + + if (buttons[11] == '.') BM.Checked = false; else BM.Checked = true; + } + + private void Buttons_CheckedChanged(object sender, EventArgs e) + { + if (sender == PU) + { + Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + } + else if (sender == PD) + { + Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + } + else if (sender == PL) + { + Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + } + else if (sender == PR) + { + Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + } + + else if (sender == BA) + { + Global.StickyXORAdapter.SetSticky(Controller + " A", BA.Checked); + } + else if (sender == BB) + { + Global.StickyXORAdapter.SetSticky(Controller + " B", BB.Checked); + } + else if (sender == BC) + { + Global.StickyXORAdapter.SetSticky(Controller + " C", BC.Checked); + } + + else if (sender == BStart) + { + Global.StickyXORAdapter.SetSticky(Controller + " Start", BStart.Checked); + } + else if (sender == BX) + { + Global.StickyXORAdapter.SetSticky(Controller + " X", BX.Checked); + } + else if (sender == BY) + { + Global.StickyXORAdapter.SetSticky(Controller + " Y", BY.Checked); + } + else if (sender == BZ) + { + Global.StickyXORAdapter.SetSticky(Controller + " Z", BZ.Checked); + } + + else if (sender == BM) + { + Global.StickyXORAdapter.SetSticky(Controller + " Mode", BM.Checked); + } + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.resx b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadGen6Button.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadNESControl.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadNESControl.cs index 749866331b..69d6056c6b 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadNESControl.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadNESControl.cs @@ -85,7 +85,7 @@ namespace BizHawk.Client.EmuHawk public override string GetMnemonic() { StringBuilder input = new StringBuilder(""); - input.Append(B2.Checked ? "r" : "."); + input.Append(B2.Checked ? "r" : B1.Checked ? "P" : "."); input.Append("|"); return input.ToString(); } @@ -112,32 +112,34 @@ namespace BizHawk.Client.EmuHawk private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "NES") - { - return; - } - else if (sender == B1) + if (sender == B1) { Global.StickyXORAdapter.SetSticky("Power", B1.Checked); if (B1.Checked) + { B1.BackColor = Color.Pink; + } else + { B1.BackColor = SystemColors.Control; + } } else if (sender == B2) { Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); if (B2.Checked) + { B2.BackColor = Color.Pink; + } else + { B2.BackColor = SystemColors.Control; + } } } public override void Clear() { - if (Global.Emulator.SystemId != "NES") return; - B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadSaturn.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadSaturn.cs index 39d0c98d44..a1a348ac69 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadSaturn.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadSaturn.cs @@ -106,6 +106,8 @@ namespace BizHawk.Client.EmuHawk PL.Checked = false; PR.Checked = false; + BStart.Checked = false; + BX.Checked = false; BY.Checked = false; BZ.Checked = false;