diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 02727d7f8b..81c3f004f6 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -959,6 +959,12 @@ Component + + UserControl + + + VirtualPadWonderSawn.cs + Form @@ -1294,6 +1300,9 @@ VirtualPadSaturnControl.cs + + VirtualPadWonderSawn.cs + RamPoke.cs diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs index 56ade6df5a..e1716c1a10 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadForm.cs @@ -225,6 +225,9 @@ namespace BizHawk.Client.EmuHawk ControllerBox.Controls.Add(new VirtualPadSaturnControl { Location = new Point(8, 125) }); ControllerBox.Controls.Add(new VirtualPadSaturn { Location = new Point(8, 19), Controller = "P1" }); break; + case "WSWAN": + ControllerBox.Controls.Add(new VirtualPadWonderSawn { Location = new Point(8, 19) }); + break; } // Hack for now diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.Designer.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.Designer.cs new file mode 100644 index 0000000000..9a60ca70ca --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.Designer.cs @@ -0,0 +1,229 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class VirtualPadWonderSawn + { + /// + /// 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.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.PL2 = new System.Windows.Forms.CheckBox(); + this.PD2 = new System.Windows.Forms.CheckBox(); + this.PR2 = new System.Windows.Forms.CheckBox(); + this.PU2 = new System.Windows.Forms.CheckBox(); + this.BStart = new System.Windows.Forms.CheckBox(); + this.BA = new System.Windows.Forms.CheckBox(); + this.BB = new System.Windows.Forms.CheckBox(); + this.BPower = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // 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(1, 15); + this.PL.Name = "PL"; + this.PL.Size = new System.Drawing.Size(22, 22); + this.PL.TabIndex = 11; + 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(22, 24); + this.PD.Name = "PD"; + this.PD.Size = new System.Drawing.Size(22, 22); + this.PD.TabIndex = 10; + 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(43, 15); + this.PR.Name = "PR"; + this.PR.Size = new System.Drawing.Size(22, 22); + this.PR.TabIndex = 9; + 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(22, 3); + this.PU.Name = "PU"; + this.PU.Size = new System.Drawing.Size(22, 22); + this.PU.TabIndex = 8; + this.PU.UseVisualStyleBackColor = true; + this.PU.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PL2 + // + this.PL2.Appearance = System.Windows.Forms.Appearance.Button; + this.PL2.AutoSize = true; + this.PL2.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Back; + this.PL2.Location = new System.Drawing.Point(1, 79); + this.PL2.Name = "PL2"; + this.PL2.Size = new System.Drawing.Size(22, 22); + this.PL2.TabIndex = 15; + this.PL2.UseVisualStyleBackColor = true; + this.PL2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PD2 + // + this.PD2.Appearance = System.Windows.Forms.Appearance.Button; + this.PD2.AutoSize = true; + this.PD2.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.BlueDown; + this.PD2.Location = new System.Drawing.Point(22, 88); + this.PD2.Name = "PD2"; + this.PD2.Size = new System.Drawing.Size(22, 22); + this.PD2.TabIndex = 14; + this.PD2.UseVisualStyleBackColor = true; + this.PD2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PR2 + // + this.PR2.Appearance = System.Windows.Forms.Appearance.Button; + this.PR2.AutoSize = true; + this.PR2.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Forward; + this.PR2.Location = new System.Drawing.Point(43, 79); + this.PR2.Name = "PR2"; + this.PR2.Size = new System.Drawing.Size(22, 22); + this.PR2.TabIndex = 13; + this.PR2.UseVisualStyleBackColor = true; + this.PR2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // PU2 + // + this.PU2.Appearance = System.Windows.Forms.Appearance.Button; + this.PU2.AutoSize = true; + this.PU2.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.BlueUp; + this.PU2.Location = new System.Drawing.Point(22, 67); + this.PU2.Name = "PU2"; + this.PU2.Size = new System.Drawing.Size(22, 22); + this.PU2.TabIndex = 12; + this.PU2.UseVisualStyleBackColor = true; + this.PU2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BStart + // + this.BStart.Appearance = System.Windows.Forms.Appearance.Button; + this.BStart.AutoSize = true; + this.BStart.Location = new System.Drawing.Point(79, 78); + this.BStart.Name = "BStart"; + this.BStart.Size = new System.Drawing.Size(24, 23); + this.BStart.TabIndex = 21; + this.BStart.Text = "S"; + this.BStart.UseVisualStyleBackColor = true; + this.BStart.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(145, 30); + this.BA.Name = "BA"; + this.BA.Size = new System.Drawing.Size(24, 23); + this.BA.TabIndex = 23; + 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(122, 35); + this.BB.Name = "BB"; + this.BB.Size = new System.Drawing.Size(24, 23); + this.BB.TabIndex = 22; + this.BB.Text = "B"; + this.BB.UseVisualStyleBackColor = true; + this.BB.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // BPower + // + this.BPower.Appearance = System.Windows.Forms.Appearance.Button; + this.BPower.AutoSize = true; + this.BPower.ForeColor = System.Drawing.Color.Red; + this.BPower.Location = new System.Drawing.Point(108, 78); + this.BPower.Name = "BPower"; + this.BPower.Size = new System.Drawing.Size(47, 23); + this.BPower.TabIndex = 24; + this.BPower.Text = "Power"; + this.BPower.UseVisualStyleBackColor = true; + this.BPower.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // VirtualPadWonderSawn + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.BPower); + this.Controls.Add(this.BA); + this.Controls.Add(this.BB); + this.Controls.Add(this.BStart); + this.Controls.Add(this.PL2); + this.Controls.Add(this.PD2); + this.Controls.Add(this.PR2); + this.Controls.Add(this.PU2); + this.Controls.Add(this.PL); + this.Controls.Add(this.PD); + this.Controls.Add(this.PR); + this.Controls.Add(this.PU); + this.Name = "VirtualPadWonderSawn"; + this.Size = new System.Drawing.Size(179, 119); + this.Load += new System.EventHandler(this.VirtualPadWonderSawn_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + 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 PL2; + private System.Windows.Forms.CheckBox PD2; + private System.Windows.Forms.CheckBox PR2; + private System.Windows.Forms.CheckBox PU2; + private System.Windows.Forms.CheckBox BStart; + private System.Windows.Forms.CheckBox BA; + private System.Windows.Forms.CheckBox BB; + private System.Windows.Forms.CheckBox BPower; + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.cs new file mode 100644 index 0000000000..c80dfec51d --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.cs @@ -0,0 +1,206 @@ +using System; +using System.Text; +using System.Windows.Forms; + +using BizHawk.Client.Common; + +namespace BizHawk.Client.EmuHawk +{ + public partial class VirtualPadWonderSawn : UserControl, IVirtualPad + { + public string Controller { get; set; } + + public VirtualPadWonderSawn() + { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + BorderStyle = BorderStyle.Fixed3D; + Paint += VirtualPad_Paint; + InitializeComponent(); + + Controller = ""; + } + + private void VirtualPadWonderSawn_Load(object sender, EventArgs e) + { + + } + + private void VirtualPad_Paint(object sender, PaintEventArgs 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 ? "Up X" : "."); + input.Append(PD.Checked ? "Down X" : "."); + input.Append(PL.Checked ? "Left X" : "."); + input.Append(PR.Checked ? "Right X" : "."); + + input.Append("|"); + + input.Append(PU2.Checked ? "Up Y" : "."); + input.Append(PD2.Checked ? "Down Y" : "."); + input.Append(PL2.Checked ? "Left Y" : "."); + input.Append(PR2.Checked ? "Right Y" : "."); + + input.Append("|"); + + input.Append(BStart.Checked ? "Start" : "."); + input.Append(BB.Checked ? "B" : "."); + input.Append(BA.Checked ? "A" : "."); + input.Append(BPower.Checked ? "P" : "."); + + input.Append("|"); + + return input.ToString(); + } + + public void Clear() + { + if (Global.Emulator.SystemId != "WSWAN") + { + return; + } + + if (PU.Checked) Global.StickyXORAdapter.SetSticky("Up X", false); + if (PD.Checked) Global.StickyXORAdapter.SetSticky("Down X", false); + if (PL.Checked) Global.StickyXORAdapter.SetSticky("Left X", false); + if (PR.Checked) Global.StickyXORAdapter.SetSticky("Right X", false); + + if (PU2.Checked) Global.StickyXORAdapter.SetSticky("Up Y", false); + if (PD2.Checked) Global.StickyXORAdapter.SetSticky("Down Y", false); + if (PL2.Checked) Global.StickyXORAdapter.SetSticky("Left Y", false); + if (PR2.Checked) Global.StickyXORAdapter.SetSticky("Right Y", false); + + if (BStart.Checked) Global.StickyXORAdapter.SetSticky("Start", false); + + if (BB.Checked) Global.StickyXORAdapter.SetSticky("B", false); + if (BA.Checked) Global.StickyXORAdapter.SetSticky("A", false); + + if (BPower.Checked) Global.StickyXORAdapter.SetSticky("Power", false); + + PU.Checked = false; + PD.Checked = false; + PL.Checked = false; + PR.Checked = false; + + PU2.Checked = false; + PD2.Checked = false; + PL2.Checked = false; + PR2.Checked = false; + + BStart.Checked = false; + + BA.Checked = false; + BB.Checked = false; + + BPower.Checked = false; + } + + public void SetButtons(string buttons) + { + if (buttons.Length < 15) 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[5] == '.') PU2.Checked = false; else PU2.Checked = true; + if (buttons[6] == '.') PD2.Checked = false; else PD2.Checked = true; + if (buttons[7] == '.') PL2.Checked = false; else PL2.Checked = true; + if (buttons[8] == '.') PR2.Checked = false; else PR2.Checked = true; + + if (buttons[10] == '.') BStart.Checked = false; else BStart.Checked = true; + if (buttons[11] == '.') BB.Checked = false; else BB.Checked = true; + if (buttons[12] == '.') BA.Checked = false; else BA.Checked = true; + if (buttons[13] == '.') BPower.Checked = false; else BPower.Checked = true; + } + + private void Buttons_CheckedChanged(object sender, EventArgs e) + { + if (Global.Emulator.SystemId != "WSWAN") + { + return; + } + else if (sender == PU) + { + Global.StickyXORAdapter.SetSticky("Up X", PU.Checked); + } + else if (sender == PD) + { + Global.StickyXORAdapter.SetSticky("Down X", PD.Checked); + } + else if (sender == PL) + { + Global.StickyXORAdapter.SetSticky("Left X", PL.Checked); + } + else if (sender == PR) + { + Global.StickyXORAdapter.SetSticky("Right X", PR.Checked); + } + else if (sender == PU2) + { + Global.StickyXORAdapter.SetSticky("Up Y", PU2.Checked); + } + else if (sender == PD2) + { + Global.StickyXORAdapter.SetSticky("Down Y", PD2.Checked); + } + else if (sender == PL2) + { + Global.StickyXORAdapter.SetSticky("Left Y", PL2.Checked); + } + else if (sender == PR2) + { + Global.StickyXORAdapter.SetSticky("Right Y", PR2.Checked); + } + else if (sender == BStart) + { + Global.StickyXORAdapter.SetSticky("Start", BStart.Checked); + } + else if (sender == BB) + { + Global.StickyXORAdapter.SetSticky("B", BB.Checked); + } + else if (sender == BA) + { + Global.StickyXORAdapter.SetSticky("A", BA.Checked); + } + else if (sender == BPower) + { + Global.StickyXORAdapter.SetSticky("Power", BPower.Checked); + } + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.resx b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPadWonderSawn.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