diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index f21f410059..3ca58e11e1 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -442,6 +442,18 @@ TraceLogger.cs + + UserControl + + + VirtualPadA78.cs + + + UserControl + + + VirtualPadA78Control.cs + UserControl @@ -580,6 +592,12 @@ Resources.resx True + + VirtualPadA78.cs + + + VirtualPadA78Control.cs + VirtualPadC64Keyboard.cs diff --git a/BizHawk.MultiClient/tools/VirtualPadA78.Designer.cs b/BizHawk.MultiClient/tools/VirtualPadA78.Designer.cs new file mode 100644 index 0000000000..88926d6c6f --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78.Designer.cs @@ -0,0 +1,138 @@ +namespace BizHawk.MultiClient +{ + partial class VirtualPadA78 + { + /// + /// 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.B2 = new System.Windows.Forms.CheckBox(); + this.B1 = 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.MultiClient.Properties.Resources.Back; + this.PL.Location = new System.Drawing.Point(32, 19); + this.PL.Name = "PL"; + this.PL.Size = new System.Drawing.Size(22, 22); + this.PL.TabIndex = 7; + 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.MultiClient.Properties.Resources.BlueDown; + this.PD.Location = new System.Drawing.Point(53, 28); + this.PD.Name = "PD"; + this.PD.Size = new System.Drawing.Size(22, 22); + this.PD.TabIndex = 6; + 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.MultiClient.Properties.Resources.Forward; + this.PR.Location = new System.Drawing.Point(74, 19); + this.PR.Name = "PR"; + this.PR.Size = new System.Drawing.Size(22, 22); + this.PR.TabIndex = 5; + 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.MultiClient.Properties.Resources.BlueUp; + this.PU.Location = new System.Drawing.Point(53, 7); + this.PU.Name = "PU"; + this.PU.Size = new System.Drawing.Size(22, 22); + this.PU.TabIndex = 4; + this.PU.UseVisualStyleBackColor = true; + this.PU.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // B2 + // + this.B2.Appearance = System.Windows.Forms.Appearance.Button; + this.B2.AutoSize = true; + this.B2.Location = new System.Drawing.Point(93, 57); + this.B2.Name = "B2"; + this.B2.Size = new System.Drawing.Size(23, 23); + this.B2.TabIndex = 9; + this.B2.Text = "2"; + this.B2.UseVisualStyleBackColor = true; + this.B2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // B1 + // + this.B1.Appearance = System.Windows.Forms.Appearance.Button; + this.B1.AutoSize = true; + this.B1.Location = new System.Drawing.Point(10, 57); + this.B1.Name = "B1"; + this.B1.Size = new System.Drawing.Size(23, 23); + this.B1.TabIndex = 8; + this.B1.Text = "1"; + this.B1.UseVisualStyleBackColor = true; + this.B1.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // VirtualPadA78 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.B2); + this.Controls.Add(this.B1); + this.Controls.Add(this.PL); + this.Controls.Add(this.PD); + this.Controls.Add(this.PR); + this.Controls.Add(this.PU); + this.Name = "VirtualPadA78"; + this.Size = new System.Drawing.Size(128, 89); + this.Load += new System.EventHandler(this.VirtualPadA78_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 B2; + private System.Windows.Forms.CheckBox B1; + } +} diff --git a/BizHawk.MultiClient/tools/VirtualPadA78.cs b/BizHawk.MultiClient/tools/VirtualPadA78.cs new file mode 100644 index 0000000000..cf73889a0f --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.MultiClient +{ + public partial class VirtualPadA78 : UserControl, IVirtualPad + { + public string Controller = "P1"; + + public VirtualPadA78() + { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + this.BorderStyle = BorderStyle.Fixed3D; + this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint); + InitializeComponent(); + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Up) + { + //TODO: move to next logical key + this.Refresh(); + } + else if (keyData == Keys.Down) + { + this.Refresh(); + } + else if (keyData == Keys.Left) + { + this.Refresh(); + } + else if (keyData == Keys.Right) + { + this.Refresh(); + } + else if (keyData == Keys.Tab) + { + this.Refresh(); + } + return true; + } + + private void VirtualPad_Paint(object sender, PaintEventArgs e) + { + + + } + + private void VirtualPadA78_Load(object sender, EventArgs e) + { + + } + + 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(B1.Checked ? "1" : "."); + input.Append(B2.Checked ? "2" : "."); + input.Append("|"); + return input.ToString(); + } + + public void SetButtons(string buttons) + { + if (buttons.Length < 6) 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] == '.') B1.Checked = false; else B1.Checked = true; + if (buttons[5] == '.') B2.Checked = false; else B2.Checked = true; + } + + private void Buttons_CheckedChanged(object sender, EventArgs e) + { + if (Global.Emulator.SystemId != "A78") + { + return; + } + else 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 == B1) + { + Global.StickyXORAdapter.SetSticky(Controller + " Trigger", B1.Checked); + } + else if (sender == B2) + { + Global.StickyXORAdapter.SetSticky(Controller + " Trigger 2", B2.Checked); + } + } + + public void Clear() + { + if (Global.Emulator.SystemId != "A78") return; + + + 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 (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Trigger", false); + if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Trigger 2", false); + + + PU.Checked = false; + PD.Checked = false; + PL.Checked = false; + PR.Checked = false; + B1.Checked = false; + B2.Checked = false; + } + } +} diff --git a/BizHawk.MultiClient/tools/VirtualPadA78.resx b/BizHawk.MultiClient/tools/VirtualPadA78.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78.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.MultiClient/tools/VirtualPadA78Control.Designer.cs b/BizHawk.MultiClient/tools/VirtualPadA78Control.Designer.cs new file mode 100644 index 0000000000..098dc3c271 --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78Control.Designer.cs @@ -0,0 +1,108 @@ +namespace BizHawk.MultiClient +{ + partial class VirtualPadA78Control + { + /// + /// 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.B2 = new System.Windows.Forms.CheckBox(); + this.B1 = new System.Windows.Forms.CheckBox(); + this.B4 = new System.Windows.Forms.CheckBox(); + this.B3 = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // B2 + // + this.B2.Appearance = System.Windows.Forms.Appearance.Button; + this.B2.AutoSize = true; + this.B2.Location = new System.Drawing.Point(56, 5); + this.B2.Name = "B2"; + this.B2.Size = new System.Drawing.Size(45, 23); + this.B2.TabIndex = 11; + this.B2.Text = "Reset"; + this.B2.UseVisualStyleBackColor = true; + this.B2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // B1 + // + this.B1.Appearance = System.Windows.Forms.Appearance.Button; + this.B1.AutoSize = true; + this.B1.Location = new System.Drawing.Point(3, 5); + this.B1.Name = "B1"; + this.B1.Size = new System.Drawing.Size(47, 23); + this.B1.TabIndex = 10; + this.B1.Text = "Power"; + this.B1.UseVisualStyleBackColor = true; + this.B1.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // B4 + // + this.B4.Appearance = System.Windows.Forms.Appearance.Button; + this.B4.AutoSize = true; + this.B4.Location = new System.Drawing.Point(160, 5); + this.B4.Name = "B4"; + this.B4.Size = new System.Drawing.Size(47, 23); + this.B4.TabIndex = 13; + this.B4.Text = "Pause"; + this.B4.UseVisualStyleBackColor = true; + this.B4.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // B3 + // + this.B3.Appearance = System.Windows.Forms.Appearance.Button; + this.B3.AutoSize = true; + this.B3.Location = new System.Drawing.Point(107, 5); + this.B3.Name = "B3"; + this.B3.Size = new System.Drawing.Size(47, 23); + this.B3.TabIndex = 12; + this.B3.Text = "Select"; + this.B3.UseVisualStyleBackColor = true; + this.B3.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged); + // + // VirtualPadA78Control + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.B4); + this.Controls.Add(this.B3); + this.Controls.Add(this.B2); + this.Controls.Add(this.B1); + this.Name = "VirtualPadA78Control"; + this.Size = new System.Drawing.Size(217, 34); + this.Load += new System.EventHandler(this.VirtualPadA78Control_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox B2; + private System.Windows.Forms.CheckBox B1; + private System.Windows.Forms.CheckBox B4; + private System.Windows.Forms.CheckBox B3; + } +} diff --git a/BizHawk.MultiClient/tools/VirtualPadA78Control.cs b/BizHawk.MultiClient/tools/VirtualPadA78Control.cs new file mode 100644 index 0000000000..3e3acaa6b3 --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78Control.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.MultiClient +{ + public partial class VirtualPadA78Control : UserControl, IVirtualPad + { + public VirtualPadA78Control() + { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + this.BorderStyle = BorderStyle.Fixed3D; + this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint); + InitializeComponent(); + } + + private void VirtualPadA78Control_Load(object sender, EventArgs e) + { + + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Up) + { + //TODO: move to next logical key + this.Refresh(); + } + else if (keyData == Keys.Down) + { + this.Refresh(); + } + else if (keyData == Keys.Left) + { + this.Refresh(); + } + else if (keyData == Keys.Right) + { + this.Refresh(); + } + else if (keyData == Keys.Tab) + { + this.Refresh(); + } + return true; + } + + private void VirtualPad_Paint(object sender, PaintEventArgs e) + { + + } + + public string GetMnemonic() + { + StringBuilder input = new StringBuilder(""); + input.Append(B1.Checked ? "P" : "."); + input.Append(B2.Checked ? "r" : "."); + input.Append(B3.Checked ? "s" : "."); + input.Append(B4.Checked ? "p" : "."); + input.Append("|"); + return input.ToString(); + } + + public void SetButtons(string buttons) + { + if (buttons.Length < 4) return; + if (buttons[0] == '.') B1.Checked = false; else B1.Checked = true; + if (buttons[1] == '.') B2.Checked = false; else B2.Checked = true; + if (buttons[2] == '.') B3.Checked = false; else B3.Checked = true; + if (buttons[3] == '.') B4.Checked = false; else B4.Checked = true; + } + + private void Buttons_CheckedChanged(object sender, EventArgs e) + { + if (Global.Emulator.SystemId != "A78") + { + return; + } + else if (sender == B1) + { + Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + } + else if (sender == B2) + { + Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + } + else if (sender == B3) + { + Global.StickyXORAdapter.SetSticky("Select", B3.Checked); + } + else if (sender == B4) + { + Global.StickyXORAdapter.SetSticky("Pause", B4.Checked); + } + } + + public void Clear() + { + if (Global.Emulator.SystemId != "A78") return; + + if (B1.Checked) Global.StickyXORAdapter.SetSticky("Power", false); + if (B2.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); + if (B3.Checked) Global.StickyXORAdapter.SetSticky("Select", false); + if (B4.Checked) Global.StickyXORAdapter.SetSticky("Pause", false); + + B1.Checked = false; + B2.Checked = false; + B3.Checked = false; + B4.Checked = false; + } + } +} diff --git a/BizHawk.MultiClient/tools/VirtualPadA78Control.resx b/BizHawk.MultiClient/tools/VirtualPadA78Control.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.MultiClient/tools/VirtualPadA78Control.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.MultiClient/tools/VirtualPadColeco.cs b/BizHawk.MultiClient/tools/VirtualPadColeco.cs index 17ce8a6998..7f01a654a6 100644 --- a/BizHawk.MultiClient/tools/VirtualPadColeco.cs +++ b/BizHawk.MultiClient/tools/VirtualPadColeco.cs @@ -56,8 +56,8 @@ namespace BizHawk.MultiClient private void VirtualPad_Paint(object sender, PaintEventArgs e) { - } + public string GetMnemonic() { StringBuilder input = new StringBuilder(""); diff --git a/BizHawk.MultiClient/tools/VirtualPadForm.cs b/BizHawk.MultiClient/tools/VirtualPadForm.cs index eeb8176b20..2c0c155bc5 100644 --- a/BizHawk.MultiClient/tools/VirtualPadForm.cs +++ b/BizHawk.MultiClient/tools/VirtualPadForm.cs @@ -81,6 +81,22 @@ namespace BizHawk.MultiClient Pads.Add(ataricontrols); ControllerBox.Controls.Add(Pads[2] as Control); break; + case "A78": + VirtualPadA78 atari78pad1 = new VirtualPadA78(); + atari78pad1.Location = new Point(8, 19); + atari78pad1.Controller = "P1"; + VirtualPadA78 atari78pad2 = new VirtualPadA78(); + atari78pad2.Location = new Point(150, 19); + atari78pad2.Controller = "P2"; + Pads.Add(atari78pad1); + Pads.Add(atari78pad2); + ControllerBox.Controls.Add(atari78pad1); + ControllerBox.Controls.Add(atari78pad2); + VirtualPadA78Control atari78controls = new VirtualPadA78Control(); + atari78controls.Location = new Point(8, 125); + Pads.Add(atari78controls); + ControllerBox.Controls.Add(Pads[2] as Control); + break; case "NES": VirtualPadNES nespad1 = new VirtualPadNES(); nespad1.Location = new Point(8, 19);